Error highlighting for records: check that fields are initialized in canonical constructor (8.10.4) IDEA-228460

GitOrigin-RevId: 6b1cc0b27cc34a6b1f975316a667d606d6dd6a7b
This commit is contained in:
Tagir Valeev
2019-12-18 10:32:28 +00:00
committed by intellij-monorepo-bot
parent 811b8fca50
commit f29de7206f
6 changed files with 69 additions and 2 deletions
@@ -18,6 +18,7 @@ record TypeMismatch<T>(T t) {
record Delegate(int x) {
public Delegate(int x) {
<error descr="Canonical constructor cannot delegate to another constructor">this()</error>;
this.x = 0;
}
public <error descr="Non-canonical record constructor must delegate to another constructor">Delegate</error>() {
@@ -26,4 +27,12 @@ record Delegate(int x) {
public <error descr="Non-canonical record constructor must delegate to another constructor">Delegate</error>(int x, int y) {
super();
}
}
record NotInitializedField(int <error descr="Record component 'x' might not be initialized in canonical constructor">x</error>,
int <error descr="Record component 'y' might not be initialized in canonical constructor">y</error>,
int z) {
public NotInitializedField(int x, int y, int z) {
if (Math.random() > 0.5) this.y = y;
this.z = z;
}
}