8081271: NPE while compiling a program with erroneous use of constructor reference expressions

Missing enclosing instance error should not be swallowed when attributing constructor reference expressions.

Reviewed-by: mcimadamore, vromero
This commit is contained in:
Srikanth Adayapalam 2015-05-29 09:15:42 +05:30
parent 63dc40184a
commit 4815781a4a
7 changed files with 36 additions and 12 deletions

View file

@ -0,0 +1,24 @@
/*
* @test /nodynamiccopyright/
* @bug 8081271
* @summary NPE while compiling a program with erroneous use of constructor reference expressions.
* @compile/fail/ref=MethodRefToInnerWithoutOuter.out -XDrawDiagnostics MethodRefToInnerWithoutOuter.java
*/
import java.util.List;
import java.util.ArrayList;
class MethodRefToInnerBase {
class TestString {
String str;
TestString(String strin) {
str = strin;
}
}
}
public class MethodRefToInnerWithoutOuter extends MethodRefToInnerBase {
public static void main(String[] args) {
List<String> list = new ArrayList<>();
list.stream().forEach(TestString::new);
}
}