### 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.682 diff -u -r1.682 GenericTypeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 23 Jan 2008 12:14:43 -0000 1.682 +++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 23 Jan 2008 15:07:47 -0000 @@ -41484,4 +41484,109 @@ }, ""); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216100 +public void test1243() { + this.runConformTest( + new String[] { + "eclipse/modifier/impl/EclipseModifierBug.java", + "package eclipse.modifier.impl;\n" + + "import eclipse.modifier.Pool;\n" + + "public class EclipseModifierBug {\n" + + " static class MyEntry extends Pool.AbstractEntry { } \n" + + " static final Pool pool=new Pool() {\n" + + " @Override\n" + + " protected MyEntry delegate() {\n" + + " return new MyEntry();\n" + + " } \n" + + " };\n" + + " public static void main(String[] args) {\n" + + " MyEntry entry=pool.m(); \n" + + " }\n" + + "}", // ================= + "eclipse/modifier/Pool.java", + "package eclipse.modifier;\n" + + "public abstract class Pool> {\n" + + " static abstract class Entry> {\n" + + " E next;\n" + + " }\n" + + " static public class AbstractEntry> extends Entry {\n" + + " }\n" + + " public E m() {\n" + + " return delegate();\n" + + " }\n" + + " protected abstract E delegate();\n" + + " }\n" + + "\n", // ================= + }, + ""); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216100 - variation +public void test1244() { + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " static class MyEntry extends Pool.AbstractEntry { } \n" + + " static final Pool pool=new Pool() {\n" + + " @Override\n" + + " protected MyEntry delegate() {\n" + + " return new MyEntry();\n" + + " } \n" + + " };\n" + + " public static void main(String[] args) {\n" + + " MyEntry entry=pool.m();\n" + + " }\n" + + "}\n" + + "\n" + + "abstract class Pool> {\n" + + " private static abstract class Entry> {\n" + + " E next;\n" + + " }\n" + + " static public class AbstractEntry> extends Entry {\n" + + " }\n" + + " public E m() {\n" + + " System.out.println(\"SUCCESS\");\n" + + " return delegate();\n" + + " }\n" + + " protected abstract E delegate();\n" + + "}\n", // ================= + + }, + "SUCCESS"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216100 - variation +public void test1245() { + this.runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + "}\n" + + "class Secondary {\n" + + " static private class Private {}\n" + + "}\n", // ================= + }, + "----------\n" + + "1. ERROR in X.java (at line 1)\n" + + " public class X {\n" + + " ^^^^^^^^^^^^^^^^^\n" + + "The type Secondary.Private is not visible\n" + + "----------\n" + + "2. WARNING in X.java (at line 4)\n" + + " static private class Private {}\n" + + " ^^^^^^^\n" + + "The type Secondary.Private is never used locally\n" + + "----------\n"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216100 - variation +public void test1246() { + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " static private class Private {}\n" + + " void foo(U u) {}\n" + + "}\n", // ================= + }, + ""); +} } #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java,v retrieving revision 1.160 diff -u -r1.160 CodeStream.java --- compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java 16 Nov 2007 13:53:36 -0000 1.160 +++ compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java 23 Jan 2008 15:07:51 -0000 @@ -2519,8 +2519,10 @@ break; default : TypeBinding accessErasure = accessMethod.returnType.erasure(); - if (!targetMethod.returnType.isCompatibleWith(accessErasure)) + TypeBinding match = targetMethod.returnType.findSuperTypeOriginatingFrom(accessErasure); + if (match == null) { this.checkcast(accessErasure); // for bridge methods + } this.areturn(); } }