diff options
14 files changed, 246 insertions, 83 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java index 3e3ee9115f..875c58e72b 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java @@ -10575,4 +10575,37 @@ public void testBug376429b() { "Return type for the method is missing\n" + "----------\n"); } + +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=371832 +//Unused imports should be reported even if other errors are suppressed. +public void testBug371832() throws Exception { + Map customOptions = getCompilerOptions(); + customOptions.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR); + customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.ERROR); + customOptions.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED); + customOptions.put(CompilerOptions.OPTION_ReportMissingSerialVersion, CompilerOptions.ERROR); + String testFiles [] = new String[] { + "A.java", + "import java.util.List;\n"+ + "@SuppressWarnings(\"serial\")\n" + + "public class A implements java.io.Serializable {\n" + + " void foo() { \n" + + " }\n"+ + "}\n" + }; + String expectedErrorString = + "----------\n" + + "1. ERROR in A.java (at line 1)\n" + + " import java.util.List;\n" + + " ^^^^^^^^^^^^^^\n" + + "The import java.util.List is never used\n" + + "----------\n"; + runNegativeTest( + true, + testFiles, + null, + customOptions, + expectedErrorString, + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); +} } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java index 75f02e81c6..899041f4a3 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -4916,13 +4916,23 @@ public void testBug103304b() { "Javadoc: Invalid member type qualification\n" + "----------\n" + "----------\n" + - "1. ERROR in boden\\TestInvalid3.java (at line 5)\n" + + "1. ERROR in boden\\TestInvalid3.java (at line 2)\n"+ + " import boden.IAFAState.ValidationException;\n"+ + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "The import boden.IAFAState.ValidationException is never used\n"+ + "----------\n"+ + "2. ERROR in boden\\TestInvalid3.java (at line 5)\n" + " * @see IAFAState.ValidationException#IAFA.State.ValidationException(String, IAFAState)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: Invalid member type qualification\n" + "----------\n" + "----------\n" + - "1. ERROR in boden\\TestInvalid4.java (at line 5)\n" + + "1. ERROR in boden\\TestInvalid4.java (at line 2)\n"+ + " import boden.IAFAState.ValidationException;\n"+ + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "The import boden.IAFAState.ValidationException is never used\n"+ + "----------\n"+ + "2. ERROR in boden\\TestInvalid4.java (at line 5)\n" + " * @see IAFAState.ValidationException#IAFAState .ValidationException(String, IAFAState)\n" + " ^^^^^^^^^\n" + "Javadoc: IAFAState cannot be resolved or is not a field\n" + @@ -4934,13 +4944,23 @@ public void testBug103304b() { //boden\TestInvalid3.java:6: warning - Tag @see: can't find IAFA.State.ValidationException(String, IAFAState) in boden.IAFAState.ValidationException //boden\TestInvalid4.java:6: warning - Tag @see: can't find IAFAState in boden.IAFAState.ValidationException "----------\n" + - "1. ERROR in boden\\TestInvalid3.java (at line 5)\n" + + "1. ERROR in boden\\TestInvalid3.java (at line 2)\n"+ + " import boden.IAFAState.ValidationException;\n"+ + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "The import boden.IAFAState.ValidationException is never used\n"+ + "----------\n"+ + "2. ERROR in boden\\TestInvalid3.java (at line 5)\n" + " * @see IAFAState.ValidationException#IAFA.State.ValidationException(String, IAFAState)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: Invalid member type qualification\n" + "----------\n" + "----------\n" + - "1. ERROR in boden\\TestInvalid4.java (at line 5)\n" + + "1. ERROR in boden\\TestInvalid4.java (at line 2)\n"+ + " import boden.IAFAState.ValidationException;\n"+ + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "The import boden.IAFAState.ValidationException is never used\n"+ + "----------\n"+ + "2. ERROR in boden\\TestInvalid4.java (at line 5)\n" + " * @see IAFAState.ValidationException#IAFAState .ValidationException(String, IAFAState)\n" + " ^^^^^^^^^\n" + "Javadoc: IAFAState cannot be resolved or is not a field\n" + @@ -6966,7 +6986,12 @@ public void testBug176027h_public() { "Javadoc: Invalid member type qualification\n" + "----------\n" + "----------\n" + - "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + + "1. ERROR in pkg3\\Invalid3.java (at line 2)\n" + + " import mainpkg.Outer.*;\n"+ + " ^^^^^^^^^^^^^\n"+ + "The import mainpkg.Outer is never used\n" + + "----------\n" + + "2. ERROR in pkg3\\Invalid3.java (at line 6)\n" + " * {@link MostInner} -- error/warning \n" + " ^^^^^^^^^\n" + "Javadoc: MostInner cannot be resolved to a type\n" + @@ -6975,7 +7000,12 @@ public void testBug176027h_public() { String error50 = new String ( //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner "----------\n" + - "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + + "1. ERROR in pkg3\\Invalid3.java (at line 2)\n" + + " import mainpkg.Outer.*;\n"+ + " ^^^^^^^^^^^^^\n"+ + "The import mainpkg.Outer is never used\n" + + "----------\n" + + "2. ERROR in pkg3\\Invalid3.java (at line 6)\n" + " * {@link MostInner} -- error/warning \n" + " ^^^^^^^^^\n" + "Javadoc: MostInner cannot be resolved to a type\n" + @@ -7070,7 +7100,12 @@ public void testBug176027h_private() { "Javadoc: Invalid member type qualification\n" + "----------\n" + "----------\n" + - "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + + "1. ERROR in pkg3\\Invalid3.java (at line 2)\n" + + " import mainpkg.Outer.*;\n"+ + " ^^^^^^^^^^^^^\n"+ + "The import mainpkg.Outer is never used\n" + + "----------\n" + + "2. ERROR in pkg3\\Invalid3.java (at line 6)\n" + " * {@link MostInner} -- error/warning \n" + " ^^^^^^^^^\n" + "Javadoc: MostInner cannot be resolved to a type\n" + @@ -7079,7 +7114,12 @@ public void testBug176027h_private() { String error50 = new String( //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner "----------\n" + - "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + + "1. ERROR in pkg3\\Invalid3.java (at line 2)\n" + + " import mainpkg.Outer.*;\n"+ + " ^^^^^^^^^^^^^\n"+ + "The import mainpkg.Outer is never used\n" + + "----------\n" + + "2. ERROR in pkg3\\Invalid3.java (at line 6)\n" + " * {@link MostInner} -- error/warning \n" + " ^^^^^^^^^\n" + "Javadoc: MostInner cannot be resolved to a type\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForClass.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForClass.java index 917fc28282..13375e6e70 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForClass.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForClass.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -950,12 +950,17 @@ public class JavadocTestForClass extends JavadocTest { + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\X.java (at line 6)\n" + + "1. WARNING in test\\X.java (at line 2)\n"+ + " import test.copy.*;\n"+ + " ^^^^^^^^^\n"+ + "The import test.copy is never used\n"+ + "----------\n"+ + "2. ERROR in test\\X.java (at line 6)\n" + " * @see VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "2. ERROR in test\\X.java (at line 7)\n" + + "3. ERROR in test\\X.java (at line 7)\n" + " * @see test.copy.VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type test.copy.VisibilityPackage is not visible\n" + @@ -1018,7 +1023,12 @@ public class JavadocTestForClass extends JavadocTest { "}\n", }, "----------\n" + - "1. ERROR in X.java (at line 6)\n" + + "1. WARNING in X.java (at line 2)\n"+ + " import java.util.Map.Entry;\n"+ + " ^^^^^^^^^^^^^^^^^^^\n"+ + "The import java.util.Map.Entry is never used\n"+ + "----------\n"+ + "2. ERROR in X.java (at line 6)\n" + " * <li> {@link Entry} </li>\n" + " ^^^^^\n" + "Javadoc: Invalid member type qualification\n" + @@ -1090,7 +1100,12 @@ public class JavadocTestForClass extends JavadocTest { "}\n", }, "----------\n" + - "1. ERROR in X.java (at line 6)\n" + + "1. WARNING in X.java (at line 2)\n"+ + " import java.util.Map.Entry;\n"+ + " ^^^^^^^^^^^^^^^^^^^\n"+ + "The import java.util.Map.Entry is never used\n"+ + "----------\n"+ + "2. ERROR in X.java (at line 6)\n" + " * <li> {@link Entry} </li>\n" + " ^^^^^\n" + "Javadoc: Invalid member type qualification\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForConstructor.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForConstructor.java index 8dfdbfde21..bfd127cb1d 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForConstructor.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForConstructor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -903,12 +903,17 @@ public class JavadocTestForConstructor extends JavadocTest { + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\X.java (at line 7)\n" + + "1. WARNING in test\\X.java (at line 2)\n"+ + " import test.copy.*;\n"+ + " ^^^^^^^^^\n"+ + "The import test.copy is never used\n"+ + "----------\n"+ + "2. ERROR in test\\X.java (at line 7)\n" + " * @see VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "2. ERROR in test\\X.java (at line 8)\n" + + "3. ERROR in test\\X.java (at line 8)\n" + " * @see test.copy.VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type test.copy.VisibilityPackage is not visible\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForField.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForField.java index 1694201eb4..54e65ab3f0 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForField.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForField.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -977,12 +977,17 @@ public class JavadocTestForField extends JavadocTest { + " public int x;\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\X.java (at line 7)\n" + + "1. WARNING in test\\X.java (at line 2)\n"+ + " import test.copy.*;\n"+ + " ^^^^^^^^^\n"+ + "The import test.copy is never used\n"+ + "----------\n"+ + "2. ERROR in test\\X.java (at line 7)\n" + " * @see VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "2. ERROR in test\\X.java (at line 8)\n" + + "3. ERROR in test\\X.java (at line 8)\n" + " * @see test.copy.VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type test.copy.VisibilityPackage is not visible\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForInterface.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForInterface.java index 4fb36c2af4..d6b993b092 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForInterface.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForInterface.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -910,12 +910,17 @@ public class JavadocTestForInterface extends JavadocTest { + " public void foo();\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\IX.java (at line 6)\n" + + "1. WARNING in test\\IX.java (at line 2)\n"+ + " import test.copy.*;\n"+ + " ^^^^^^^^^\n"+ + "The import test.copy is never used\n"+ + "----------\n"+ + "2. ERROR in test\\IX.java (at line 6)\n" + " * @see VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "2. ERROR in test\\IX.java (at line 7)\n" + + "3. ERROR in test\\IX.java (at line 7)\n" + " * @see test.copy.VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type test.copy.VisibilityPackage is not visible\n" + @@ -2198,12 +2203,17 @@ public class JavadocTestForInterface extends JavadocTest { + " public void foo();\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\IX.java (at line 7)\n" + + "1. WARNING in test\\IX.java (at line 2)\n"+ + " import test.copy.*;\n"+ + " ^^^^^^^^^\n"+ + "The import test.copy is never used\n"+ + "----------\n"+ + "2. ERROR in test\\IX.java (at line 7)\n" + " * @see VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "2. ERROR in test\\IX.java (at line 8)\n" + + "3. ERROR in test\\IX.java (at line 8)\n" + " * @see test.copy.VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type test.copy.VisibilityPackage is not visible\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java index c616f73836..9d00e0d3c3 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -1037,12 +1037,17 @@ public class JavadocTestForMethod extends JavadocTest { + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in X.java (at line 5)\n" + + "1. WARNING in X.java (at line 1)\n"+ + " import java.util.Hashtable;\n"+ + " ^^^^^^^^^^^^^^^^^^^\n"+ + "The import java.util.Hashtable is never used\n"+ + "----------\n"+ + "2. ERROR in X.java (at line 5)\n" + " * @param Hashtable\n" + " ^^^^^^^^^\n" + "Javadoc: Parameter Hashtable is not declared\n" + "----------\n" + - "2. ERROR in X.java (at line 7)\n" + + "3. ERROR in X.java (at line 7)\n" + " public void p_foo(int x) {\n" + " ^\n" + "Javadoc: Missing tag for parameter x\n" + @@ -2341,47 +2346,52 @@ public class JavadocTestForMethod extends JavadocTest { + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\X.java (at line 7)\n" + + "1. WARNING in test\\X.java (at line 2)\n"+ + " import test.copy.*;\n"+ + " ^^^^^^^^^\n"+ + "The import test.copy is never used\n"+ + "----------\n"+ + "2. ERROR in test\\X.java (at line 7)\n" + " * @see VisibilityPackage#unknown Invalid ref: non visible class (non existent field)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "2. ERROR in test\\X.java (at line 8)\n" + + "3. ERROR in test\\X.java (at line 8)\n" + " * @see VisibilityPackage#vf_private Invalid ref: non visible class (non existent field)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "3. ERROR in test\\X.java (at line 9)\n" + + "4. ERROR in test\\X.java (at line 9)\n" + " * @see VisibilityPackage#vf_public Invalid ref: non visible class (visible field)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "4. ERROR in test\\X.java (at line 10)\n" + + "5. ERROR in test\\X.java (at line 10)\n" + " * @see VisibilityPackage.VpPrivate#unknown Invalid ref: non visible class and non visible inner class (non existent field)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "5. ERROR in test\\X.java (at line 11)\n" + + "6. ERROR in test\\X.java (at line 11)\n" + " * @see VisibilityPackage.VpPrivate#vf_private Invalid ref: non visible class and non visible inner class (non visible field)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "6. ERROR in test\\X.java (at line 12)\n" + + "7. ERROR in test\\X.java (at line 12)\n" + " * @see VisibilityPackage.VpPrivate#vf_public Invalid ref: non visible class and non visible inner class (visible field)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "7. ERROR in test\\X.java (at line 13)\n" + + "8. ERROR in test\\X.java (at line 13)\n" + " * @see VisibilityPackage.VpPublic#unknown Invalid ref: non visible class and visible inner class (non existent field)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "8. ERROR in test\\X.java (at line 14)\n" + + "9. ERROR in test\\X.java (at line 14)\n" + " * @see VisibilityPackage.VpPublic#vf_private Invalid ref: non visible class and visible inner class (non visible field)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "9. ERROR in test\\X.java (at line 15)\n" + + "10. ERROR in test\\X.java (at line 15)\n" + " * @see VisibilityPackage.VpPublic#vf_public Invalid ref: non visible class and visible inner class (visible field)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + @@ -3782,22 +3792,27 @@ public class JavadocTestForMethod extends JavadocTest { + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\deep\\qualified\\name\\p\\X.java (at line 7)\n" + + "1. WARNING in test\\deep\\qualified\\name\\p\\X.java (at line 2)\n"+ + " import java.util.Vector;\n"+ + " ^^^^^^^^^^^^^^^^\n"+ + "The import java.util.Vector is never used\n"+ + "----------\n"+ + "2. ERROR in test\\deep\\qualified\\name\\p\\X.java (at line 7)\n" + " * @see test.deep.qualified.name.p.X#smr_foo(boolean,int i,byte,short s,char,long l,float,double d) Invalid reference: mixed argument declaration\n" + " ^^^^^^^^^^^^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "2. ERROR in test\\deep\\qualified\\name\\p\\X.java (at line 8)\n" + + "3. ERROR in test\\deep\\qualified\\name\\p\\X.java (at line 8)\n" + " * @see test.deep.qualified.name.p.X#smr_foo(String,String y,int) Invalid reference: mixed argument declaration\n" + " ^^^^^^^^^^^^^^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "3. ERROR in test\\deep\\qualified\\name\\p\\X.java (at line 9)\n" + + "4. ERROR in test\\deep\\qualified\\name\\p\\X.java (at line 9)\n" + " * @see test.deep.qualified.name.p.X#smr_foo(Hashtable,Vector,boolean b) Invalid reference: mixed argument declaration\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "4. ERROR in test\\deep\\qualified\\name\\p\\X.java (at line 10)\n" + + "5. ERROR in test\\deep\\qualified\\name\\p\\X.java (at line 10)\n" + " * @see test.deep.qualified.name.p.X#smr_foo(Hashtable,Vector,boolean b) Invalid reference: mixed argument declaration\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: Invalid parameters declaration\n" + @@ -4213,77 +4228,82 @@ public class JavadocTestForMethod extends JavadocTest { + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\X.java (at line 7)\n" + + "1. WARNING in test\\X.java (at line 2)\n"+ + " import test.copy.*;\n"+ + " ^^^^^^^^^\n"+ + "The import test.copy is never used\n"+ + "----------\n"+ + "2. ERROR in test\\X.java (at line 7)\n" + " * @see VisibilityPackage#unknown() Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "2. ERROR in test\\X.java (at line 8)\n" + + "3. ERROR in test\\X.java (at line 8)\n" + " * @see VisibilityPackage#vm_private() Invalid ref: non visible class (non visible method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "3. ERROR in test\\X.java (at line 9)\n" + + "4. ERROR in test\\X.java (at line 9)\n" + " * @see VisibilityPackage#vm_private(boolean) Invalid ref: non visible class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "4. ERROR in test\\X.java (at line 10)\n" + + "5. ERROR in test\\X.java (at line 10)\n" + " * @see VisibilityPackage#vm_public() Invalid ref: non visible class (visible method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "5. ERROR in test\\X.java (at line 11)\n" + + "6. ERROR in test\\X.java (at line 11)\n" + " * @see VisibilityPackage#vm_public(long,long,long,int) Invalid ref: non visible class (visible method)\n" + " ^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "6. ERROR in test\\X.java (at line 12)\n" + + "7. ERROR in test\\X.java (at line 12)\n" + " * @see VisibilityPackage.VpPrivate#unknown() Invalid ref: non visible class and non visible inner class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "7. ERROR in test\\X.java (at line 13)\n" + + "8. ERROR in test\\X.java (at line 13)\n" + " * @see VisibilityPackage.VpPrivate#vm_private() Invalid ref: non visible class and non visible inner class (non visible method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "8. ERROR in test\\X.java (at line 14)\n" + + "9. ERROR in test\\X.java (at line 14)\n" + " * @see VisibilityPackage.VpPrivate#vm_private(boolean, String) Invalid ref: non visible class and non visible inner class (non applicable method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "9. ERROR in test\\X.java (at line 15)\n" + + "10. ERROR in test\\X.java (at line 15)\n" + " * @see VisibilityPackage.VpPrivate#vm_public() Invalid ref: non visible class and non visible inner class (visible method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "10. ERROR in test\\X.java (at line 16)\n" + + "11. ERROR in test\\X.java (at line 16)\n" + " * @see VisibilityPackage.VpPrivate#vm_public(Object, float) Invalid ref: non visible class and non visible inner class (non applicable visible method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "11. ERROR in test\\X.java (at line 17)\n" + + "12. ERROR in test\\X.java (at line 17)\n" + " * @see VisibilityPackage.VpPublic#unknown() Invalid ref: non visible class and visible inner class (non existent method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "12. ERROR in test\\X.java (at line 18)\n" + + "13. ERROR in test\\X.java (at line 18)\n" + " * @see VisibilityPackage.VpPublic#vm_private() Invalid ref: non visible class and visible inner class (non visible method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "13. ERROR in test\\X.java (at line 19)\n" + + "14. ERROR in test\\X.java (at line 19)\n" + " * @see VisibilityPackage.VpPublic#vm_private(boolean, String) Invalid ref: non visible class and visible inner class (non applicable method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "14. ERROR in test\\X.java (at line 20)\n" + + "15. ERROR in test\\X.java (at line 20)\n" + " * @see VisibilityPackage.VpPublic#vm_public() Invalid ref: non visible class and visible inner class (visible method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + "----------\n" + - "15. ERROR in test\\X.java (at line 21)\n" + + "16. ERROR in test\\X.java (at line 21)\n" + " * @see VisibilityPackage.VpPublic#vm_public(Object, float) Invalid ref: non visible class and visible inner class (non applicable visible method)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Javadoc: The type VisibilityPackage is not visible\n" + @@ -4678,32 +4698,37 @@ public class JavadocTestForMethod extends JavadocTest { + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\X.java (at line 7)\n" + + "1. WARNING in test\\X.java (at line 2)\n"+ + " import test.copy.VisibilityPublic;\n"+ + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n"+ + "The import test.copy.VisibilityPublic is never used\n"+ + "----------\n"+ + "2. ERROR in test\\X.java (at line 7)\n" + " * @see VisibilityPublic#vm_private(\"boolean\") Invalid ref: invalid argument declaration\n" + " ^^^^^^^^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "2. ERROR in test\\X.java (at line 8)\n" + + "3. ERROR in test\\X.java (at line 8)\n" + " * @see VisibilityPublic#vm_public(long, \"int) Invalid ref: invalid argument definition\n" + " ^^^^^^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "3. ERROR in test\\X.java (at line 9)\n" + + "4. ERROR in test\\X.java (at line 9)\n" + " * @see VisibilityPublic.VpPrivate#vm_private(double d()) Invalid ref: invalid argument declaration\n" + " ^^^^^^^^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "4. ERROR in test\\X.java (at line 10)\n" + + "5. ERROR in test\\X.java (at line 10)\n" + " * @see VisibilityPublic.VpPrivate#vm_public(\") Invalid ref: invalid argument declaration\n" + " ^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "5. ERROR in test\\X.java (at line 11)\n" + + "6. ERROR in test\\X.java (at line 11)\n" + " * @see VisibilityPublic.VpPublic#vm_private(d()) Invalid ref: invalid argument declaration\n" + " ^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "6. ERROR in test\\X.java (at line 12)\n" + + "7. ERROR in test\\X.java (at line 12)\n" + " * @see VisibilityPublic.VpPublic#vm_public(205) Invalid ref: invalid argument declaration\n" + " ^^^^\n" + "Javadoc: Invalid parameters declaration\n" + @@ -4875,32 +4900,37 @@ public class JavadocTestForMethod extends JavadocTest { + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in test\\X.java (at line 7)\n" + + "1. WARNING in test\\X.java (at line 2)\n"+ + " import test.copy.VisibilityPublic;\n"+ + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n"+ + "The import test.copy.VisibilityPublic is never used\n"+ + "----------\n"+ + "2. ERROR in test\\X.java (at line 7)\n" + " * @see test.copy.VisibilityPublic#vm_private(\"\") Invalid ref: invalid argument declaration\n" + " ^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "2. ERROR in test\\X.java (at line 8)\n" + + "3. ERROR in test\\X.java (at line 8)\n" + " * @see test.copy.VisibilityPublic#vm_public(\"\"\") Invalid ref: invalid argument definition\n" + " ^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "3. ERROR in test\\X.java (at line 9)\n" + + "4. ERROR in test\\X.java (at line 9)\n" + " * @see test.copy.VisibilityPublic.VpPrivate#vm_private(String d()) Invalid ref: invalid argument declaration\n" + " ^^^^^^^^^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "4. ERROR in test\\X.java (at line 10)\n" + + "5. ERROR in test\\X.java (at line 10)\n" + " * @see test.copy.VisibilityPublic.VpPrivate#vm_public([) Invalid ref: invalid argument declaration\n" + " ^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "5. ERROR in test\\X.java (at line 11)\n" + + "6. ERROR in test\\X.java (at line 11)\n" + " * @see test.copy.VisibilityPublic.VpPublic#vm_private([]) Invalid ref: invalid argument declaration\n" + " ^^\n" + "Javadoc: Invalid parameters declaration\n" + "----------\n" + - "6. ERROR in test\\X.java (at line 12)\n" + + "7. ERROR in test\\X.java (at line 12)\n" + " * @see test.copy.VisibilityPublic.VpPublic#vm_public(char[], int[],]) Invalid ref: invalid argument declaration\n" + " ^^^^^^^^^^^^^^^^\n" + "Javadoc: Invalid parameters declaration\n" + diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties index eb09ec22db..0ea19e03d4 100644 --- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties +++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties @@ -21,7 +21,7 @@ #Format: compiler.name = word1 word2 word3 compiler.name = Eclipse Compiler for Java(TM) #Format: compiler.version = 0.XXX[, other words (don't forget the comma if adding other words)] -compiler.version = 0.C48, 3.8.0 M7 +compiler.version = 0.C49, 3.8.0 M7 compiler.copyright = Copyright IBM Corp 2000, 2012. All rights reserved. ### progress diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html index c9ee46c846..2b1cab15f9 100644 --- a/org.eclipse.jdt.core/buildnotes_jdt-core.html +++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html @@ -42,11 +42,24 @@ </td> </tr> </table> +<a name="v_C49"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.8.0 - %date% - 3.8.0 M7 +<br>Project org.eclipse.jdt.core v_C49 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_C49">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=371832">371832</a> +The preference "Suppress optional errors with '@SuppressWarnings'" ends up silencing warnings it shouldn't + <a name="v_C48"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.8.0 - April 27, 2012 - 3.8.0 M7 +Eclipse SDK 3.8.0 - April 27, 2012 <br>Project org.eclipse.jdt.core v_C48 (<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_C48">cvs</a>). <h2>What's new in this drop</h2> diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java index d82de3c79e..f1c60e78a7 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -73,6 +73,7 @@ public class CompilationResult { public char[][] packageName; public boolean checkSecondaryTypes = false; // check for secondary types which were created after the initial buildTypeBindings call private int numberOfErrors; + private boolean hasMandatoryErrors; private static final int[] EMPTY_LINE_ENDS = Util.EMPTY_INT_ARRAY; private static final Comparator PROBLEM_COMPARATOR = new Comparator() { @@ -274,6 +275,10 @@ public boolean hasErrors() { return this.numberOfErrors != 0; } +public boolean hasMandatoryErrors() { + return this.hasMandatoryErrors; +} + public boolean hasProblems() { return this.problemCount != 0; } @@ -324,6 +329,11 @@ public void recordPackageName(char[][] packName) { } public void record(CategorizedProblem newProblem, ReferenceContext referenceContext) { + record(newProblem, referenceContext, true); + return; +} + +public void record(CategorizedProblem newProblem, ReferenceContext referenceContext, boolean mandatoryError) { //new Exception("VERBOSE PROBLEM REPORTING").printStackTrace(); if(newProblem.getID() == IProblem.Task) { recordTask(newProblem); @@ -343,6 +353,7 @@ public void record(CategorizedProblem newProblem, ReferenceContext referenceCont } if (newProblem.isError()) { this.numberOfErrors++; + if (mandatoryError) this.hasMandatoryErrors = true; if ((newProblem.getID() & IProblem.Syntax) != 0) { this.hasSyntaxError = true; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java index cbe6196fa9..00ff614c8d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -602,7 +602,7 @@ public class Compiler implements ITypeRequestor, ProblemSeverities { 0, // source end 0, // line number 0),// column number - unit); + unit, true); /* hand back the compilation result */ if (!result.hasBeenAccepted) { @@ -664,7 +664,7 @@ public class Compiler implements ITypeRequestor, ProblemSeverities { if (distantProblem instanceof DefaultProblem) { // fixup filename TODO (philippe) should improve API to make this official ((DefaultProblem) distantProblem).setOriginatingFileName(result.getFileName()); } - result.record(distantProblem, unit); + result.record(distantProblem, unit, true); } } else { /* distant internal exception which could not be reported back there */ diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java index 754305e55c..b2774fa9f1 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java @@ -561,7 +561,7 @@ public void resolve() { this.types[i].resolve(this.scope); } } - if (!this.compilationResult.hasErrors()) checkUnusedImports(); + if (!this.compilationResult.hasMandatoryErrors()) checkUnusedImports(); reportNLSProblems(); } catch (AbortCompilationUnit e) { this.ignoreFurtherInvestigation = true; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java index 93418633a8..1ea540f005 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java @@ -162,10 +162,11 @@ public void handle( switch (severity & ProblemSeverities.Error) { case ProblemSeverities.Error : - record(problem, unitResult, referenceContext); + boolean mandatory = ((severity & ProblemSeverities.Optional) == 0); + record(problem, unitResult, referenceContext, mandatory); if ((severity & ProblemSeverities.Fatal) != 0) { // don't abort or tag as error if the error is suppressed - if (!referenceContext.hasErrors() && (severity & ProblemSeverities.Optional) != 0 && this.options.suppressOptionalErrors) { + if (!referenceContext.hasErrors() && !mandatory && this.options.suppressOptionalErrors) { CompilationUnitDeclaration unitDecl = referenceContext.getCompilationUnitDeclaration(); if (unitDecl != null && unitDecl.isSuppressed(problem)) { return; @@ -180,7 +181,7 @@ public void handle( } break; case ProblemSeverities.Warning : - record(problem, unitResult, referenceContext); + record(problem, unitResult, referenceContext, false); break; } } @@ -208,7 +209,7 @@ public void handle( referenceContext, unitResult); } -public void record(CategorizedProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) { - unitResult.record(problem, referenceContext); +public void record(CategorizedProblem problem, CompilationResult unitResult, ReferenceContext referenceContext, boolean optionalError) { + unitResult.record(problem, referenceContext, optionalError); } } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java index e25656619c..58e476b6a6 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -86,8 +86,8 @@ public SourceElementParser( DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) { - public void record(CategorizedProblem problem, CompilationResult unitResult, ReferenceContext context) { - unitResult.record(problem, context); // TODO (jerome) clients are trapping problems either through factory or requestor... is result storing needed? + public void record(CategorizedProblem problem, CompilationResult unitResult, ReferenceContext context, boolean mandatoryError) { + unitResult.record(problem, context, mandatoryError); // TODO (jerome) clients are trapping problems either through factory or requestor... is result storing needed? SourceElementParser.this.requestor.acceptProblem(problem); } }; |