### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java,v retrieving revision 1.44 diff -u -r1.44 PackageBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 27 May 2008 22:21:12 -0000 1.44 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 7 Jul 2008 17:03:59 -0000 @@ -164,7 +164,7 @@ public Binding getTypeOrPackage(char[] name) { ReferenceBinding typeBinding = getType0(name); - if (typeBinding != null && typeBinding != LookupEnvironment.TheNotFoundType) { + if (typeBinding != null && typeBinding != LookupEnvironment.TheNotFoundType && (typeBinding.tagBits & TagBits.HasMissingType) == 0) { typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now if (typeBinding.isNestedType()) return new ProblemReferenceBinding(new char[][]{name}, typeBinding, ProblemReasons.InternalNameProvided); @@ -172,8 +172,12 @@ } PackageBinding packageBinding = getPackage0(name); - if (packageBinding != null && packageBinding != LookupEnvironment.TheNotFoundPackage) + if (packageBinding != null && packageBinding != LookupEnvironment.TheNotFoundPackage) { + if ((packageBinding.tagBits & TagBits.HasMissingType) != 0) { + if ((typeBinding.tagBits & TagBits.HasMissingType) != 0) return typeBinding; + } return packageBinding; + } if (typeBinding == null) { // have not looked for it before if ((typeBinding = environment.askForType(this, name)) != null) { @@ -185,6 +189,8 @@ // Since name could not be found, add a problem binding // to the collections so it will be reported as an error next time. addNotFoundType(name); + } else { + return typeBinding; // return missingType since no conflict with package } if (packageBinding == null) { // have not looked for it before #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java,v retrieving revision 1.8.2.1 diff -u -r1.8.2.1 ProblemTypeAndMethodTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java 7 Jul 2008 15:43:13 -0000 1.8.2.1 +++ src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java 7 Jul 2008 17:04:02 -0000 @@ -3797,7 +3797,7 @@ "----------\n"); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=239758 -public void _test081() { +public void testONLY_081() { if (this.complianceLevel <= ClassFileConstants.JDK1_4) return; Map customOptions = getCompilerOptions(); customOptions.put( CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); @@ -3884,5 +3884,232 @@ false, customOptions); } - +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239758 - variation +public void test082() { + if (this.complianceLevel <= ClassFileConstants.JDK1_4) return; + this.runConformTest( + new String[] { + "com/ost/util/report/Matrix.java", // ================= + "package com.ost.util.report;\n" + + "import java.io.Serializable;\n" + + "import com.ost.util.report.exceptions.InvalidRowSizeException;\n" + + "public class Matrix implements Serializable {\n" + + " /**\n" + + " * @see exceptions.InvalidRowSizeException2\n" + + " */\n" + + " public synchronized final void addRow(Object[] row){\n" + + " throw new InvalidRowSizeException();\n" + + " }\n" + + "}\n", + "com/ost/util/report/FilterConstraintSpecification.java", // ================= + "package com.ost.util.report;\n" + + "import java.io.Serializable;\n" + + "import com.ost.util.report.exceptions.MalformedFilterConstraintSpecification;\n" + + "public final class FilterConstraintSpecification implements Serializable, Cloneable {\n" + + " private final void makeConstraint(){\n" + + " throw new MalformedFilterConstraintSpecification();\n" + + " }\n" + + "}\n", + "com/ost/util/report/exceptions/MalformedFilterConstraintSpecification.java", // ================= + "package com.ost.util.report.exceptions;\n" + + "public class MalformedFilterConstraintSpecification extends RuntimeException {\n" + + " /** Creates a new instance of MalformedFilterConstraintSpecification */\n" + + " public MalformedFilterConstraintSpecification() {\n" + + " super();\n" + + " }\n" + + " /* Creates a new instance of MalformedFilterConstraintSpecification */\n" + + " public MalformedFilterConstraintSpecification(String message) {\n" + + " super(message);\n" + + " }\n" + + "}\n", + "com/ost/util/report/exceptions/InvalidRowSizeException.java", // ================= + "package com.ost.util.report.exceptions;\n" + + "public class InvalidRowSizeException extends RuntimeException {\n" + + " /** Creates a new instance of InvalidRowSizeException */\n" + + " public InvalidRowSizeException() {\n" + + " super();\n" + + " }\n" + + " /* Creates a new instance of InvalidRowSizeException */\n" + + " public InvalidRowSizeException(String message) {\n" + + " super(message);\n" + + " }\n" + + "}\n" + }, + ""); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239758 - variation +public void test083() { + this.runConformTest( + new String[] { + "foo/X.java", // ================= + "package foo;\n" + + "import foo.exceptions.*;\n" + + "public class X {\n" + + " class exceptions {}\n" + + " exceptions E;\n" + + "}\n", + "foo/exceptions/Z.java", // ================= + "package foo.exceptions;\n" + + "public class Z {\n" + + "}\n" + }, + ""); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239758 - variation +public void test084() { + this.runNegativeTest( + new String[] { + "foo/X.java", // ================= + "package foo;\n" + + "import foo.exceptions.*;\n" + + "public class X {\n" + + " exceptions E;\n" + + "}\n" + + "class exceptions {}\n", + "foo/exceptions/Z.java", // ================= + "package foo.exceptions;\n" + + "public class Z {\n" + + "}\n" + }, + "----------\n" + + "1. WARNING in foo\\X.java (at line 2)\n" + + " import foo.exceptions.*;\n" + + " ^^^^^^^^^^^^^^\n" + + "The import foo.exceptions is never used\n" + + "----------\n" + + "----------\n" + + "1. ERROR in foo\\exceptions\\Z.java (at line 1)\n" + + " package foo.exceptions;\n" + + " ^^^^^^^^^^^^^^\n" + + "The package foo.exceptions collides with a type\n" + + "----------\n"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239758 - variation +public void testONLY_085() { + this.runNegativeTest( + new String[] { + "p/X.java", // ================= + "package p;\n" + + "public class X extends zork.Z {\n" + + "}\n", + "p/Y.java", // ================= + "package p;\n" + + "import p.zork.Z;\n" + + "public class Y {\n" + + "}\n", + "p/zork/Z.java", // ================= + "package p.zork;\n" + + "public class Z {\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in p\\X.java (at line 2)\n" + + " public class X extends zork.Z {\n" + + " ^^^^\n" + + "zork cannot be resolved to a type\n" + + "----------\n" + + "----------\n" + + "1. WARNING in p\\Y.java (at line 2)\n" + + " import p.zork.Z;\n" + + " ^^^^^^^^\n" + + "The import p.zork.Z is never used\n" + + "----------\n"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239758 - variation +public void testONLY_086() { + this.runNegativeTest( + new String[] { + "p/X.java", // ================= + "package p;\n" + + "public class X extends zork.Z {\n" + + "}\n", + "p/Y.java", // ================= + "package p;\n" + + "import p.zork.*;\n" + + "public class Y {\n" + + "}\n", + "p/zork/Z.java", // ================= + "package p.zork;\n" + + "public class Z {\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in p\\X.java (at line 2)\n" + + " public class X extends zork.Z {\n" + + " ^^^^\n" + + "zork cannot be resolved to a type\n" + + "----------\n" + + "----------\n" + + "1. WARNING in p\\Y.java (at line 2)\n" + + " import p.zork.*;\n" + + " ^^^^^^\n" + + "The import p.zork is never used\n" + + "----------\n"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239758 - variation +public void testONLY_087() { + if (this.complianceLevel <= ClassFileConstants.JDK1_4) return; + this.runNegativeTest( + new String[] { + "p/X.java", // ================= + "package p;\n" + + "public class X extends zork.Z {\n" + + "}\n", + "p/Y.java", // ================= + "package p;\n" + + "import static p.zork.Z.M;\n" + + "public class Y {\n" + + "}\n", + "p/zork/Z.java", // ================= + "package p.zork;\n" + + "public class Z {\n" + + " public static class M {}\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in p\\X.java (at line 2)\n" + + " public class X extends zork.Z {\n" + + " ^^^^\n" + + "zork cannot be resolved to a type\n" + + "----------\n" + + "----------\n" + + "1. WARNING in p\\Y.java (at line 2)\n" + + " import static p.zork.Z.M;\n" + + " ^^^^^^^^^^\n" + + "The import p.zork.Z.M is never used\n" + + "----------\n"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239758 - variation +public void testONLY_088() { + if (this.complianceLevel <= ClassFileConstants.JDK1_4) return; + this.runNegativeTest( + new String[] { + "p/X.java", // ================= + "package p;\n" + + "public class X extends zork.Z {\n" + + "}\n", + "p/Y.java", // ================= + "package p;\n" + + "import static p.zork.Z.*;\n" + + "public class Y {\n" + + "}\n", + "p/zork/Z.java", // ================= + "package p.zork;\n" + + "public class Z {\n" + + " static class M {}\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in p\\X.java (at line 2)\n" + + " public class X extends zork.Z {\n" + + " ^^^^\n" + + "zork cannot be resolved to a type\n" + + "----------\n" + + "----------\n" + + "1. WARNING in p\\Y.java (at line 2)\n" + + " import static p.zork.Z.*;\n" + + " ^^^^^^^^\n" + + "The import p.zork.Z is never used\n" + + "----------\n"); +} }