Java: fix error message when assignment before chained constructor call (IDEA-375281)

(cherry picked from commit 49c4a8ce04845726d1c35aa114612bf5410e1a37)


(cherry picked from commit 65c5e6c26545cad86d03d71f9d1ab818b4f8e1af)

IJ-MR-169535

GitOrigin-RevId: 099919c02438d74a307aa939f2128ad00aac15f9
This commit is contained in:
Bas Leijdekkers
2025-07-11 14:16:26 +02:00
committed by intellij-monorepo-bot
parent 0321ccb557
commit 7737d87729
3 changed files with 25 additions and 2 deletions

View File

@@ -211,4 +211,19 @@ class Person {
}
class Other {
Other(int x) {}
}
class Machine {
private final boolean big;
Machine(boolean big) {
this.big = big;
}
Machine() {
<error descr="Cannot assign final field 'big' before chained constructor call">big</error> = false;
this(false);
}
Machine(int size) {
this(<error descr="Cannot assign final field 'big' before chained constructor call">big</error> = size > 10);
}
}