Fix warnings due to deprecate API and unused suppress warnings
annotations
Change-Id: I19a9d2ce5c55eb568de6066a8ddbf98a55ddb31e
Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
index 5816ad8..c6cdf92 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -138,7 +138,6 @@
ASTVisitor visitor;
- @SuppressWarnings("synthetic-access")
protected void runConformTest() {
runTest(this.shouldFlushOutputDirectory,
this.testFiles,
@@ -164,7 +163,6 @@
this.skipJavac ? JavacTestOptions.SKIP : this.javacTestOptions);
}
- @SuppressWarnings("synthetic-access")
protected void runNegativeTest() {
runTest(this.shouldFlushOutputDirectory,
this.testFiles,
@@ -190,7 +188,6 @@
this.skipJavac ? JavacTestOptions.SKIP : this.javacTestOptions);
}
- @SuppressWarnings("synthetic-access")
protected void runWarningTest() {
runTest(this.shouldFlushOutputDirectory,
this.testFiles,
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalStaticsTest_15.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalStaticsTest_15.java
index 848fb0e..0f87445 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalStaticsTest_15.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalStaticsTest_15.java
@@ -92,7 +92,6 @@
runner.runWarningTest();
}
- @SuppressWarnings("unused")
private static void verifyClassFile(String expectedOutput, String classFileName, int mode)
throws IOException, ClassFormatException {
File f = new File(OUTPUT_DIR + File.separator + classFileName);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java
index 102ee6d..0f29287 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java
@@ -148,7 +148,7 @@
Object createCodeSnippet(Class snippetClass) {
Object object = null;
try {
- object = snippetClass.newInstance();
+ object = snippetClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
this.ide.sendResult(void.class, null);
@@ -157,6 +157,22 @@
e.printStackTrace();
this.ide.sendResult(void.class, null);
return null;
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ this.ide.sendResult(void.class, null);
+ return null;
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ this.ide.sendResult(void.class, null);
+ return null;
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ this.ide.sendResult(void.class, null);
+ return null;
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ this.ide.sendResult(void.class, null);
+ return null;
}
return object;
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
index 5da30c5..2a3ac76 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
@@ -209,7 +209,7 @@
TestSuite complianceSuite = null;
try {
Constructor constructor = setupClass.getConstructor(new Class[]{long.class});
- complianceSuite = (TestSuite)constructor.newInstance(new Object[]{new Long(complianceLevel)});
+ complianceSuite = (TestSuite)constructor.newInstance(new Object[]{Long.valueOf(complianceLevel)});
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatterApplication.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatterApplication.java
index 7f24beb..eb8cd3a 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatterApplication.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatterApplication.java
@@ -53,7 +53,7 @@
* @noinstantiate This class is not intended to be instantiated by clients.
* @noextend This class is not intended to be subclassed by clients.
*/
-@SuppressWarnings({"rawtypes", "unchecked"})
+@SuppressWarnings({"rawtypes"})
public class CodeFormatterApplication implements IApplication {
/**