-
Bug
-
Resolution: Fixed
-
P3
-
9
-
b120
-
Verified
Since the fix for JDK-8078093 there has been a regression in the behavior for stuck expressions. For example, this program fails to compile:
import java.util.function.Consumer;
import java.nio.ByteBuffer;
class Foo {
Foo(Consumer<ByteBuffer> cb) {
}
public static void main(String[] args) {
Foo foo = new Foo((b -> System.out.println(asString(b))));
}
static String asString(ByteBuffer buf) {
return null;
}
}
But compiles if the parenthesis are removed from around the lambda.
Also, this other program:
interface Foo1 {
Object m(String s);
}
interface Foo2 {
String m(String s);
}
class Test {
void m(Foo1 f1) { }
void m(Foo2 f2) { }
void test() {
m(x->"");
m((x->""));
}
}
Only reports one ambiguity error instead of two.
import java.util.function.Consumer;
import java.nio.ByteBuffer;
class Foo {
Foo(Consumer<ByteBuffer> cb) {
}
public static void main(String[] args) {
Foo foo = new Foo((b -> System.out.println(asString(b))));
}
static String asString(ByteBuffer buf) {
return null;
}
}
But compiles if the parenthesis are removed from around the lambda.
Also, this other program:
interface Foo1 {
Object m(String s);
}
interface Foo2 {
String m(String s);
}
class Test {
void m(Foo1 f1) { }
void m(Foo2 f2) { }
void test() {
m(x->"");
m((x->""));
}
}
Only reports one ambiguity error instead of two.
- relates to
-
JDK-8078093 Severe compiler performance regression Java 7 to 8 for nested method invocations
-
- Closed
-
-
JDK-8195598 Reference to overloaded method is ambiguous with 3 methods but works with 2
-
- Resolved
-