From 84556ebb00af1817d521bc011333a0ed02162cc4 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Tue, 30 Jun 2020 17:22:38 +0200 Subject: [fixes #2433] Add config key to turn off @SuppressWarnings("all") --- .../after-delombok/SkipSuppressWarnings.java | 24 +++++++++++++++++++ .../resource/after-ecj/SkipSuppressWarnings.java | 27 ++++++++++++++++++++++ .../resource/before/SkipSuppressWarnings.java | 9 ++++++++ .../SkipSuppressWarnings.java.messages | 1 + 4 files changed, 61 insertions(+) create mode 100644 test/transform/resource/after-delombok/SkipSuppressWarnings.java create mode 100644 test/transform/resource/after-ecj/SkipSuppressWarnings.java create mode 100644 test/transform/resource/before/SkipSuppressWarnings.java create mode 100644 test/transform/resource/messages-ecj/SkipSuppressWarnings.java.messages (limited to 'test') diff --git a/test/transform/resource/after-delombok/SkipSuppressWarnings.java b/test/transform/resource/after-delombok/SkipSuppressWarnings.java new file mode 100644 index 00000000..151d4e17 --- /dev/null +++ b/test/transform/resource/after-delombok/SkipSuppressWarnings.java @@ -0,0 +1,24 @@ +class SkipSuppressWarnings { + private String field = ""; + private final java.util.concurrent.atomic.AtomicReference field2 = new java.util.concurrent.atomic.AtomicReference(); + + public String getField() { + return this.field; + } + + @java.lang.SuppressWarnings({"unchecked"}) + public String getField2() { + java.lang.Object value = this.field2.get(); + if (value == null) { + synchronized (this.field2) { + value = this.field2.get(); + if (value == null) { + final String actualValue = ""; + value = actualValue == null ? this.field2 : actualValue; + this.field2.set(value); + } + } + } + return (String) (value == this.field2 ? null : value); + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/SkipSuppressWarnings.java b/test/transform/resource/after-ecj/SkipSuppressWarnings.java new file mode 100644 index 00000000..53032519 --- /dev/null +++ b/test/transform/resource/after-ecj/SkipSuppressWarnings.java @@ -0,0 +1,27 @@ +class SkipSuppressWarnings { + private @lombok.Getter String field = ""; + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference field2 = new java.util.concurrent.atomic.AtomicReference(); + SkipSuppressWarnings() { + super(); + } + public String getField() { + return this.field; + } + public @java.lang.SuppressWarnings({"unchecked"}) String getField2() { + java.lang.Object value = this.field2.get(); + if ((value == null)) + { + synchronized (this.field2) + { + value = this.field2.get(); + if ((value == null)) + { + final String actualValue = ""; + value = ((actualValue == null) ? this.field2 : actualValue); + this.field2.set(value); + } + } + } + return (String) ((value == this.field2) ? null : value); + } +} \ No newline at end of file diff --git a/test/transform/resource/before/SkipSuppressWarnings.java b/test/transform/resource/before/SkipSuppressWarnings.java new file mode 100644 index 00000000..ed36eeb9 --- /dev/null +++ b/test/transform/resource/before/SkipSuppressWarnings.java @@ -0,0 +1,9 @@ +//CONF: lombok.addSuppressWarnings = false + +class SkipSuppressWarnings { + @lombok.Getter + private String field = ""; + + @lombok.Getter(lazy=true) + private final String field2 = ""; +} \ No newline at end of file diff --git a/test/transform/resource/messages-ecj/SkipSuppressWarnings.java.messages b/test/transform/resource/messages-ecj/SkipSuppressWarnings.java.messages new file mode 100644 index 00000000..5e7d759c --- /dev/null +++ b/test/transform/resource/messages-ecj/SkipSuppressWarnings.java.messages @@ -0,0 +1 @@ +7 Unnecessary @SuppressWarnings("unchecked") \ No newline at end of file -- cgit