mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-230380 Assignments to record components are erroneously allowed in non-canonical constructors
GitOrigin-RevId: 4a427ce68ddfbd9b2d274c131a42e40e02f306f7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5724865d36
commit
c7557bba96
+11
-1
@@ -35,7 +35,7 @@ record VarArgMismatch2(int[] x) {
|
||||
record Delegate(int x) {
|
||||
public Delegate(int x) {
|
||||
<error descr="Canonical constructor cannot delegate to another constructor">this()</error>;
|
||||
this.x = 0;
|
||||
<error descr="Variable 'x' might already have been assigned to">this.x</error> = 0;
|
||||
}
|
||||
|
||||
public <error descr="Non-canonical record constructor must delegate to another constructor">Delegate</error>() {
|
||||
@@ -57,4 +57,14 @@ record ImplicitCanonicalConstructor(String s) {
|
||||
static void test() {
|
||||
new ImplicitCanonicalConstructor("Asdasd");
|
||||
}
|
||||
}
|
||||
record AssignmentInNonCanonical(int x, int y, long depth) {
|
||||
public AssignmentInNonCanonical(int x, int y) {
|
||||
this(x, y, 10);
|
||||
<error descr="Variable 'x' might already have been assigned to">this.x</error> = x;
|
||||
}
|
||||
|
||||
void method() {
|
||||
<error descr="Cannot assign a value to final variable 'x'">this.x</error> = 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user