View | Details | Raw Unified | Return to bug 339447
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java (-2 / +2 lines)
Lines 231-237 Link Here
231
	    this.selector = overridenMethodToBridge.selector;
231
	    this.selector = overridenMethodToBridge.selector;
232
	    // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794)
232
	    // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794)
233
	    // also use the modifiers from the target method, as opposed to inherited one (147690)
233
	    // also use the modifiers from the target method, as opposed to inherited one (147690)
234
	    this.modifiers = (targetMethod.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccNative  | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature);
234
	    this.modifiers = (targetMethod.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccSynchronized | ClassFileConstants.AccAbstract | ClassFileConstants.AccNative  | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature);
235
		this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
235
		this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
236
	    this.returnType = overridenMethodToBridge.returnType;
236
	    this.returnType = overridenMethodToBridge.returnType;
237
	    this.parameters = overridenMethodToBridge.parameters;
237
	    this.parameters = overridenMethodToBridge.parameters;
Lines 299-305 Link Here
299
	    this.selector = overridenMethodToBridge.selector;
299
	    this.selector = overridenMethodToBridge.selector;
300
	    // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794)
300
	    // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794)
301
	    // also use the modifiers from the target method, as opposed to inherited one (147690)
301
	    // also use the modifiers from the target method, as opposed to inherited one (147690)
302
	    this.modifiers = (overridenMethodToBridge.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccNative  | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature);
302
	    this.modifiers = (overridenMethodToBridge.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccSynchronized | ClassFileConstants.AccAbstract | ClassFileConstants.AccNative  | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature);
303
		this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
303
		this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
304
	    this.returnType = overridenMethodToBridge.returnType;
304
	    this.returnType = overridenMethodToBridge.returnType;
305
	    this.parameters = overridenMethodToBridge.parameters;
305
	    this.parameters = overridenMethodToBridge.parameters;
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-1 / +29 lines)
Lines 27-33 Link Here
27
27
28
public class MethodVerifyTest extends AbstractComparableTest {
28
public class MethodVerifyTest extends AbstractComparableTest {
29
	static {
29
	static {
30
//		TESTS_NAMES = new String[] { "test331446" };
30
//		TESTS_NAMES = new String[] { "test339447" };
31
//		TESTS_NUMBERS = new int[] { 213 };
31
//		TESTS_NUMBERS = new int[] { 213 };
32
//		TESTS_RANGE = new int[] { 190, -1};
32
//		TESTS_RANGE = new int[] { 190, -1};
33
	}
33
	}
Lines 11968-11971 Link Here
11968
		compilerOptions14,
11968
		compilerOptions14,
11969
		null);
11969
		null);
11970
}
11970
}
11971
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=339447
11972
public void test339447() throws Exception {
11973
	this.runConformTest(
11974
		new String[] {
11975
			"X.java",
11976
			"public class X implements Cloneable {\n" + 
11977
			"	public synchronized X clone() {\n" + 
11978
			"		return this;\n" + 
11979
			"	}\n" + 
11980
			"}", // =================
11981
		},
11982
		"");
11983
	// 	ensure bridge methods have target method modifiers, and inherited thrown exceptions
11984
	String expectedOutput =
11985
			"  public bridge synthetic java.lang.Object clone() throws java.lang.CloneNotSupportedException;";
11986
11987
	File f = new File(OUTPUT_DIR + File.separator + "X.class");
11988
	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
11989
	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
11990
	String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
11991
	int index = result.indexOf(expectedOutput);
11992
	if (index == -1 || expectedOutput.length() == 0) {
11993
		System.out.println(Util.displayString(result, 3));
11994
	}
11995
	if (index == -1) {
11996
		assertEquals("Wrong contents", expectedOutput, result);
11997
	}
11998
}
11971
}
11999
}

Return to bug 339447