Error highlighting for records: compact constructors (8.10.5) IDEA-228460

GitOrigin-RevId: d2ffbe570a06768989e48bf88eaf503a847574d4
This commit is contained in:
Tagir Valeev
2019-12-18 11:37:51 +00:00
committed by intellij-monorepo-bot
parent 662cb5deae
commit 53986a2bd7
9 changed files with 77 additions and 15 deletions
@@ -1,5 +1,51 @@
class NotRecord {
public <error descr="Parameter list expected">NotRecord</error> {
}
}
record NonPublic(int x) {
<error descr="Compact constructor must be 'public'">NonPublic</error> {
}
}
record Throws(int x) {
public Throws<error descr="Identifier expected"> </error><error descr="Unexpected token">throws</error> <error descr="Invalid method declaration; return type required">Throwable</error> {}
}
record Generic() {
public <error descr="Canonical constructor cannot have type parameters"><T></error> Generic() {}
}
record Delegate(int x) {
public Delegate {
<error descr="Canonical constructor cannot delegate to another constructor">this("")</error>;
}
<error descr="Non-canonical record constructor must delegate to another constructor">Delegate</error>(String s) {
}
}
record ReturnInCompact(int x) {
public ReturnInCompact {
if (Math.random() > 0.5) <error descr="'return' statement is not allowed in compact constructor">return;</error>
}
}
record NotInitialized(int x,
int <error descr="Record component 'y' might not be initialized in canonical constructor">y</error>,
int z) {
public NotInitialized {
this.x = 0;
if (Math.random() > 0.5) this.y = 1;
}
}
record TwoCompacts(int x, int y) {
<error descr="'TwoCompacts()' is already defined in 'TwoCompacts'">public TwoCompacts </error>{}
<error descr="'TwoCompacts()' is already defined in 'TwoCompacts'">public TwoCompacts </error>{}
}
record CompactAndCanonical(int x, int y) {
// TODO
public CompactAndCanonical(int x, int y) {
this.x = x;
this.y = y;
}
public CompactAndCanonical {
}
}