Modernize o.e.dltk.ruby.core.tests.
* Bump BREE to Java 1.6.
* Add missing @Override and remove useless non-javadoc comments.
* Generify code.
* Switch Eclipse-LazyStart to Bundle-ActivationPolicy.
* Move away from deprecated method calls.
* Add missing copyright headers.
* Enable save actions to ease keeping the code cleaner.
Change-Id: Id0ad8d72c04134f1e99b5ab2df27edd08c618eaa
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/.classpath b/tests/org.eclipse.dltk.ruby.core.tests/.classpath
index 64c5e31..ad32c83 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/.classpath
+++ b/tests/org.eclipse.dltk.ruby.core.tests/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.dltk.ruby.core.tests/.settings/org.eclipse.jdt.core.prefs
index b6e0cc1..fcb3439 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/org.eclipse.dltk.ruby.core.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,13 +1,106 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.dltk.ruby.core.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..72e1da1
--- /dev/null
+++ b/tests/org.eclipse.dltk.ruby.core.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,59 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=false
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.dltk.ruby.core.tests/META-INF/MANIFEST.MF
index 8714563..2969fdf 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.dltk.ruby.core.tests/META-INF/MANIFEST.MF
@@ -15,7 +15,7 @@
org.eclipse.dltk.ruby.launching,
org.eclipse.dltk.launching;bundle-version="0.0.0",
org.eclipse.dltk.ruby.debug
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.dltk.ruby.core.tests,
org.eclipse.dltk.ruby.core.tests.parser
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/Activator.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/Activator.java
index 5d6f98c..b6a3fbb 100755
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/Activator.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/Activator.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests;
@@ -35,18 +34,12 @@
plugin = this;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/assist/RubySelectionTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/assist/RubySelectionTests.java
index f1e3855..b8de0b7 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/assist/RubySelectionTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/assist/RubySelectionTests.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.assist;
@@ -31,6 +30,7 @@
super();
}
+ @Override
public boolean checkSelection(String source, int start, int end) {
return super.checkSelection(source, start, end);
}
@@ -43,7 +43,7 @@
return this.actualSelectionEnd;
}
- };
+ }
private static final String SELECTION_PROJECT = "RUBY_Selection";
@@ -53,6 +53,7 @@
super("org.eclipse.dltk.ruby.core.tests", name);
}
+ @Override
public void setUpSuite() throws Exception {
PROJECT = setUpScriptProjectTo(SELECTION_PROJECT, "Selection");
@@ -64,6 +65,7 @@
waitForAutoBuild();
}
+ @Override
public void tearDownSuite () throws Exception {
deleteProject(SELECTION_PROJECT);
super.tearDownSuite();
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/AbstractASTTest.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/AbstractASTTest.java
index 4cc1d29..f609c2f 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/AbstractASTTest.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/AbstractASTTest.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.parser;
@@ -40,6 +39,7 @@
return lastInfo;
}
+ @Override
public void reportProblem(IProblem problem) {
count++;
lastInfo = problem.getMessage();
@@ -69,6 +69,7 @@
final ASTNode[] result = new ASTNode[] { null };
ASTVisitor visitor = new ASTVisitor() {
+ @Override
public boolean visitGeneral(ASTNode node) throws Exception {
if ((node.sourceStart() == start || start == -1)
&& (node.sourceEnd() == end || end == -1)) {
@@ -88,7 +89,7 @@
return result[0];
}
- protected abstract Class getExpectedClass();
+ protected abstract Class<?> getExpectedClass();
protected ASTNode checkNode(String content, int start, int end)
throws Exception {
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/AST2StringVisitor.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/AST2StringVisitor.java
index 8b98fa7..da64db9 100755
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/AST2StringVisitor.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/AST2StringVisitor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.parser.jruby;
@@ -28,6 +27,7 @@
indent = "";
}
+ @Override
public boolean visitGeneral(ASTNode node) throws Exception {
String str = node.debugString();
this.printer.println(indent + "+" + str);
@@ -40,6 +40,7 @@
return name.substring(pos + 1);
}
+ @Override
public void endvisitGeneral(ASTNode node) throws Exception {
indent = indent.substring(0, indent.length() - 2);
this.printer.println(indent + "-" + simplifyClassName(node.getClass().getName()));
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/ParserSuite.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/ParserSuite.java
index 0d68380..6b523cc 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/ParserSuite.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/ParserSuite.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.parser.jruby;
@@ -30,10 +29,10 @@
public ParserSuite(String testsDirectory) {
super(testsDirectory);
- Enumeration entryPaths = Activator.getDefault().getBundle()
+ Enumeration<String> entryPaths = Activator.getDefault().getBundle()
.getEntryPaths(testsDirectory);
while (entryPaths.hasMoreElements()) {
- final String path = (String) entryPaths.nextElement();
+ final String path = entryPaths.nextElement();
if (path.endsWith(".exp"))
continue;
URL entry = Activator.getDefault().getBundle().getEntry(path);
@@ -48,12 +47,14 @@
final String cleanPath = (pos >= 0 ? path.substring(0, pos) : path);
addTest(new TestCase(name) {
+ @Override
public void setUp() {
}
+ @Override
protected void runTest() throws Throwable {
- Map map = new HashMap();
+ Map<Character, Integer> map = new HashMap<Character, Integer>();
String input = loadInput(cleanPath + ".rb", map);
String output = loadOutput(cleanPath + ".exp", map);
@@ -84,7 +85,7 @@
return new String(data, "utf-8");
}
- private String loadInput(String path, Map map) throws IOException {
+ private String loadInput(String path, Map<Character, Integer> map) throws IOException {
String content = loadContent(path);
StringBuffer result = new StringBuffer();
char[] charArray = content.toCharArray();
@@ -100,14 +101,14 @@
return result.toString();
}
- private String loadOutput(String path, Map map) throws IOException {
+ private String loadOutput(String path, Map<Character, Integer> map) throws IOException {
String content = loadContent(path);
StringBuffer result = new StringBuffer();
for (int i = 0; i < content.length(); i++) {
char c = content.charAt(i);
if (c > '~') {
- Integer pos = (Integer) map.get(new Character(c));
+ Integer pos = map.get(new Character(c));
Assert.isNotNull(pos);
result.append(pos.intValue());
} else {
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/ZippedParserSuite.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/ZippedParserSuite.java
index 141ad64..6421bb2 100755
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/ZippedParserSuite.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/parser/jruby/ZippedParserSuite.java
@@ -16,10 +16,6 @@
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
import org.eclipse.dltk.ast.parser.IModuleDeclaration;
import org.eclipse.dltk.compiler.env.ModuleSource;
import org.eclipse.dltk.core.DLTKLanguageManager;
@@ -28,6 +24,9 @@
import org.eclipse.dltk.ruby.core.tests.Activator;
import org.eclipse.dltk.ruby.internal.parser.JRubySourceParser;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
public class ZippedParserSuite extends TestSuite {
public ZippedParserSuite(String testsZip) {
@@ -37,19 +36,20 @@
zipFile = new ZipFile(AbstractModelTests.storeToMetadata(Activator
.getDefault().getBundle(), "parser.zip", testsZip));
try {
- Enumeration entries = zipFile.entries();
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
- ZipEntry entry = (ZipEntry) entries.nextElement();
- final String fileName = entry.getName();
+ ZipEntry entry = entries.nextElement();
final String content = loadContent(zipFile
.getInputStream(entry));
addTest(new TestCase(entry.getName()) {
+ @Override
public void setUp() {
}
+ @Override
protected void runTest() throws Throwable {
JRubySourceParser.setSilentState(false);
IModuleDeclaration module = DLTKLanguageManager
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/resources/RubyResourcesTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/resources/RubyResourcesTests.java
index d2c5036..2a9e474 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/resources/RubyResourcesTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/resources/RubyResourcesTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,6 +38,7 @@
return new Suite(RubyResourcesTests.class);
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProject(PROJECT1);
@@ -45,6 +46,7 @@
waitUntilIndexesReady();
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(PROJECT1);
deleteProject(PROJECT2);
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/rewriter/RewriterTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/rewriter/RewriterTests.java
index ce9f881..c8fc4b7 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/rewriter/RewriterTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/rewriter/RewriterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,10 @@
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.rewriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -17,10 +21,6 @@
import org.eclipse.dltk.ruby.core.tests.Activator;
import org.eclipse.dltk.ruby.internal.parsers.jruby.ASTUtils;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
/**
* @author mhowe
*
@@ -50,6 +50,7 @@
super(Activator.PLUGIN_ID, name);
}
+ @Override
public void setUpSuite() throws Exception {
setUpScriptProject(SRC_PROJECT);
super.setUpSuite();
@@ -57,6 +58,7 @@
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(SRC_PROJECT);
super.tearDownSuite();
@@ -74,16 +76,6 @@
String content = loadContent(PATH_PREFIX + "empty_script.rb");
ModuleDeclaration ast = ASTUtils.getAST(content.toCharArray());
- String[] header = new String[] {
- "###############################################################################\n",
- "# Copyright (c) 2005, 2007 IBM Corporation and others.\n",
- "# All rights reserved. This program and the accompanying materials\n",
- "# are made available under the terms of the Eclipse Public License v1.0\n",
- "# which accompanies this distribution, and is available at\n",
- "# http://www.eclipse.org/legal/epl-v10.html\n",
- "#\n",
- "###############################################################################\n"
- };
//add header to to ast
checkResults(ast, loadContent(PATH_PREFIX + "empty_script_with_header.rb"));
@@ -449,11 +441,6 @@
assertTrue(false);
}
- private String getContent(ModuleDeclaration ast) {
- //TODO - get string from AST.
- return null;
- }
-
//This assumes some way of resolving the formatted text from an AST
private void checkResults(ModuleDeclaration ast, String contents) {
assertTrue(false);
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinModelManipulationTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinModelManipulationTests.java
index 8ce3c2c..cd475c1 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinModelManipulationTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinModelManipulationTests.java
@@ -1,15 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.search.mixin;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IBuildpathEntry;
@@ -45,12 +45,14 @@
return new Suite(MixinModelManipulationTests.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
SCRIPT_PROJECT = setUpScriptProject(PROJECT_NAME);
waitUntilIndexesReady();
}
+ @Override
protected void tearDown() throws Exception {
if (SCRIPT_PROJECT != null) {
deleteProject(SCRIPT_PROJECT.getElementName());
@@ -60,14 +62,14 @@
public void REM_testTotalKeysCount() {
MixinModel model = new MixinModel(RubyLanguageToolkit.getDefault());
- String[] keys = model.findKeys("*");
+ String[] keys = model.findKeys("*", new NullProgressMonitor());
assertEquals(26, keys.length);
}
// If fails, call ghostbusters, please
public void testForGhosts() {
MixinModel model = new MixinModel(RubyLanguageToolkit.getDefault());
- String[] keys = model.findKeys("*ghost*");
+ String[] keys = model.findKeys("*ghost*", new NullProgressMonitor());
assertEquals(0, keys.length);
}
@@ -93,7 +95,7 @@
public void testProjectFragmentDeletion() throws Exception {
MixinModel model = new MixinModel(RubyLanguageToolkit.getDefault());
- assertEquals(1, model.find("Foo").length);
+ assertEquals(1, model.find("Foo", new NullProgressMonitor()).length);
IMixinElement mixinElement = model.get("Foo");
assertNotNull(mixinElement);
Object[] objs = mixinElement.getAllObjects();
@@ -107,7 +109,7 @@
null);
waitUntilIndexesReady();
- assertEquals(0, model.find("Foo").length);
+ assertEquals(0, model.find("Foo", new NullProgressMonitor()).length);
mixinElement = model.get("Foo");
assertNull(mixinElement);
}
@@ -115,7 +117,7 @@
public void testSourceFolderDeletion() throws Exception {
MixinModel model = new MixinModel(RubyLanguageToolkit.getDefault());
- assertEquals(1, model.find("Folder").length);
+ assertEquals(1, model.find("Folder", new NullProgressMonitor()).length);
IMixinElement mixinElement = model.get("Folder");
assertNotNull(mixinElement);
Object[] objs = mixinElement.getAllObjects();
@@ -129,7 +131,7 @@
null);
waitUntilIndexesReady();
- assertEquals(0, model.find("Folder").length);
+ assertEquals(0, model.find("Folder", new NullProgressMonitor()).length);
mixinElement = model.get("Folder");
assertNull(mixinElement);
}
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinProjectIsolationTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinProjectIsolationTests.java
index df55de8..e007a68 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinProjectIsolationTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinProjectIsolationTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2016 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -52,6 +52,7 @@
private IScriptProject project1;
private IScriptProject project2;
+ @Override
protected void setUp() throws Exception {
super.setUp();
project1 = setUpScriptProject(PROJECT1_NAME);
@@ -59,6 +60,7 @@
waitUntilIndexesReady();
}
+ @Override
protected void tearDown() throws Exception {
deleteProject(PROJECT1_NAME);
deleteProject(PROJECT2_NAME);
@@ -129,10 +131,10 @@
private void removeBuildpathEntry(final IScriptProject project,
final IBuildpathEntry entry) throws ModelException {
- final List cp = new ArrayList();
+ final List<IBuildpathEntry> cp = new ArrayList<IBuildpathEntry>();
cp.addAll(Arrays.asList(project.getRawBuildpath()));
assertTrue(cp.remove(entry));
- IBuildpathEntry[] newCP = (IBuildpathEntry[]) cp
+ IBuildpathEntry[] newCP = cp
.toArray(new IBuildpathEntry[cp.size()]);
IModelStatus status = BuildpathEntry.validateBuildpath(project, newCP);
assertEquals(IStatus.OK, status.getSeverity());
@@ -146,7 +148,7 @@
IMixinElement[] children = element.getChildren();
assertNotNull(children);
assertEquals(childrenNames.length, children.length);
- final Set names = new HashSet();
+ final Set<String> names = new HashSet<String>();
for (int i = 0; i < children.length; ++i) {
names.add(children[i].getLastKeySegment());
}
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinTestsSuite.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinTestsSuite.java
index 22a3e94..f325ba3 100755
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinTestsSuite.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/MixinTestsSuite.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.search.mixin;
@@ -17,12 +16,6 @@
import java.util.Iterator;
import java.util.StringTokenizer;
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
import org.eclipse.dltk.compiler.util.Util;
import org.eclipse.dltk.core.mixin.IMixinElement;
import org.eclipse.dltk.core.mixin.MixinModel;
@@ -33,6 +26,12 @@
import org.eclipse.dltk.utils.CharArraySequence;
import org.eclipse.dltk.utils.TextUtils;
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
public class MixinTestsSuite extends TestSuite {
public static Test suite() {
@@ -47,11 +46,11 @@
this.path = path;
}
+ @Override
protected void runTest() throws Throwable {
- final Collection assertions = new ArrayList();
+ final Collection<IAssertion> assertions = new ArrayList<IAssertion>();
CharSequence content = loadContent(path);
String[] lines = TextUtils.splitLines(content);
- int lineOffset = 0;
for (int i = 0; i < lines.length; i++) {
String line = lines[i].trim();
int pos = line.indexOf("##");
@@ -70,12 +69,11 @@
// Assert.isLegal(false);
}
}
- lineOffset += lines[i].length() + 1;
}
assertTrue(assertions.size() > 0);
- for (Iterator iter = assertions.iterator(); iter.hasNext();) {
- IAssertion assertion = (IAssertion) iter.next();
+ for (Iterator<IAssertion> iter = assertions.iterator(); iter.hasNext();) {
+ IAssertion assertion = iter.next();
assertion.check();
}
}
@@ -94,6 +92,7 @@
this.key = key;
}
+ @Override
public void check() throws Exception {
final MixinModel model = new MixinModel(RubyLanguageToolkit
.getDefault());
@@ -126,10 +125,10 @@
public MixinTestsSuite(String testsDirectory) {
super(testsDirectory);
- Enumeration entryPaths = Activator.getDefault().getBundle()
+ Enumeration<String> entryPaths = Activator.getDefault().getBundle()
.getEntryPaths(testsDirectory);
while (entryPaths.hasMoreElements()) {
- final String path = (String) entryPaths.nextElement();
+ final String path = entryPaths.nextElement();
URL entry = Activator.getDefault().getBundle().getEntry(path);
try {
entry.openStream().close();
@@ -151,12 +150,14 @@
super(Activator.PLUGIN_ID, Util.EMPTY_STRING);
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProject(SRC_PROJECT);
waitUntilIndexesReady();
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(SRC_PROJECT);
super.tearDownSuite();
@@ -164,9 +165,7 @@
}
- /*
- * @see junit.framework.TestSuite#run(junit.framework.TestResult)
- */
+ @Override
public void run(TestResult result) {
final SuiteSetupTeardown setupTeardown = new SuiteSetupTeardown();
try {
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/RubyMixinClassTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/RubyMixinClassTests.java
index 261ebe4..4a4be02 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/RubyMixinClassTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/RubyMixinClassTests.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2016 xored software, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * xored software, Inc. - initial API and implementation
+ *******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.search.mixin;
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
@@ -17,12 +27,14 @@
private static final String PROJECT_NAME = "mixin-includes";
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProject(PROJECT_NAME);
waitUntilIndexesReady();
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(PROJECT_NAME);
super.tearDownSuite();
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/ThreadedMixinTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/ThreadedMixinTests.java
index 488d353..0301a9a 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/ThreadedMixinTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/search/mixin/ThreadedMixinTests.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.search.mixin;
@@ -29,6 +28,7 @@
return new Suite(ThreadedMixinTests.class);
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
up();
@@ -43,6 +43,7 @@
// waitForAutoBuild();
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(PROJECT_NAME);
super.tearDownSuite();
@@ -84,6 +85,7 @@
this.keys = keys;
}
+ @Override
public void run() {
for (int i = 0; i < this.cycles; i++) {
for (int j = 0; j < this.stop - this.start; j++) {
@@ -94,12 +96,12 @@
this.finish = true;
System.out.println("Finished");
}
- };
+ }
public void testMultiAccess() throws Exception {
int count = 10;
final RubyMixinModel mixinModel = RubyMixinModel.getWorkspaceInstance();
- String[] findKeys = mixinModel.getRawModel().findKeys("*");
+ String[] findKeys = mixinModel.getRawModel().findKeys("*", new NullProgressMonitor());
Thread[] threads = new Thread[count];
Access[] access = new Access[count];
int d = findKeys.length / count;
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/text/completion/RubyCompletionTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/text/completion/RubyCompletionTests.java
index db7c173..a0a2188 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/text/completion/RubyCompletionTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/text/completion/RubyCompletionTests.java
@@ -1,18 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.text.completion;
import java.util.Vector;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -22,6 +19,8 @@
import org.eclipse.dltk.core.tests.model.CompletionTestsRequestor;
import org.eclipse.dltk.ruby.core.tests.Activator;
+import junit.framework.Test;
+
public class RubyCompletionTests extends AbstractModelCompletionTests {
// private static final int RELEVANCE = (RelevanceConstants.R_DEFAULT
@@ -32,6 +31,7 @@
super(Activator.PLUGIN_ID, name);
}
+ @Override
public void setUpSuite() throws Exception {
// We need to initialie at least one interpreter.
@@ -45,6 +45,7 @@
super.setUpSuite();
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject("completion");
super.tearDownSuite();
@@ -769,7 +770,7 @@
cu.codeComplete(cursorLocation, requestor);
String completionResults = requestor.getResults();
- Vector methods = new Vector();
+ Vector<String> methods = new Vector<String>();
int lastElementsOccurance = 0;
while ((lastElementsOccurance = completionResults.indexOf("element:",
lastElementsOccurance)) > -1) {
@@ -780,7 +781,7 @@
lastElementsOccurance));
}
- Vector relevances = new Vector();
+ Vector<String> relevances = new Vector<String>();
int lastRelevanceOccurance = 0;
while (lastRelevanceOccurance > -1) {
lastRelevanceOccurance = completionResults.indexOf("relevance:",
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typehierarchy/TypeHierarchyTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typehierarchy/TypeHierarchyTests.java
index 695c436..d76c993 100755
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typehierarchy/TypeHierarchyTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typehierarchy/TypeHierarchyTests.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.typehierarchy;
@@ -28,6 +27,7 @@
return new Suite(TypeHierarchyTests.class);
}
+ @Override
public void setUpSuite() throws Exception {
deleteProject(PROJECT);
SCRIPT_PROJECT.close();
@@ -36,6 +36,7 @@
super.setUpSuite();
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(PROJECT);
super.tearDownSuite();
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/AbstractTypeInferencingTests.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/AbstractTypeInferencingTests.java
index 24a5d0c..1793950 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/AbstractTypeInferencingTests.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/AbstractTypeInferencingTests.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.typeinference;
@@ -15,8 +14,6 @@
import java.io.InputStreamReader;
import java.util.Hashtable;
-import junit.framework.ComparisonFailure;
-
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
@@ -27,6 +24,8 @@
import org.eclipse.dltk.core.tests.model.CompletionTestsRequestor2;
import org.eclipse.dltk.ruby.core.tests.Activator;
+import junit.framework.ComparisonFailure;
+
public abstract class AbstractTypeInferencingTests extends AbstractModelTests {
protected static IScriptProject PROJECT;
@@ -37,13 +36,15 @@
public int tokenStart;
public int tokenEnd;
}
- Hashtable oldOptions;
+
+ Hashtable<String, String> oldOptions;
ISourceModule wc = null;
public AbstractTypeInferencingTests(String projectName, String name) {
super(projectName, name);
}
+ @Override
public ISourceModule getWorkingCopy(String path, String source) throws ModelException {
return super.getWorkingCopy(path, source, this.wcOwner, null);
}
@@ -118,24 +119,28 @@
return result;
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
this.oldOptions = DLTKCore.getOptions();
// waitUntilIndexesReady();
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
this.wcOwner = new WorkingCopyOwner() {
};
}
+ @Override
public void tearDownSuite() throws Exception {
DLTKCore.setOptions(this.oldOptions);
this.oldOptions = null;
super.tearDownSuite();
}
+ @Override
protected void tearDown() throws Exception {
if (this.wc != null) {
this.wc.discardWorkingCopy();
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/TypeInferenceSuite.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/TypeInferenceSuite.java
index 9d363c1..6801abe 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/TypeInferenceSuite.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/TypeInferenceSuite.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.typeinference;
@@ -21,11 +20,6 @@
import java.util.Set;
import java.util.StringTokenizer;
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.ASTVisitor;
@@ -46,8 +40,14 @@
import org.eclipse.dltk.ti.types.RecursionTypeCall;
import org.osgi.framework.Bundle;
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
public class TypeInferenceSuite extends TestSuite {
+ @Override
public void run(TestResult result) {
TypeInferenceTest tests = new TypeInferenceTest("ruby selection tests");
try {
@@ -67,12 +67,12 @@
}
}
- public TypeInferenceSuite(Class clazz, String testsDirectory) {
+ public TypeInferenceSuite(Class<?> clazz, String testsDirectory) {
super(clazz.getName());
final Bundle bundle = Activator.getDefault().getBundle();
- Enumeration entryPaths = bundle.getEntryPaths(testsDirectory);
+ Enumeration<String> entryPaths = bundle.getEntryPaths(testsDirectory);
while (entryPaths.hasMoreElements()) {
- final String path = (String) entryPaths.nextElement();
+ final String path = entryPaths.nextElement();
URL entry = bundle.getEntry(path);
try {
entry.openStream().close();
@@ -86,11 +86,13 @@
final String folder = (pos >= 0 ? x.substring(pos + 1) : x);
addTest(new TestCase(name) {
- private Collection assertions = new ArrayList();
+ private Collection<IAssertion> assertions = new ArrayList<IAssertion>();
+ @Override
public void setUp() {
}
+ @Override
protected void runTest() throws Throwable {
String content = loadContent(path);
String[] lines = content.split("\n");
@@ -156,6 +158,7 @@
this.correctClassRef = correctClassRef;
}
+ @Override
public void check(ModuleDeclaration rootNode,
ISourceModule cu, ITypeInferencer inferencer)
throws Exception {
@@ -163,6 +166,7 @@
ASTVisitor visitor = new OffsetTargetedASTVisitor(
namePos) {
+ @Override
protected boolean visitGeneralInteresting(ASTNode s) {
if (s instanceof VariableReference)
if (s.sourceStart() == namePos
@@ -201,6 +205,7 @@
this.correctClassRef = correctClassRef;
}
+ @Override
public void check(ModuleDeclaration rootNode,
ISourceModule cu, ITypeInferencer inferencer)
throws Exception {
@@ -208,8 +213,9 @@
ASTVisitor visitor = new OffsetTargetedASTVisitor(
namePos) {
+ @Override
protected boolean visitGeneralInteresting(ASTNode s) {
- if (s instanceof ASTNode && result[0] == null)
+ if (s != null && result[0] == null)
if (s.sourceStart() == namePos) {
result[0] = s;
}
@@ -240,7 +246,7 @@
.getModelKey());
} else if (type instanceof AmbiguousType) {
AmbiguousType ambiType = (AmbiguousType) type;
- Set modelKeySet = new HashSet();
+ Set<String> modelKeySet = new HashSet<String>();
IEvaluatedType[] possibleTypes = ambiType
.getPossibleTypes();
for (int cnt = 0, max = possibleTypes.length; cnt < max; cnt++) {
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/TypeInferenceTest.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/TypeInferenceTest.java
index 58ec554..1b6cb36 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/TypeInferenceTest.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/TypeInferenceTest.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.typeinference;
@@ -28,6 +27,7 @@
super("org.eclipse.dltk.ruby.core.tests", name);
}
+ @Override
public void setUpSuite() throws Exception {
PROJECT = setUpScriptProject(SRC_PROJECT);
super.setUpSuite();
@@ -36,16 +36,18 @@
waitForAutoBuild();
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(SRC_PROJECT);
super.tearDownSuite();
}
- public void executeTest(String folder, String name, ITypeInferencer inferencer, Collection assertions) throws Exception {
+ public void executeTest(String folder, String name, ITypeInferencer inferencer, Collection<IAssertion> assertions)
+ throws Exception {
ISourceModule cu = getSourceModule(SRC_PROJECT, folder, name);
ModuleDeclaration rootNode = RubyTypeInferencingUtils.parseSource(cu);
- for (Iterator iter = assertions.iterator(); iter.hasNext();) {
- IAssertion assertion = (IAssertion) iter.next();
+ for (Iterator<IAssertion> iter = assertions.iterator(); iter.hasNext();) {
+ IAssertion assertion = iter.next();
assertion.check(rootNode, cu, inferencer);
}
}
diff --git a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/utils/LocalVariablesInspectionTest.java b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/utils/LocalVariablesInspectionTest.java
index 6ae9141..1fb1fe9 100644
--- a/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/utils/LocalVariablesInspectionTest.java
+++ b/tests/org.eclipse.dltk.ruby.core.tests/src/org/eclipse/dltk/ruby/core/tests/typeinference/utils/LocalVariablesInspectionTest.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.core.tests.typeinference.utils;
@@ -29,6 +28,7 @@
super("org.eclipse.dltk.ruby.core.tests", name);
}
+ @Override
public void setUpSuite() throws Exception {
PROJECT = setUpScriptProject(SRC_PROJECT);
super.setUpSuite();
@@ -37,6 +37,7 @@
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(SRC_PROJECT);
super.tearDownSuite();