Community
Participate
Working Groups
package org.eclipse.jdt.core.tests.compiler.regression;
import java.io.IOException;
import java.util.Map;
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=410114, [1.8] CCE when trying to parse method reference expression with inappropriate type arguments
public void test410114() throws IOException {
String source = "interface I {\n" +
" void foo(Y<String> y);\n" +
"}\n" +
"public class Y<T> {\n" +
" class Z<K> {\n" +
" Z(Y<String> y) {\n" +
" System.out.println(\"Y<T>.Z<K>:: new\");\n" +
" }\n" +
" void bar() {\n" +
" I i = Y<String>.Z<Integer>::<String> new;\n" +
" i.foo(new Y<String>());\n" +
" i = Y<String>.Z<Integer>:: new;\n" +
"}\n";
this.runNegativeTest(
new String[]{"Y.java",
source},
"----------\n" +
"1. WARNING in Y.java (at line 10)\n" +
" ^^^^^^\n" +
"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" +
"----------\n");
public static Class testClass() {
return NegativeLambdaExpressionsTest.class;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.NestedTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.PolyTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
ReferenceBinding[] enclosingInstances = Binding.UNINITIALIZED_REFERENCE_TYPES;
if (this.receiverType.isNestedType()) {
NestedTypeBinding nestedType = (NestedTypeBinding) this.receiverType;
NestedTypeBinding nestedType = null;
if (this.receiverType instanceof ParameterizedTypeBinding) {
nestedType = (NestedTypeBinding)((ParameterizedTypeBinding) this.receiverType).genericType();
} else {
nestedType = (NestedTypeBinding) this.receiverType;
if ((enclosingInstances = nestedType.syntheticEnclosingInstanceTypes()) != null) {
int length = enclosingInstances.length;