Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 417017 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java (+32 lines)
Lines 2648-2652 Link Here
2648
		typeBinding = type.resolveBinding();
2648
		typeBinding = type.resolveBinding();
2649
		assertFalse("A Functional interface", typeBinding.isFunctionalInterface());
2649
		assertFalse("A Functional interface", typeBinding.isFunctionalInterface());
2650
	}
2650
	}
2651
	/**
2652
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=399793
2653
	 * 
2654
	 * @throws JavaModelException
2655
	 */
2656
	public void test417017() throws JavaModelException {
2657
		this.workingCopy = getWorkingCopy("/Converter18/src/test417017/X.java",
2658
				true/* resolve */);
2659
		String contents = "package test417017;"
2660
				+ "interface I {\n"
2661
				+ "	int foo(int x);\n"
2662
				+ "}\n" 
2663
				+ "public class X {\n"
2664
				+ " void fun(int a) {\n"
2665
				+"  	I i1 = x1-> x1;\n"
2666
				+"  	I i2 = xxx-> {\n"
2667
				+"  		i1.foo(a);\n"
2668
				+"  		return xxx;\n"
2669
				+"  	};\n"
2670
				+"  }\n"
2671
				+"}\n";
2672
		CompilationUnit cu = (CompilationUnit) buildAST(contents, this.workingCopy);
2673
		TypeDeclaration typedeclaration = (TypeDeclaration) getASTNode(cu, 1);
2674
		MethodDeclaration methodDeclaration = typedeclaration.getMethods()[0];
2675
		VariableDeclarationFragment vdf= (VariableDeclarationFragment) ((VariableDeclarationStatement) methodDeclaration.getBody().statements().get(1)).fragments().get(0);
2676
		LambdaExpression lambda= (LambdaExpression) vdf.getInitializer();
2677
		List parameters = lambda.parameters();
2678
		assertTrue("Incorrect Number of parameters", parameters.size() == 1);
2679
		ITypeBinding[] parameterTypes= lambda.resolveMethodBinding().getParameterTypes();
2680
//		assertTrue("Incorrect Number of parameter type", parameterTypes.length == 1);// Wrong - see the next line.
2681
		assertTrue("Incorrect Number of parameter type", parameterTypes.length == 3); // Right - 2 synthetic (OuterLocalVariable) + 1 normal
2682
	}
2651
2683
2652
}
2684
}

Return to bug 417017