IDEA-229842 Convert compact constructor to canonical

GitOrigin-RevId: 6edd200e51ec300bf1068d2f040b837fea3f6e1f
This commit is contained in:
Tagir Valeev
2020-01-21 11:08:24 +00:00
committed by intellij-monorepo-bot
parent d0f72f2f02
commit b936699772
11 changed files with 188 additions and 0 deletions
@@ -0,0 +1,22 @@
// "Convert compact constructor to canonical" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
public record Test(int x, @ParamAnno int y, @FieldAnno int... other) {
@ConstructorAnno
public Test(int x, @ParamAnno int y, int... other) {
this.x = Math.abs(x);
if (other == null) other = new int[0];
this.y = y;
this.other = other;
}
}
@Target(ElementType.PARAMETER)
@interface ParamAnno {}
@Target(ElementType.FIELD)
@interface FieldAnno {}
@Target(ElementType.CONSTRUCTOR)
@interface ConstructorAnno {}
@@ -0,0 +1,10 @@
// "Convert compact constructor to canonical" "true"
record R(int x,int y) {
/*
hello
*/
public R(int x, int y) {<caret>
this.x = x;
this.y = y;
}
}
@@ -0,0 +1,20 @@
// "Convert compact constructor to canonical" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
public record Test(int x, @ParamAnno int y, @FieldAnno int... other) {
@ConstructorAnno
<caret>public Test {
this.x = Math.abs(x);
if (other == null) other = new int[0];
}
}
@Target(ElementType.PARAMETER)
@interface ParamAnno {}
@Target(ElementType.FIELD)
@interface FieldAnno {}
@Target(ElementType.CONSTRUCTOR)
@interface ConstructorAnno {}
@@ -0,0 +1,8 @@
// "Convert compact constructor to canonical" "true"
record R(int x,int y) {
/*
hello
*/
public R {<caret>
}
}