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
72
test/langtools/tools/javac/SuperInit/NewLocalNotInInner.java
Normal file
72
test/langtools/tools/javac/SuperInit/NewLocalNotInInner.java
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8373570
|
||||
* @summary Javac stack overflow on method-local class with nested record referring to enclosing type
|
||||
* @compile/fail/ref=NewLocalNotInInner.out -XDrawDiagnostics NewLocalNotInInner.java
|
||||
*/
|
||||
class NewLocalNotInInner {
|
||||
void m() {
|
||||
class Local {
|
||||
static class Foo {
|
||||
void m() {
|
||||
new Local(); // error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void m_anon() {
|
||||
class Local {
|
||||
static class Foo {
|
||||
void m() {
|
||||
new Local() { }; // error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void m_record() {
|
||||
class Local {
|
||||
record Foo() {
|
||||
void m() {
|
||||
new Local(); // error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void m_intf() {
|
||||
class Local {
|
||||
interface Foo {
|
||||
default void m() {
|
||||
new Local(); // error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sup() {
|
||||
class Local {
|
||||
static class Foo {
|
||||
void m() {
|
||||
class Sub extends Local { }; // error
|
||||
new Sub();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void staticLocal() {
|
||||
class Local { }
|
||||
new Local(); // ok
|
||||
}
|
||||
|
||||
static void staticLocalFromAnon() {
|
||||
class Local { }
|
||||
new Object() {
|
||||
Local local() {
|
||||
return new Local(); // ok
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue