mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 09:04:41 +02:00
8053906: javac is accepting a self-referencing variable initializer inside a lambda expression
Reviewed-by: jlahoda
This commit is contained in:
parent
966fc670ee
commit
8a2078e8a3
11 changed files with 102 additions and 122 deletions
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8053906
|
||||
* @summary javac, some lambda programs are rejected by flow analysis
|
||||
* @compile/fail/ref=SelfInitializerInLambdaTestc.out -XDrawDiagnostics SelfInitializerInLambdaTestc.java
|
||||
*/
|
||||
|
||||
public class SelfInitializerInLambdaTestc {
|
||||
interface SAM {
|
||||
void foo();
|
||||
}
|
||||
|
||||
final SAM notInitialized = ()-> {
|
||||
SAM simpleVariable = () -> notInitialized.foo();
|
||||
};
|
||||
|
||||
final SAM notInitialized2 = ()-> {
|
||||
SAM simpleVariable1 = () -> {
|
||||
SAM simpleVariable2 = () -> {
|
||||
SAM simpleVariable3 = () -> {
|
||||
SAM simpleVariable4 = () -> notInitialized2.foo();
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue