### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v retrieving revision 1.685 diff -u -r1.685 GenericTypeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 28 Jan 2008 21:53:49 -0000 1.685 +++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 28 Jan 2008 22:40:53 -0000 @@ -42101,4 +42101,27 @@ }, ""); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216692 +public void test1268() { + this.runConformTest( + new String[] { + "pkg1/Foo.java", + "package pkg1;\n" + + "import java.util.Map;\n" + + "public class Foo {\n" + + " protected final Map fields = null;\n" + + " protected static class Field { }\n" + + "}\n", + "pkg2/SubFoo.java", + "package pkg2;\n" + + "import pkg1.Foo;\n" + + "public class SubFoo extends Foo {\n" + + " private Field field = null;\n" + + " private void test() {\n" + + " Field field = fields.get(\"test\");\n" + + " }\n" + + "}\n", // ================= + }, + ""); +} } #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java,v retrieving revision 1.115 diff -u -r1.115 ReferenceBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 9 Oct 2007 20:30:15 -0000 1.115 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 28 Jan 2008 22:40:58 -0000 @@ -204,8 +204,8 @@ if (invocationType == this) return true; if (invocationType.fPackage == this.fPackage) return true; - ReferenceBinding currentType = invocationType; - ReferenceBinding declaringClass = enclosingType(); // protected types always have an enclosing one + TypeBinding currentType = invocationType.erasure(); + TypeBinding declaringClass = enclosingType().erasure(); // protected types always have an enclosing one if (declaringClass == invocationType) return true; if (declaringClass == null) return false; // could be null if incorrect top-level protected type //int depth = 0; @@ -284,13 +284,13 @@ // OR previous assertions are true for one of the enclosing type if (invocationType.fPackage == this.fPackage) return true; - ReferenceBinding currentType = invocationType; - ReferenceBinding declaringClass = enclosingType(); // protected types always have an enclosing one + TypeBinding currentType = invocationType.erasure(); + TypeBinding declaringClass = enclosingType().erasure(); // protected types always have an enclosing one if (declaringClass == null) return false; // could be null if incorrect top-level protected type // int depth = 0; do { if (declaringClass == invocationType) return true; - if (declaringClass.isSuperclassOf(currentType)) return true; + if (currentType.findSuperTypeOriginatingFrom(declaringClass) != null) return true; // depth++; currentType = currentType.enclosingType(); } while (currentType != null);