o.e.dltk.ruby.ui.tests: Move to Java 8.
Enable warnings, save actions and fix them.
Change-Id: Iec92dab934ea064942d9d7eb5ccd1be9ba5c1df2
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/.classpath b/tests/org.eclipse.dltk.ruby.ui.tests/.classpath
index 64c5e31..eca7bdb 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/.classpath
+++ b/tests/org.eclipse.dltk.ruby.ui.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.8"/>
<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.ui.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.core.prefs
index 9f90e7a..51a642f 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,8 @@
-#Fri Aug 14 21:20:12 NOVST 2009
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..43df84b
--- /dev/null
+++ b/tests/org.eclipse.dltk.ruby.ui.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=true
+sp_cleanup.remove_trailing_whitespaces=true
+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=true
+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.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.dltk.ruby.ui.tests/META-INF/MANIFEST.MF
index f16e363..800dd41 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/META-INF/MANIFEST.MF
@@ -17,7 +17,7 @@
org.eclipse.dltk.ruby.core,
org.eclipse.dltk.launching
Bundle-Activator: org.eclipse.dltk.ruby.ui.tests.internal.RubyUITestsPlugin
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-Vendor: %pluginProvider
Export-Package: org.eclipse.dltk.ruby.ui.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyCommentElementTests.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyCommentElementTests.java
index fb9434d..50bf198 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyCommentElementTests.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyCommentElementTests.java
@@ -20,11 +20,13 @@
super(RubyUITestsPlugin.PLUGIN_ID, name);
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProject(PROJECT_NAME);
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(PROJECT_NAME);
super.tearDownSuite();
@@ -50,10 +52,10 @@
}
/**
- *
+ *
* Gets a string pattern, searches for the comment that contains this
* pattern and returns IModelElement to which the comment corresponds
- *
+ *
*/
protected String getElementByComment(ISourceModule module,
String commentPattern) throws ModelException {
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyFoldingTest.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyFoldingTest.java
index 8288130..c35130e 100755
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyFoldingTest.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyFoldingTest.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.ui.tests.folding;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ruby.internal.ui.RubyPreferenceConstants;
import org.eclipse.dltk.ruby.internal.ui.text.folding.RubyFoldingStructureProvider;
@@ -22,8 +19,12 @@
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
+import junit.framework.TestCase;
+
public class RubyFoldingTest extends TestCase {
private class MyRubyASTFoldingStructureProvider extends
@@ -31,12 +32,14 @@
public boolean codeFolding = true;
public boolean commentFolding = true;
+ @Override
protected FoldingStructureComputationContext createInitialContext() {
initializePreferences(fStore);
fCommentsFolding = commentFolding;
return createContext(true);
}
+ @Override
protected FoldingStructureComputationContext createContext(
boolean allowCollapse) {
ProjectionAnnotationModel model = new ProjectionAnnotationModel();
@@ -59,12 +62,13 @@
return fDocument;
}
- public Map testComputeFoldingStructure(String contents,
+ public Map<Annotation, Position> testComputeFoldingStructure(String contents,
FoldingStructureComputationContext ctx) {
super.computeFoldingStructure(contents, ctx);
return ctx.getMap();
}
+ @Override
protected boolean mayCollapse(ASTNode s,
FoldingStructureComputationContext ctx) {
return codeFolding && super.mayCollapse(s, ctx);
@@ -75,6 +79,7 @@
IPreferenceStore fStore;
MyRubyASTFoldingStructureProvider provider;
+ @Override
protected void setUp() throws Exception {
super.setUp();
fStore = RubyUITestsPlugin.getDefault().getPreferenceStore();
@@ -88,7 +93,8 @@
Document document = new Document(content);
TestUtils.installStuff(document);
provider.setDocument(document);
- Map result = provider.testComputeFoldingStructure(content, provider
+ Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
+ provider
.createInitialContext());
assertEquals(1, result.size());
}
@@ -99,7 +105,8 @@
Document document = new Document(content);
TestUtils.installStuff(document);
provider.setDocument(document);
- Map result = provider.testComputeFoldingStructure(content, provider
+ Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
+ provider
.createInitialContext());
assertEquals(3 + 3, result.size());
}
@@ -110,7 +117,8 @@
Document document = new Document(content);
TestUtils.installStuff(document);
provider.setDocument(document);
- Map result = provider.testComputeFoldingStructure(content, provider
+ Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
+ provider
.createInitialContext());
assertEquals(2 + 3, result.size());
}
@@ -122,7 +130,8 @@
TestUtils.installStuff(document);
provider.codeFolding = false;
provider.setDocument(document);
- Map result = provider.testComputeFoldingStructure(content, provider
+ Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
+ provider
.createInitialContext());
assertEquals(27, result.size());
}
@@ -134,7 +143,8 @@
TestUtils.installStuff(document);
provider.commentFolding = false;
provider.setDocument(document);
- Map result = provider.testComputeFoldingStructure(content, provider
+ Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
+ provider
.createInitialContext());
assertEquals(73 + 13 + 1, result.size());
}
@@ -145,7 +155,8 @@
Document document = new Document(content);
TestUtils.installStuff(document);
provider.setDocument(document);
- Map result = provider.testComputeFoldingStructure(content, provider
+ Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
+ provider
.createInitialContext());
assertEquals(100 + 13 + 1, result.size());
}
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/RubyUITestsPlugin.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/RubyUITestsPlugin.java
index 8df961f..84e137a 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/RubyUITestsPlugin.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/RubyUITestsPlugin.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.ui.tests.internal;
@@ -36,18 +35,12 @@
plugin = this;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#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.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/TestUtils.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/TestUtils.java
index 5df9146..e933745 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/TestUtils.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/TestUtils.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.ui.tests.internal;
@@ -13,6 +12,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ruby.internal.ui.text.IRubyPartitions;
@@ -32,7 +32,7 @@
byte[] data = new byte[length];
stream.read(data);
stream.close();
- return new String(data, "utf-8");
+ return new String(data, StandardCharsets.UTF_8);
}
/**
@@ -53,6 +53,7 @@
public static final IRangeFilter ALL_RANGES_ALLOWED = new IRangeFilter() {
+ @Override
public boolean allowRange(IDocument document, int start, int length) throws BadLocationException {
return true;
}
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/MixinCompleteTests.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/MixinCompleteTests.java
index 4305d21..9e64496 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/MixinCompleteTests.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/MixinCompleteTests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * 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.ui.tests.search;
@@ -28,6 +28,7 @@
return new Suite(MixinCompleteTests.class);
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
up();
@@ -42,6 +43,7 @@
// waitForAutoBuild();
}
+ @Override
public void tearDownSuite() throws Exception {
deleteProject(PROJECT_NAME);
super.tearDownSuite();
@@ -68,6 +70,6 @@
public void testMultiAccess() throws Exception {
-
+
}
}
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/ThreadedUIMixinTests.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/ThreadedUIMixinTests.java
index 35d770d..90ae8dc 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/ThreadedUIMixinTests.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/ThreadedUIMixinTests.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.ui.tests.search;
@@ -29,6 +28,7 @@
return new Suite(ThreadedUIMixinTests.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,7 +96,7 @@
this.finish = true;
System.out.println("Finished");
}
- };
+ }
class AccessUI extends Access {
@@ -104,6 +106,7 @@
// TODO Auto-generated constructor stub
}
+ @Override
public void run() {
// TODO Auto-generated method stub
// this.notifyAll();
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/RubyRequireHyperlinkDetectorTest.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/RubyRequireHyperlinkDetectorTest.java
index eb7696b..0bcefc5 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/RubyRequireHyperlinkDetectorTest.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/RubyRequireHyperlinkDetectorTest.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
@@ -11,13 +11,13 @@
*******************************************************************************/
package org.eclipse.dltk.ruby.ui.tests.text;
-import junit.framework.TestCase;
-
import org.eclipse.dltk.ruby.internal.ui.text.hyperlink.RubyRequireHyperlinkDetector;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
+import junit.framework.TestCase;
+
public class RubyRequireHyperlinkDetectorTest extends TestCase {
public RubyRequireHyperlinkDetectorTest(String name) {
@@ -26,7 +26,7 @@
/**
* @author Alexey
- *
+ *
*/
private final class TestDetector extends RubyRequireHyperlinkDetector {
@@ -34,6 +34,7 @@
return checkLine(0, line);
}
+ @Override
protected IHyperlink createLink(int offset, String line, int begin,
int end) {
final String requiredFile = line.substring(begin, end);
@@ -52,18 +53,22 @@
this.region = region;
}
+ @Override
public IRegion getHyperlinkRegion() {
return region;
}
+ @Override
public String getHyperlinkText() {
return path;
}
+ @Override
public String getTypeLabel() {
return null;
}
+ @Override
public void open() {
// empty
}