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

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DefaultMethodsTest.java (-1 / +23 lines)
Lines 217-223 Link Here
217
			"default"
217
			"default"
218
			);
218
			);
219
	}
219
	}
220
	
220
221
	// class implements interface with default method. 
222
	// - witness for NoSuchMethodError in synthetic method (SuperMethodAccess)
223
	public void testModifiers5a() {
224
		runConformTest(
225
			new String[] {
226
				"C.java",
227
				"interface I {\n" +
228
				"    public void foo() default {\n" +
229
				"        System.out.println(\"default\");\n" +
230
				"    }\n" +
231
				"}\n" +
232
				"public class C implements I {\n" +
233
				"    public static void main(String[] args) {\n" +
234
				"        C c = new C();\n" +
235
				"        c.foo();\n" +
236
				"    }\n" +
237
				"}\n"
238
			},
239
			"default"
240
			);
241
	}
242
221
	// class implements interface with default method. 
243
	// class implements interface with default method. 
222
	// - no need to implement this interface method as it is not abstract, but other abstract method exists
244
	// - no need to implement this interface method as it is not abstract, but other abstract method exists
223
	public void testModifiers6() {
245
	public void testModifiers6() {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-2 / +4 lines)
Lines 2582-2589 Link Here
2582
				|| accessMethod.purpose == SyntheticMethodBinding.SuperMethodAccess){
2582
				|| accessMethod.purpose == SyntheticMethodBinding.SuperMethodAccess){
2583
			// target method declaring class may not be accessible (247953);
2583
			// target method declaring class may not be accessible (247953);
2584
			TypeBinding declaringClass = accessMethod.purpose == SyntheticMethodBinding.SuperMethodAccess 
2584
			TypeBinding declaringClass = accessMethod.purpose == SyntheticMethodBinding.SuperMethodAccess 
2585
					? accessMethod.declaringClass.superclass() 
2585
					? (targetMethod.isDefaultMethod()
2586
					: accessMethod.declaringClass;				
2586
							? targetMethod.declaringClass
2587
							: accessMethod.declaringClass.superclass())
2588
					: accessMethod.declaringClass;
2587
			invoke(Opcodes.OPC_invokespecial, targetMethod, declaringClass);
2589
			invoke(Opcodes.OPC_invokespecial, targetMethod, declaringClass);
2588
		} else {
2590
		} else {
2589
			if (targetMethod.declaringClass.isInterface()) { // interface or annotation type
2591
			if (targetMethod.declaringClass.isInterface()) { // interface or annotation type

Return to bug 400710