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
25
test/langtools/tools/javac/DefiniteAssignment/DASwitch.java
Normal file
25
test/langtools/tools/javac/DefiniteAssignment/DASwitch.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 4695463
|
||||
* @summary DA versus switch: javac allows reference to uninitialized variable
|
||||
* @author Neal Gafter (gafter)
|
||||
*
|
||||
* @compile/fail/ref=DASwitch.out -XDrawDiagnostics DASwitch.java
|
||||
*/
|
||||
|
||||
public class DASwitch {
|
||||
public static void meth() {
|
||||
int t = 1;
|
||||
{
|
||||
final int x;
|
||||
x = 1;
|
||||
}
|
||||
switch(t) {
|
||||
case 0:
|
||||
Integer b;
|
||||
break;
|
||||
case 1:
|
||||
System.out.println(b.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue