mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-24 00:44:37 +07:00
Fields initialized in constructor before super call are initialized before access, even if the access happens before the constructor GitOrigin-RevId: c996b5225d6c1f568c54fa0707d9aa4b58b7447e
26 lines
506 B
Java
26 lines
506 B
Java
class Test {
|
|
private final String foo;
|
|
private final String bar = foo;
|
|
|
|
public Test(String foo) {
|
|
this.foo = foo;
|
|
super();
|
|
}
|
|
|
|
static void main() {
|
|
System.out.println(new Test("test").bar);
|
|
}
|
|
}
|
|
class Test2 {
|
|
private final String foo;
|
|
private final String bar = <error descr="Variable 'foo' might not have been initialized">foo</error>;
|
|
|
|
public Test2(String foo) {
|
|
super();
|
|
this.foo = foo;
|
|
}
|
|
|
|
static void main() {
|
|
System.out.println(new Test2("test").bar);
|
|
}
|
|
} |