[java-inspections] Test for IDEA-253122 If field is annotated then constructor is...
authorTagir Valeev <tagir.valeev@jetbrains.com>
Thu, 21 Apr 2022 19:52:29 +0000 (21:52 +0200)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Thu, 21 Apr 2022 21:18:09 +0000 (21:18 +0000)
The issue itself is fixed by
IDEA-253887 "Redundant record constructor" inspection doesn't recognize the annotations

GitOrigin-RevId: adc11af845c764d2b2b8c0f507ca72537c17f618

java/java-tests/testData/inspection/classCanBeRecord/afterAnnotatedConstructor.java [new file with mode: 0644]
java/java-tests/testData/inspection/classCanBeRecord/beforeAnnotatedConstructor.java [new file with mode: 0644]

diff --git a/java/java-tests/testData/inspection/classCanBeRecord/afterAnnotatedConstructor.java b/java/java-tests/testData/inspection/classCanBeRecord/afterAnnotatedConstructor.java
new file mode 100644 (file)
index 0000000..bbb5f42
--- /dev/null
@@ -0,0 +1,6 @@
+// "Convert to a record" "true"
+import org.jetbrains.annotations.NotNull;
+
+public record Box(@NotNull Object object) {
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/classCanBeRecord/beforeAnnotatedConstructor.java b/java/java-tests/testData/inspection/classCanBeRecord/beforeAnnotatedConstructor.java
new file mode 100644 (file)
index 0000000..eb724be
--- /dev/null
@@ -0,0 +1,15 @@
+// "Convert to a record" "true"
+import org.jetbrains.annotations.NotNull;
+
+public final class <caret>Box {
+  private final @NotNull Object object;
+
+  public Box(@NotNull Object object) {
+    this.object = object;
+  }
+
+  public @NotNull Object object() {
+    return object;
+  }
+
+}
\ No newline at end of file