[java-intentions] Implement quick-fix to create record from deconstruction pattern, if the identifier is unresolved

IDEA-303300

GitOrigin-RevId: f4cd752f81987885a72b5da8d898f875a5198dcb
This commit is contained in:
Andrey.Cherkasov
2022-10-10 19:40:42 +04:00
committed by intellij-monorepo-bot
parent 82f6661d34
commit 375b7b102f
20 changed files with 297 additions and 63 deletions

View File

@@ -0,0 +1,12 @@
// "Create record 'Point'" "true-preview"
class Test {
void foo(Object obj) {
switch (obj) {
case Point(double x, double y) -> {}
default -> {}
}
}
}
public record Point(double x, double y) {
}

View File

@@ -0,0 +1,12 @@
// "Create record 'Point'" "true-preview"
class Test {
void foo(Object obj) {
switch (obj) {
case Point(double x, double y) -> {}
default -> {}
}
}
}
public record Point(double x, double y) {
}

View File

@@ -0,0 +1,12 @@
// "Create record 'Rect'" "true-preview"
class Test {
void foo(Object obj) {
switch (obj) {
case Rect(Point point1, Point(double x, double y)) -> {}
default -> {}
}
}
}
public record Rect(Point point1, Point point) {
}

View File

@@ -0,0 +1,9 @@
// "Create record 'Point'" "true-preview"
class Test {
void foo(Object obj) {
switch (obj) {
case Poi<caret>nt(double x, double y) -> {}
default -> {}
}
}
}

View File

@@ -0,0 +1,9 @@
// "Create record 'Point'" "true-preview"
class Test {
void foo(Object obj) {
switch (obj) {
case Poi<caret>nt(double x, double y) -> {}
default -> {}
}
}
}

View File

@@ -0,0 +1,9 @@
// "Create record 'Rect'" "true-preview"
class Test {
void foo(Object obj) {
switch (obj) {
case Re<caret>ct(Point point1, Point(double x, double y)) -> {}
default -> {}
}
}
}

View File

@@ -0,0 +1,2 @@
public record Point(double x, double y) {
}

View File

@@ -0,0 +1,2 @@
public record Point(double x, double y) {
}

View File

@@ -0,0 +1,2 @@
public record Rect(Point point1, Point point) {
}