예시 1:
record Point(int x, int y) {
public Point {} // 제거 가능합니다
}
record Point(int x, int y) {
public Point(int x, int y) { // 제거 가능합니다
this.x = x;
this.y = y;
}
}
빠른 수정에서는 불필요한 생성자를 제거합니다.
예시 2:
// 간결한 생성자로 변환 가능합니다
record Range(int from, int to) {
public Range(int from, int to) {
if (from > to) throw new IllegalArgumentException();
this.from = from;
this.to = to;
}
}
빠른 수정에서는 이 코드를 간결한 생성자로 변환합니다.
2020.1의 새로운 기능