langtools/test/tools/javac/lambda/methodReference/MethodRefToInnerWithoutOuter.java
equal
deleted
inserted
replaced
|
1 /* |
|
2 * @test /nodynamiccopyright/ |
|
3 * @bug 8081271 |
|
4 * @summary NPE while compiling a program with erroneous use of constructor reference expressions. |
|
5 * @compile/fail/ref=MethodRefToInnerWithoutOuter.out -XDrawDiagnostics MethodRefToInnerWithoutOuter.java |
|
6 */ |
|
7 |
|
8 import java.util.List; |
|
9 import java.util.ArrayList; |
|
10 |
|
11 class MethodRefToInnerBase { |
|
12 class TestString { |
|
13 String str; |
|
14 TestString(String strin) { |
|
15 str = strin; |
|
16 } |
|
17 } |
|
18 } |
|
19 public class MethodRefToInnerWithoutOuter extends MethodRefToInnerBase { |
|
20 public static void main(String[] args) { |
|
21 List<String> list = new ArrayList<>(); |
|
22 list.stream().forEach(TestString::new); |
|
23 } |
|
24 } |