mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
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:
parent
63dc40184a
commit
4815781a4a
7 changed files with 36 additions and 12 deletions
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue