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 410114
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java (+29 lines)
Lines 22-25 Link Here
22
package org.eclipse.jdt.core.tests.compiler.regression;
22
package org.eclipse.jdt.core.tests.compiler.regression;
23
23
24
import java.io.IOException;
24
import java.util.Map;
25
import java.util.Map;
25
26
Lines 6663-6666 Link Here
6663
	);
6664
	);
6664
}
6665
}
6666
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=410114, [1.8] CCE when trying to parse method reference expression with inappropriate type arguments
6667
public void test410114() throws IOException {
6668
	String source = "interface I {\n" +
6669
					"    void foo(Y<String> y);\n" +
6670
					"}\n" +
6671
					"public class Y<T> {\n" +
6672
					"    class Z<K> {\n" +
6673
					"        Z(Y<String> y) {\n" +
6674
					"            System.out.println(\"Y<T>.Z<K>:: new\");\n" +
6675
					"        }\n" +
6676
					"        void bar() {\n" +
6677
					"            I i = Y<String>.Z<Integer>::<String> new;\n" +
6678
					"            i.foo(new Y<String>());\n" +
6679
					"            i = Y<String>.Z<Integer>:: new;\n" +
6680
					"            i.foo(new Y<String>());\n" +
6681
					"        }\n" +
6682
					"    }\n" +
6683
					"}\n";
6684
	this.runNegativeTest(
6685
			new String[]{"Y.java",
6686
						source},
6687
						"----------\n" + 
6688
						"1. WARNING in Y.java (at line 10)\n" + 
6689
						"	I i = Y<String>.Z<Integer>::<String> new;\n" + 
6690
						"	                             ^^^^^^\n" + 
6691
						"Unused type arguments for the non generic constructor Y<String>.Z<Integer>(Y<String>) of type Y<String>.Z<Integer>; it should not be parameterized with arguments <String>\n" + 
6692
						"----------\n");
6693
}
6665
public static Class testClass() {
6694
public static Class testClass() {
6666
	return NegativeLambdaExpressionsTest.class;
6695
	return NegativeLambdaExpressionsTest.class;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java (-1 / +7 lines)
Lines 41-44 Link Here
41
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
41
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
42
import org.eclipse.jdt.internal.compiler.lookup.NestedTypeBinding;
42
import org.eclipse.jdt.internal.compiler.lookup.NestedTypeBinding;
43
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
43
import org.eclipse.jdt.internal.compiler.lookup.PolyTypeBinding;
44
import org.eclipse.jdt.internal.compiler.lookup.PolyTypeBinding;
44
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
45
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
Lines 117-121 Link Here
117
				ReferenceBinding[] enclosingInstances = Binding.UNINITIALIZED_REFERENCE_TYPES;
118
				ReferenceBinding[] enclosingInstances = Binding.UNINITIALIZED_REFERENCE_TYPES;
118
				if (this.receiverType.isNestedType()) {
119
				if (this.receiverType.isNestedType()) {
119
					NestedTypeBinding nestedType = (NestedTypeBinding) this.receiverType;
120
					NestedTypeBinding nestedType = null;
121
					if (this.receiverType instanceof ParameterizedTypeBinding) {
122
						nestedType = (NestedTypeBinding)((ParameterizedTypeBinding) this.receiverType).genericType();
123
					} else {
124
						nestedType = (NestedTypeBinding) this.receiverType;
125
					}
120
					if ((enclosingInstances = nestedType.syntheticEnclosingInstanceTypes()) != null) {
126
					if ((enclosingInstances = nestedType.syntheticEnclosingInstanceTypes()) != null) {
121
						int length = enclosingInstances.length;
127
						int length = enclosingInstances.length;

Return to bug 410114