Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/UninitializedFieldsBeforeSuper.java
T
Tagir Valeevandintellij-monorepo-bot 2badea2d6a IDEA-387712 [java-highlighting] Java IDE highlight incorrectly handles JEP-513
Fields initialized in constructor before super call are initialized before access, even if the access happens before the constructor

GitOrigin-RevId: c996b5225d6c1f568c54fa0707d9aa4b58b7447e
2026-04-07 18:11:27 +00:00

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);
}
}