View | Details | Raw Unified | Return to bug 330347 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-2 / +1 lines)
Lines 570-577 Link Here
570
	int[] toSkip = null;
570
	int[] toSkip = null;
571
	if (iMethods != null) {
571
	if (iMethods != null) {
572
		total = initialTotal = iMethods.length;
572
		total = initialTotal = iMethods.length;
573
		boolean keepBridgeMethods = sourceLevel < ClassFileConstants.JDK1_5
573
		boolean keepBridgeMethods = sourceLevel < ClassFileConstants.JDK1_5; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=330347
574
			&& this.environment.globalOptions.originalComplianceLevel >= ClassFileConstants.JDK1_5;
575
		for (int i = total; --i >= 0;) {
574
		for (int i = total; --i >= 0;) {
576
			IBinaryMethod method = iMethods[i];
575
			IBinaryMethod method = iMethods[i];
577
			if ((method.getModifiers() & ClassFileConstants.AccSynthetic) != 0) {
576
			if ((method.getModifiers() & ClassFileConstants.AccSynthetic) != 0) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (+51 lines)
Lines 12019-12022 Link Here
12019
		"",
12019
		"",
12020
		false /* do not flush output directory */);
12020
		false /* do not flush output directory */);
12021
}
12021
}
12022
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=330347 - Test retention of bridge methods.
12023
public void testBridgeMethodRetention(){
12024
	String currentWorkingDirectoryPath = System.getProperty("user.dir");
12025
	if (currentWorkingDirectoryPath == null) {
12026
		fail("BatchCompilerTest#testBridgeMethodRetention could not access the current working directory " + currentWorkingDirectoryPath);
12027
	} else if (!new File(currentWorkingDirectoryPath).isDirectory()) {
12028
		fail("BatchCompilerTest#testBridgeMethodRetention current working directory is not a directory " + currentWorkingDirectoryPath);
12029
	}
12030
	String lib1Path = currentWorkingDirectoryPath + File.separator + "lib1.jar";
12031
	try {
12032
		Util.createJar(
12033
				new String[] {
12034
						"Comparable.java",
12035
						"public interface Comparable<T> {\n" +
12036
						"    public int compareTo(T o);\n" +
12037
						"}\n",
12038
						"Character.java",
12039
						"public class Character implements Comparable<Character> {\n" +
12040
						"	public int compareTo(Character obj) {\n" +
12041
						"		return 0;\n" +
12042
						"	}\n" +
12043
						"}\n"
12044
				},
12045
				null,
12046
				lib1Path,
12047
				JavaCore.VERSION_1_5);
12048
		this.runConformTest(
12049
				new String[] {
12050
						"src/X.java",
12051
						"public class X {\n" +
12052
						"    Object fValue;\n" +
12053
						"    public int compareTo(Object obj) {\n" +
12054
						"            return ((Character)fValue).compareTo(obj);\n" +
12055
						"    }\n" +
12056
						"}\n",
12057
				},
12058
				"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
12059
				+ " -cp lib1.jar" // relative
12060
				+ " -sourcepath \"" + OUTPUT_DIR +  File.separator + "src\""
12061
				+ " -1.4 -g -preserveAllLocals"
12062
				+ " -proceedOnError -referenceInfo"
12063
				+ " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
12064
		        "",
12065
		        "",
12066
		        true);
12067
	} catch (IOException e) {
12068
		System.err.println("BatchCompilerTest#testBridgeMethodRetention could not write to current working directory " + currentWorkingDirectoryPath);
12069
	} finally {
12070
		new File(lib1Path).delete();
12071
	}
12072
}
12022
}
12073
}

Return to bug 330347