### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v retrieving revision 1.129 diff -u -r1.129 BinaryTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 2 Nov 2010 16:10:54 -0000 1.129 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 18 Nov 2010 06:08:07 -0000 @@ -570,8 +570,7 @@ int[] toSkip = null; if (iMethods != null) { total = initialTotal = iMethods.length; - boolean keepBridgeMethods = sourceLevel < ClassFileConstants.JDK1_5 - && this.environment.globalOptions.originalComplianceLevel >= ClassFileConstants.JDK1_5; + boolean keepBridgeMethods = sourceLevel < ClassFileConstants.JDK1_5; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=330347 for (int i = total; --i >= 0;) { IBinaryMethod method = iMethods[i]; if ((method.getModifiers() & ClassFileConstants.AccSynthetic) != 0) { #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.218 diff -u -r1.218 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 2 Nov 2010 16:19:38 -0000 1.218 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 18 Nov 2010 06:08:10 -0000 @@ -12019,4 +12019,55 @@ "", false /* do not flush output directory */); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=330347 - Test retention of bridge methods. +public void testBridgeMethodRetention(){ + String currentWorkingDirectoryPath = System.getProperty("user.dir"); + if (currentWorkingDirectoryPath == null) { + fail("BatchCompilerTest#testBridgeMethodRetention could not access the current working directory " + currentWorkingDirectoryPath); + } else if (!new File(currentWorkingDirectoryPath).isDirectory()) { + fail("BatchCompilerTest#testBridgeMethodRetention current working directory is not a directory " + currentWorkingDirectoryPath); + } + String lib1Path = currentWorkingDirectoryPath + File.separator + "lib1.jar"; + try { + Util.createJar( + new String[] { + "Comparable.java", + "public interface Comparable {\n" + + " public int compareTo(T o);\n" + + "}\n", + "Character.java", + "public class Character implements Comparable {\n" + + " public int compareTo(Character obj) {\n" + + " return 0;\n" + + " }\n" + + "}\n" + }, + null, + lib1Path, + JavaCore.VERSION_1_5); + this.runConformTest( + new String[] { + "src/X.java", + "public class X {\n" + + " Object fValue;\n" + + " public int compareTo(Object obj) {\n" + + " return ((Character)fValue).compareTo(obj);\n" + + " }\n" + + "}\n", + }, + "\"" + OUTPUT_DIR + File.separator + "src/X.java\"" + + " -cp lib1.jar" // relative + + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" + + " -1.4 -g -preserveAllLocals" + + " -proceedOnError -referenceInfo" + + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", + "", + "", + true); + } catch (IOException e) { + System.err.println("BatchCompilerTest#testBridgeMethodRetention could not write to current working directory " + currentWorkingDirectoryPath); + } finally { + new File(lib1Path).delete(); + } +} }