d80d478182
Reviewed-by: vromero
33 lines
693 B
Java
33 lines
693 B
Java
/*
|
|
* @test /nodynamiccopyright/
|
|
* @bug 8328649
|
|
* @summary Verify local classes in constructor prologues don't have enclosing instances
|
|
* @compile/fail/ref=LocalClassCtorPrologue.out -XDrawDiagnostics LocalClassCtorPrologue.java
|
|
* @enablePreview
|
|
*/
|
|
|
|
class LocalClassCtorPrologue {
|
|
|
|
int x;
|
|
|
|
LocalClassCtorPrologue() {
|
|
class Local {
|
|
{
|
|
x++; // this should fail
|
|
}
|
|
}
|
|
super();
|
|
}
|
|
|
|
public class Inner {
|
|
public Inner() {
|
|
class Local {
|
|
{
|
|
x++; // this should work
|
|
}
|
|
};
|
|
super();
|
|
}
|
|
}
|
|
}
|