Java: don't generate uncompilable code in case of chained constructors (IDEA-342068)

in "Initialize in constructor" quick-fix

GitOrigin-RevId: 626d5ce6dfa823c0b1bd37c37c59edc1b45e03d6
This commit is contained in:
Bas Leijdekkers
2024-01-02 16:59:02 +01:00
committed by intellij-monorepo-bot
parent 415d6a8b56
commit 85598d6315
3 changed files with 37 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
// "Initialize in constructor" "true-preview"
class C {
private final int a;
private final int b;
C() {
this(1);
}
C(int a) {
this.a = a;
b = 0;
}
}

View File

@@ -0,0 +1,13 @@
// "Initialize in constructor" "true-preview"
class C {
private final int a;
private final int b<caret>;
C() {
this(1);
}
C(int a) {
this.a = a;
}
}