diff options
author | Alexander Kurtakov | 2016-08-29 19:24:26 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2016-08-29 19:24:26 +0000 |
commit | 5d0064517d8ea60065e285b682f1706b360182b4 (patch) | |
tree | a85aa3fd560ffdae329893e4de3655ea1bbe5526 | |
parent | 4f3dfc8f708574691c6a526fa3fffe8a02d9a811 (diff) | |
download | org.eclipse.dltk.javascript-5d0064517d8ea60065e285b682f1706b360182b4.tar.gz org.eclipse.dltk.javascript-5d0064517d8ea60065e285b682f1706b360182b4.tar.xz org.eclipse.dltk.javascript-5d0064517d8ea60065e285b682f1706b360182b4.zip |
cleanup: o.e.dltk.javascript.formatter.testsR5_6_0
* Deprecations
* Bump BREE to Java 1.8
* Missing @Override by either adding it or converting to lambda.
Change-Id: Ie80f718c8fefd6cb21435fff14bc6b643ab2338c
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
9 files changed, 45 insertions, 60 deletions
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/.classpath b/tests/org.eclipse.dltk.javascript.formatter.tests/.classpath index ad32c83a..eca7bdba 100644 --- a/tests/org.eclipse.dltk.javascript.formatter.tests/.classpath +++ b/tests/org.eclipse.dltk.javascript.formatter.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/JavaSE-1.6"/> + <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.javascript.formatter.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.dltk.javascript.formatter.tests/.settings/org.eclipse.jdt.core.prefs index 8717e6c0..5356a088 100644 --- a/tests/org.eclipse.dltk.javascript.formatter.tests/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.eclipse.dltk.javascript.formatter.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,14 +1,14 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.8 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.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.dltk.javascript.formatter.tests/META-INF/MANIFEST.MF index 792b39c8..c492670b 100644 --- a/tests/org.eclipse.dltk.javascript.formatter.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.dltk.javascript.formatter.tests/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: JavaScript Tests Plug-in Bundle-Vendor: Eclipse DLTK Bundle-SymbolicName: org.eclipse.dltk.javascript.formatter.tests;singleton:=true Bundle-Version: 5.6.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.eclipse.dltk.core;bundle-version="0.0.0", org.eclipse.dltk.formatter.tests, org.eclipse.dltk.ui, diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptFormatterTestsPlugin.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptFormatterTestsPlugin.java index caa615f6..17f48db5 100644 --- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptFormatterTestsPlugin.java +++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptFormatterTestsPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 xored software, Inc. + * Copyright (c) 2009, 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 @@ -85,21 +85,23 @@ public class JavaScriptFormatterTestsPlugin extends Plugin { public static final IScriptedTestContext CONTEXT = new IScriptedTestContext() { + @Override public Bundle getResourceBundle() { return getDefault().getBundle(); } + @Override public String getCharset() { return "ISO-8859-1"; //$NON-NLS-1$ } + @Override public IScriptFormatter createFormatter(Map<String, Object> preferences) { final Map<String, Object> prefs = JavaScriptFormatterConstants .getDefaults(); - prefs - .put( - JavaScriptFormatterConstants.INSERT_SPACE_BEFORE_LP_FUNCTION_ARGUMENTS, - true); + prefs.put( + JavaScriptFormatterConstants.INSERT_SPACE_BEFORE_LP_FUNCTION_ARGUMENTS, + true); prefs.put(JavaScriptFormatterConstants.INDENT_SWITCH, true); if (preferences != null) { prefs.putAll(preferences); @@ -107,6 +109,7 @@ public class JavaScriptFormatterTestsPlugin extends Plugin { return new TestJavaScriptFormatter(Util.LINE_SEPARATOR, prefs); } + @Override public String validateOptionName(String name) { if (JavaScriptFormatterConstants.isDefined(name)) return name; @@ -114,6 +117,7 @@ public class JavaScriptFormatterTestsPlugin extends Plugin { return null; } + @Override public String validateOptionValue(String name, String value) { if (!JavaScriptFormatterConstants.isDefined(name)) return null; diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptLibTest.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptLibTest.java index b1b01acc..f188dfa2 100644 --- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptLibTest.java +++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptLibTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 xored software, Inc. + * Copyright (c) 2009, 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 @@ -21,7 +21,6 @@ import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import junit.framework.Assert; import junit.framework.AssertionFailedError; import junit.framework.TestCase; import junit.framework.TestSuite; @@ -38,6 +37,7 @@ import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.eclipse.text.edits.TextEdit; +import org.junit.Assert; public class JavaScriptLibTest extends AbstractFormatterTest { @@ -56,6 +56,7 @@ public class JavaScriptLibTest extends AbstractFormatterTest { .getName()); suite.addTest(new TestCase("testJavaScriptLib-NOT-FOUND") { + @Override protected void runTest() throws Throwable { System.out.println(FILENAME + " not found"); } @@ -65,9 +66,10 @@ public class JavaScriptLibTest extends AbstractFormatterTest { } } - protected IScriptFormatter createFormatter(Map preferences) { - return preferences != null ? new TestJavaScriptFormatter( - Util.LINE_SEPARATOR, preferences) + @Override + protected IScriptFormatter createFormatter(Map<String, Object> preferences) { + return preferences != null + ? new TestJavaScriptFormatter(Util.LINE_SEPARATOR, preferences) : new TestJavaScriptFormatter(); } @@ -87,14 +89,14 @@ public class JavaScriptLibTest extends AbstractFormatterTest { if (!path.isFile()) { fail(path + " is not found"); //$NON-NLS-1$ } - final ZipInputStream zipInputStream = new ZipInputStream( - new FileInputStream(path)); - try { + try (final ZipInputStream zipInputStream = new ZipInputStream( + new FileInputStream(path))) { ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { if (!entry.isDirectory() && isJavaScriptFile(entry.getName())) { final InputStream entryStream = new FilterInputStream( zipInputStream) { + @Override public void close() throws IOException { // empty } @@ -134,12 +136,6 @@ public class JavaScriptLibTest extends AbstractFormatterTest { zipInputStream.closeEntry(); } } - } finally { - try { - zipInputStream.close(); - } catch (IOException e) { - // - } } if (errorCount > 0) { final String msg = "Syntax errors: " + errorCount; diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRParserTester.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRParserTester.java index cd3efdda..2a8bca1d 100644 --- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRParserTester.java +++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRParserTester.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 xored software, Inc. + * Copyright (c) 2009, 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 @@ -16,8 +16,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.List; -import junit.framework.Assert; - import org.antlr.runtime.RecognitionException; import org.antlr.runtime.Token; import org.eclipse.dltk.compiler.env.ModuleSource; @@ -29,6 +27,7 @@ import org.eclipse.dltk.javascript.parser.JSTokenStream; import org.eclipse.dltk.javascript.parser.JSTransformer; import org.eclipse.dltk.javascript.parser.JavaScriptParser; import org.eclipse.dltk.javascript.parser.tests.ASTVerifier; +import org.junit.Assert; @SuppressWarnings("nls") public class ANTLRParserTester { diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRTokenStreamComparer.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRTokenStreamComparer.java index 018ba2b4..80d15912 100644 --- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRTokenStreamComparer.java +++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRTokenStreamComparer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 xored software, Inc. + * Copyright (c) 2009, 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 @@ -14,12 +14,11 @@ package org.eclipse.dltk.javascript.internal.parser.tests; import java.util.ArrayList; import java.util.List; -import junit.framework.Assert; - import org.antlr.runtime.Token; import org.eclipse.dltk.javascript.parser.JSParser; import org.eclipse.dltk.javascript.parser.JSTokenStream; import org.eclipse.dltk.javascript.parser.JavaScriptParser; +import org.junit.Assert; public class ANTLRTokenStreamComparer { @@ -72,14 +71,14 @@ public class ANTLRTokenStreamComparer { for (int i = 0; i < Math.max(sourceComments.size(), targetComments.size()); i++) { - System.out - .println("=============================================================="); - System.out.println(i < sourceComments.size() ? sourceComments - .get(i) : "!!! MISSED !!!"); - System.out - .println("--------------------------------------------------------------"); - System.out.println(i < targetComments.size() ? targetComments - .get(i) : "!!! MISSED !!!"); + System.out.println( + "=============================================================="); + System.out.println(i < sourceComments.size() ? sourceComments.get(i) + : "!!! MISSED !!!"); + System.out.println( + "--------------------------------------------------------------"); + System.out.println(i < targetComments.size() ? targetComments.get(i) + : "!!! MISSED !!!"); } System.out diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptParserTester.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptParserTester.java index 6ddb17bb..f9aa49af 100644 --- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptParserTester.java +++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptParserTester.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 xored software, Inc. + * Copyright (c) 2009, 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 @@ -12,14 +12,13 @@ package org.eclipse.dltk.javascript.internal.parser.tests; -import junit.framework.Assert; - import org.eclipse.dltk.javascript.formatter.JavaScriptFormatter; import org.eclipse.dltk.javascript.formatter.JavaScriptFormatterConstants; import org.eclipse.dltk.javascript.formatter.tests.JavaScriptFormatterTestsPlugin; import org.eclipse.dltk.ui.formatter.IScriptFormatter; import org.eclipse.jface.text.Document; import org.eclipse.text.edits.TextEdit; +import org.junit.Assert; public class JavaScriptParserTester extends AbstractTester { @@ -58,8 +57,8 @@ public class JavaScriptParserTester extends AbstractTester { public static void parse(String resourceName, String charset) throws Exception { - new JavaScriptParserTester().parseScript(getScriptContent(resourceName, - charset)); + new JavaScriptParserTester() + .parseScript(getScriptContent(resourceName, charset)); } public static void parseSource(String source) throws Exception { diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptTokenStreamTester.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptTokenStreamTester.java index 60990dd5..98627e3f 100644 --- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptTokenStreamTester.java +++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptTokenStreamTester.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 xored software, Inc. + * Copyright (c) 2009, 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 @@ -14,16 +14,14 @@ package org.eclipse.dltk.javascript.internal.parser.tests; import java.io.IOException; import java.util.List; -import junit.framework.Assert; - import org.antlr.runtime.Token; import org.eclipse.dltk.compiler.env.ModuleSource; -import org.eclipse.dltk.compiler.problem.IProblem; import org.eclipse.dltk.compiler.problem.IProblemReporter; import org.eclipse.dltk.javascript.ast.Script; import org.eclipse.dltk.javascript.formatter.tests.JavaScriptFormatterTestsPlugin; import org.eclipse.dltk.javascript.parser.JSTokenStream; import org.eclipse.dltk.javascript.parser.JavaScriptParser; +import org.junit.Assert; public class JavaScriptTokenStreamTester extends AbstractTester { @@ -60,19 +58,9 @@ public class JavaScriptTokenStreamTester extends AbstractTester { JavaScriptParser parser = new JavaScriptParser(); Script root = parser.parse(new ModuleSource(source), - new IProblemReporter() { - - public void reportProblem(IProblem problem) { - System.out.println("Parser " - + (problem.isError() ? "error" : "warning") - + ": " + problem.getMessage()); - } - - public Object getAdapter( - @SuppressWarnings("rawtypes") Class adapter) { - return null; - } - }); + (IProblemReporter) problem -> System.out.println("Parser " + + (problem.isError() ? "error" : "warning") + + ": " + problem.getMessage())); Assert.assertNotNull(root); |