Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.17 diff -u -r1.17 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 1 Jun 2005 09:06:31 -0000 1.17 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 6 Jun 2005 10:06:21 -0000 @@ -1562,6 +1563,416 @@ "incorrect classpath: dummy\n", false); } +//Extraneous auto-build error message - https://bugs.eclipse.org/bugs/show_bug.cgi?id=93377 +public void test030(){ + // first series shows that a clean build is OK + this.runConformTest( + new String[] { + "X.java", + "public interface X, \n" + + " K extends X.K, \n" + + " S extends X.S> {\n" + + " public interface K, \n" + + " KS extends X.S> {\n" + + " }\n" + + " public interface S {\n" + + " }\n" + + "}\n", + "Y.java", + "public class Y, \n" + + " K extends X.K, \n" + + " S extends X.S> { \n" + + "}\n", + }, + "\"" + OUTPUT_DIR + File.separator + "Y.java\"" + + " -1.5 -g -preserveAllLocals" + + " -cp \"" + OUTPUT_DIR + File.separator + "\"" + + " -proceedOnError -referenceInfo" + + " -d \"" + OUTPUT_DIR + "\"", + "", + "", + true); + // second series shows that a staged build - that simulates the auto build context - is OK as well + this.runConformTest( + new String[] { + "X.java", + "public interface X, \n" + + " K extends X.K, \n" + + " S extends X.S> {\n" + + " public interface K, \n" + + " KS extends X.S> {\n" + + " }\n" + + " public interface S {\n" + + " }\n" + + "}\n", + }, + "\"" + OUTPUT_DIR + File.separator + "X.java\"" + + " -1.5 -g -preserveAllLocals" + + " -proceedOnError -referenceInfo" + + " -d \"" + OUTPUT_DIR + "\"", + "", + "", + true); + this.runConformTest( + new String[] { + "Y.java", + "public class Y, \n" + + " K extends X.K, \n" + + " S extends X.S> { \n" + + "}\n", + }, + "\"" + OUTPUT_DIR + File.separator + "Y.java\"" + + " -1.5 -g -preserveAllLocals" + + " -cp \"" + OUTPUT_DIR + File.separator + "\"" + + " -proceedOnError -referenceInfo" + + " -d \"" + OUTPUT_DIR + "\"", + "", + "", + false); +} +// Extraneous auto-build error message - https://bugs.eclipse.org/bugs/show_bug.cgi?id=93377 +// More complex test case than test30 +public void test032(){ + // first series shows that a clean build is OK (warning messages only) + this.runConformTest( + new String[] { + "p/X.java", + "package p;\n" + + "import java.io.Serializable;\n" + + "public interface X, \n" + + " U extends X.XX, \n" + + " V extends X.XY> {\n" + + " public interface XX, \n" + + " UU extends X.XY> \n" + + " extends Serializable {\n" + + " }\n" + + " public interface XY extends Serializable {\n" + + " }\n" + + "}\n", + "p/Y.java", + "package p;\n" + + "import java.util.*;\n" + + "import p.X.*;\n" + + "public class Y, \n" + + " U extends X.XX, \n" + + " V extends X.XY> {\n" + + " private final Map m1 = new HashMap();\n" + + " private final Map m2 = new HashMap();\n" + + " private final Z m3;\n" + + "\n" + + " public Y(final Z p1) {\n" + + " this.m3 = p1;\n" + + " }\n" + + "\n" + + " public void foo1(final U p1, final V p2, final T p3) {\n" + + " m1.put(p1, p2);\n" + + " m2.put(p1, p3);\n" + + " m3.foo2(p1, p2);\n" + + " }\n" + + "\n" + + " public void foo3(final U p1) {\n" + + " assert m1.containsKey(p1);\n" + + " m1.remove(p1);\n" + + " m2.remove(p1);\n" + + " m3.foo2(p1, null);\n" + + " }\n" + + "\n" + + " public Collection foo4() {\n" + + " return Collections.unmodifiableCollection(m2.values());\n" + + " }\n" + + "\n" + + " public void foo5(final Map, XY> p1) {\n" + + " p1.putAll(m1);\n" + + " }\n" + + "\n" + + " public void foo6(final Map, XY> p1) {\n" + + " m1.keySet().retainAll(p1.keySet());\n" + + " m2.keySet().retainAll(p1.keySet());\n" + + " }\n" + + "}\n", + "p/Z.java", + "package p;\n" + + "\n" + + "import java.util.*;\n" + + "\n" + + "import p.X.*;\n" + + "\n" + + "public class Z {\n" + + " private final Map, \n" + + " Y, ? extends XY>> \n" + + " m1 = new HashMap, \n" + + " Y, ? extends XY>>();\n" + + "\n" + + " private Map, \n" + + " X.XY> \n" + + " m2 = new HashMap, \n" + + " X.XY>();\n" + + "\n" + + " public , \n" + + " U extends X.XX, \n" + + " V extends X.XY> \n" + + " Y foo1(final Class p1) {\n" + + " Y l1 = m1.get(p1);\n" + + " if (l1 == null) {\n" + + " l1 = new Y(this);\n" + + " m1.put(p1, l1);\n" + + " }\n" + + " return l1;\n" + + " }\n" + + "\n" + + " public , \n" + + " UU extends X.XY> \n" + + " void foo2(final TT p1, final UU p2) {\n" + + " m2.put((XX) p1, p2);\n" + + " }\n" + + "\n" + + " public Map, XY> foo3() {\n" + + " final Map, \n" + + " XY> l1 = new HashMap, \n" + + " XY>();\n" + + " for (final Y, \n" + + " ? extends XY> \n" + + " i : m1.values()) {\n" + + " i.foo5(l1);\n" + + " }\n" + + " return l1;\n" + + " }\n" + + "\n" + + " public void foo4(final Object p1, final Map, \n" + + " XY> p2) {\n" + + " for (final Y, \n" + + " ? extends XY> i : m1.values()) {\n" + + " i.foo6(p2);\n" + + " }\n" + + " for (final Map.Entry, \n" + + " XY> i : p2.entrySet()) {\n" + + " final XX l1 = (XX) i.getKey();\n" + + " }\n" + + " }\n" + + "}\n" + }, + "\"" + OUTPUT_DIR + File.separator + "p/X.java\"" + + " \"" + OUTPUT_DIR + File.separator + "p/Y.java\"" + + " \"" + OUTPUT_DIR + File.separator + "p/Z.java\"" + + " -1.5 -g -preserveAllLocals" + + " -cp \"" + OUTPUT_DIR + File.separator + "\"" + + " -proceedOnError -referenceInfo" + + " -d \"" + OUTPUT_DIR + "\"", + "", + "----------\n" + + "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 25)\n" + + " m1.put(p1, l1);\n" + + " ^^\n" + + "Type safety: The expression of type Y needs unchecked conversion to conform to Y,? extends X.XY>\n" + + "----------\n" + + "----------\n" + + "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 27)\n" + + " return l1;\n" + + " ^^\n" + + "Type safety: The expression of type Y needs unchecked conversion to conform to Y\n" + + "----------\n" + + "----------\n" + + "3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 33)\n" + + " m2.put((XX) p1, p2);\n" + + " ^^^^^^^^^^^^^^\n" + + "Type safety: The cast from TT to X.XX is actually checking against the erased type X.XX\n" + + "----------\n" + + "----------\n" + + "4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 58)\n" + + " final XX l1 = (XX) i.getKey();\n" + + " ^^\n" + + "The local variable l1 is never read\n" + + "----------\n" + + "----------\n" + + "5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 58)\n" + + " final XX l1 = (XX) i.getKey();\n" + + " ^^^^^^^^^^^^^^^^^^^^^^\n" + + "Type safety: The cast from X.XX to X.XX is actually checking against the erased type X.XX\n" + + "----------\n" + + "5 problems (5 warnings)", + true); + // second series shows that a staged build - that simulates the auto build context - is OK as well + this.runConformTest( + new String[] { + "p/X.java", + "package p;\n" + + "import java.io.Serializable;\n" + + "public interface X, \n" + + " U extends X.XX, \n" + + " V extends X.XY> {\n" + + " public interface XX, \n" + + " UU extends X.XY> \n" + + " extends Serializable {\n" + + " }\n" + + " public interface XY extends Serializable {\n" + + " }\n" + + "}\n", + }, + "\"" + OUTPUT_DIR + File.separator + "p/X.java\"" + + " -1.5 -g -preserveAllLocals" + + " -proceedOnError -referenceInfo" + + " -d \"" + OUTPUT_DIR + "\"", + "", + "", + true); + this.runConformTest( + new String[] { + "p/Y.java", + "package p;\n" + + "import java.util.*;\n" + + "import p.X.*;\n" + + "public class Y, \n" + + " U extends X.XX, \n" + + " V extends X.XY> {\n" + + " private final Map m1 = new HashMap();\n" + + " private final Map m2 = new HashMap();\n" + + " private final Z m3;\n" + + "\n" + + " public Y(final Z p1) {\n" + + " this.m3 = p1;\n" + + " }\n" + + "\n" + + " public void foo1(final U p1, final V p2, final T p3) {\n" + + " m1.put(p1, p2);\n" + + " m2.put(p1, p3);\n" + + " m3.foo2(p1, p2);\n" + + " }\n" + + "\n" + + " public void foo3(final U p1) {\n" + + " assert m1.containsKey(p1);\n" + + " m1.remove(p1);\n" + + " m2.remove(p1);\n" + + " m3.foo2(p1, null);\n" + + " }\n" + + "\n" + + " public Collection foo4() {\n" + + " return Collections.unmodifiableCollection(m2.values());\n" + + " }\n" + + "\n" + + " public void foo5(final Map, XY> p1) {\n" + + " p1.putAll(m1);\n" + + " }\n" + + "\n" + + " public void foo6(final Map, XY> p1) {\n" + + " m1.keySet().retainAll(p1.keySet());\n" + + " m2.keySet().retainAll(p1.keySet());\n" + + " }\n" + + "}\n", + "p/Z.java", + "package p;\n" + + "\n" + + "import java.util.*;\n" + + "\n" + + "import p.X.*;\n" + + "\n" + + "public class Z {\n" + + " private final Map, \n" + + " Y, ? extends XY>> \n" + + " m1 = new HashMap, \n" + + " Y, ? extends XY>>();\n" + + "\n" + + " private Map, \n" + + " X.XY> \n" + + " m2 = new HashMap, \n" + + " X.XY>();\n" + + "\n" + + " public , \n" + + " U extends X.XX, \n" + + " V extends X.XY> \n" + + " Y foo1(final Class p1) {\n" + + " Y l1 = m1.get(p1);\n" + + " if (l1 == null) {\n" + + " l1 = new Y(this);\n" + + " m1.put(p1, l1);\n" + + " }\n" + + " return l1;\n" + + " }\n" + + "\n" + + " public , \n" + + " UU extends X.XY> \n" + + " void foo2(final TT p1, final UU p2) {\n" + + " m2.put((XX) p1, p2);\n" + + " }\n" + + "\n" + + " public Map, XY> foo3() {\n" + + " final Map, \n" + + " XY> l1 = new HashMap, \n" + + " XY>();\n" + + " for (final Y, \n" + + " ? extends XY> \n" + + " i : m1.values()) {\n" + + " i.foo5(l1);\n" + + " }\n" + + " return l1;\n" + + " }\n" + + "\n" + + " public void foo4(final Object p1, final Map, \n" + + " XY> p2) {\n" + + " for (final Y, \n" + + " ? extends XY> i : m1.values()) {\n" + + " i.foo6(p2);\n" + + " }\n" + + " for (final Map.Entry, \n" + + " XY> i : p2.entrySet()) {\n" + + " final XX l1 = (XX) i.getKey();\n" + + " }\n" + + " }\n" + + "}\n" + }, + "\"" + OUTPUT_DIR + File.separator + "p/Y.java\"" + + " \"" + OUTPUT_DIR + File.separator + "p/Z.java\"" + + " -1.5 -g -preserveAllLocals" + + " -cp \"" + OUTPUT_DIR + File.separator + "\"" + + " -proceedOnError -referenceInfo" + + " -d \"" + OUTPUT_DIR + "\"", + "", + "----------\n" + + "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 25)\n" + + " m1.put(p1, l1);\n" + + " ^^\n" + + "Type safety: The expression of type Y needs unchecked conversion to conform to Y,? extends X.XY>\n" + + "----------\n" + + "----------\n" + + "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 27)\n" + + " return l1;\n" + + " ^^\n" + + "Type safety: The expression of type Y needs unchecked conversion to conform to Y\n" + + "----------\n" + + "----------\n" + + "3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 33)\n" + + " m2.put((XX) p1, p2);\n" + + " ^^^^^^^^^^^^^^\n" + + "Type safety: The cast from TT to X.XX is actually checking against the erased type X.XX\n" + + "----------\n" + + "----------\n" + + "4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 58)\n" + + " final XX l1 = (XX) i.getKey();\n" + + " ^^\n" + + "The local variable l1 is never read\n" + + "----------\n" + + "----------\n" + + "5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---\\p\\Z.java\n" + + " (at line 58)\n" + + " final XX l1 = (XX) i.getKey();\n" + + " ^^^^^^^^^^^^^^^^^^^^^^\n" + + "Type safety: The cast from X.XX to X.XX is actually checking against the erased type X.XX\n" + + "----------\n" + + "5 problems (5 warnings)", + false); +} public static Class testClass() { return BatchCompilerTest.class; }