undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8024809
|
||||
* @summary javac, some lambda programs are rejected by flow analysis
|
||||
* @compile/fail/ref=SelfInitializerInLambdaTesta.out -XDrawDiagnostics SelfInitializerInLambdaTesta.java
|
||||
*/
|
||||
|
||||
public class SelfInitializerInLambdaTesta {
|
||||
|
||||
final Runnable r1 = ()->System.out.println(r1);
|
||||
|
||||
final Object lock = new Object();
|
||||
|
||||
final Runnable r2 = ()->{
|
||||
System.out.println(r2);
|
||||
synchronized (lock){}
|
||||
};
|
||||
|
||||
final Runnable r3 = ()->{
|
||||
synchronized (lock){
|
||||
System.out.println(r3);
|
||||
}
|
||||
};
|
||||
|
||||
final Runnable r4 = ()->{
|
||||
System.out.println(r4);
|
||||
};
|
||||
|
||||
interface SAM {
|
||||
int m(String s);
|
||||
}
|
||||
|
||||
final SAM s1 = (String s)->{
|
||||
System.out.println(s + s1.toString());
|
||||
return 0;
|
||||
};
|
||||
|
||||
final SAM s2 = (s)->{
|
||||
System.out.println(s + s2.toString());
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
SelfInitializerInLambdaTesta.java:10:48: compiler.err.illegal.self.ref
|
||||
SelfInitializerInLambdaTesta.java:15:28: compiler.err.illegal.self.ref
|
||||
SelfInitializerInLambdaTesta.java:21:32: compiler.err.illegal.self.ref
|
||||
SelfInitializerInLambdaTesta.java:26:28: compiler.err.illegal.self.ref
|
||||
SelfInitializerInLambdaTesta.java:34:32: compiler.err.illegal.self.ref
|
||||
SelfInitializerInLambdaTesta.java:39:32: compiler.err.illegal.self.ref
|
||||
6 errors
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8024809
|
||||
* @summary javac, some lambda programs are rejected by flow analysis
|
||||
* @compile/fail/ref=SelfInitializerInLambdaTestb.out -XDrawDiagnostics SelfInitializerInLambdaTestb.java
|
||||
*/
|
||||
|
||||
public class SelfInitializerInLambdaTestb {
|
||||
|
||||
final Runnable r1;
|
||||
|
||||
final Runnable r2 = ()-> System.out.println(r1);
|
||||
|
||||
SelfInitializerInLambdaTestb() {
|
||||
r1 = ()->System.out.println(r1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
SelfInitializerInLambdaTestb.java:12:49: compiler.err.var.might.not.have.been.initialized: r1
|
||||
SelfInitializerInLambdaTestb.java:15:37: compiler.err.var.might.not.have.been.initialized: r1
|
||||
2 errors
|
||||
Loading…
Add table
Add a link
Reference in a new issue