From 3d432c38d0cfeb36b8e7402eca56faaafcf7bac7 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sun, 29 Jul 2018 16:37:21 +0200 Subject: code impl of FieldNameConstants rewrite + test updates for it --- .../after-delombok/FieldNameConstantsBasic.java | 8 ++++++-- .../FieldNameConstantsConfigKeys.java | 7 +++++-- .../after-delombok/FieldNameConstantsEnum.java | 10 ++++++++++ .../after-delombok/FieldNameConstantsWeird.java | 6 ------ .../after-ecj/FieldNameConstantsBasic.java | 18 ++++++++++++----- .../after-ecj/FieldNameConstantsConfigKeys.java | 13 ++++++++---- .../resource/after-ecj/FieldNameConstantsEnum.java | 23 ++++++++++++++++++++++ .../after-ecj/FieldNameConstantsWeird.java | 13 ------------ .../resource/before/FieldNameConstantsBasic.java | 4 ++-- .../before/FieldNameConstantsConfigKeys.java | 3 +-- .../resource/before/FieldNameConstantsEnum.java | 13 ++++++++++++ .../resource/before/FieldNameConstantsWeird.java | 12 ----------- .../FieldNameConstantsWeird.java.messages | 1 - .../FieldNameConstantsWeird.java.messages | 1 - 14 files changed, 82 insertions(+), 50 deletions(-) create mode 100644 test/transform/resource/after-delombok/FieldNameConstantsEnum.java delete mode 100644 test/transform/resource/after-delombok/FieldNameConstantsWeird.java create mode 100644 test/transform/resource/after-ecj/FieldNameConstantsEnum.java delete mode 100644 test/transform/resource/after-ecj/FieldNameConstantsWeird.java create mode 100644 test/transform/resource/before/FieldNameConstantsEnum.java delete mode 100644 test/transform/resource/before/FieldNameConstantsWeird.java delete mode 100644 test/transform/resource/messages-delombok/FieldNameConstantsWeird.java.messages delete mode 100644 test/transform/resource/messages-ecj/FieldNameConstantsWeird.java.messages (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/FieldNameConstantsBasic.java b/test/transform/resource/after-delombok/FieldNameConstantsBasic.java index 4e547aa5..8be45d2b 100644 --- a/test/transform/resource/after-delombok/FieldNameConstantsBasic.java +++ b/test/transform/resource/after-delombok/FieldNameConstantsBasic.java @@ -1,8 +1,12 @@ public class FieldNameConstantsBasic { - protected static final java.lang.String FIELD_I_AM_A_DVD_PLAYER = "iAmADvdPlayer"; - public static final java.lang.String FIELD_BUT_PRINT_ME_PLEASE = "butPrintMePlease"; String iAmADvdPlayer; int $skipMe; static double skipMeToo; + int andMe; String butPrintMePlease; + @java.lang.SuppressWarnings("all") + static final class Fields { + public static final java.lang.String butPrintMePlease = "butPrintMePlease"; + public static final java.lang.String iAmADvdPlayer = "iAmADvdPlayer"; + } } diff --git a/test/transform/resource/after-delombok/FieldNameConstantsConfigKeys.java b/test/transform/resource/after-delombok/FieldNameConstantsConfigKeys.java index c71b9264..4c2a53e3 100644 --- a/test/transform/resource/after-delombok/FieldNameConstantsConfigKeys.java +++ b/test/transform/resource/after-delombok/FieldNameConstantsConfigKeys.java @@ -1,4 +1,7 @@ public class FieldNameConstantsConfigKeys { - public static final java.lang.String I_AM_A_DVD_PLAYER_SFX = "iAmADvdPlayer"; String iAmADvdPlayer; -} + @java.lang.SuppressWarnings("all") + public static final class Foobar { + public static final java.lang.String iAmADvdPlayer = "iAmADvdPlayer"; + } +} \ No newline at end of file diff --git a/test/transform/resource/after-delombok/FieldNameConstantsEnum.java b/test/transform/resource/after-delombok/FieldNameConstantsEnum.java new file mode 100644 index 00000000..c3fbf0c2 --- /dev/null +++ b/test/transform/resource/after-delombok/FieldNameConstantsEnum.java @@ -0,0 +1,10 @@ +public class FieldNameConstantsEnum { + String iAmADvdPlayer; + int $dontSkipMe; + static double alsoDontSkipMe; + int butSkipMe; + @java.lang.SuppressWarnings("all") + public enum TypeTest { + iAmADvdPlayer, $dontSkipMe, alsoDontSkipMe; + } +} diff --git a/test/transform/resource/after-delombok/FieldNameConstantsWeird.java b/test/transform/resource/after-delombok/FieldNameConstantsWeird.java deleted file mode 100644 index 6940f628..00000000 --- a/test/transform/resource/after-delombok/FieldNameConstantsWeird.java +++ /dev/null @@ -1,6 +0,0 @@ -public class FieldNameConstantsWeird { - public static final java.lang.String FIELD_AZ = "A"; - String iAmADvdPlayer; - String X; - String A; -} diff --git a/test/transform/resource/after-ecj/FieldNameConstantsBasic.java b/test/transform/resource/after-ecj/FieldNameConstantsBasic.java index f77203ba..674dd602 100644 --- a/test/transform/resource/after-ecj/FieldNameConstantsBasic.java +++ b/test/transform/resource/after-ecj/FieldNameConstantsBasic.java @@ -1,15 +1,23 @@ import lombok.experimental.FieldNameConstants; import lombok.AccessLevel; -public @FieldNameConstants class FieldNameConstantsBasic { - public static final java.lang.String FIELD_BUT_PRINT_ME_PLEASE = "butPrintMePlease"; - protected static final java.lang.String FIELD_I_AM_A_DVD_PLAYER = "iAmADvdPlayer"; - @FieldNameConstants(level = AccessLevel.PROTECTED) String iAmADvdPlayer; +public @FieldNameConstants(level = AccessLevel.PACKAGE) class FieldNameConstantsBasic { + static final @java.lang.SuppressWarnings("all") class Fields { + public static final java.lang.String butPrintMePlease = "butPrintMePlease"; + public static final java.lang.String iAmADvdPlayer = "iAmADvdPlayer"; + () { + } + private @java.lang.SuppressWarnings("all") Fields() { + super(); + } + } + String iAmADvdPlayer; int $skipMe; static double skipMeToo; + @FieldNameConstants.Exclude int andMe; String butPrintMePlease; () { } public FieldNameConstantsBasic() { super(); } -} +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/FieldNameConstantsConfigKeys.java b/test/transform/resource/after-ecj/FieldNameConstantsConfigKeys.java index 44629ee5..7eb97364 100644 --- a/test/transform/resource/after-ecj/FieldNameConstantsConfigKeys.java +++ b/test/transform/resource/after-ecj/FieldNameConstantsConfigKeys.java @@ -1,9 +1,14 @@ public @lombok.experimental.FieldNameConstants class FieldNameConstantsConfigKeys { - public static final java.lang.String I_AM_A_DVD_PLAYER_SFX = "iAmADvdPlayer"; - String iAmADvdPlayer; - () { + public static final @java.lang.SuppressWarnings("all") class Foobar { + public static final java.lang.String iAmADvdPlayer = "iAmADvdPlayer"; + () { + } + private @java.lang.SuppressWarnings("all") Foobar() { + super(); + } } + String iAmADvdPlayer; public FieldNameConstantsConfigKeys() { super(); } -} +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/FieldNameConstantsEnum.java b/test/transform/resource/after-ecj/FieldNameConstantsEnum.java new file mode 100644 index 00000000..053a6e7a --- /dev/null +++ b/test/transform/resource/after-ecj/FieldNameConstantsEnum.java @@ -0,0 +1,23 @@ +import lombok.experimental.FieldNameConstants; +import lombok.AccessLevel; +public @FieldNameConstants(onlyExplicitlyIncluded = true,asEnum = true,innerTypeName = "TypeTest") class FieldNameConstantsEnum { + public @java.lang.SuppressWarnings("all") enum TypeTest { + iAmADvdPlayer(), + $dontSkipMe(), + alsoDontSkipMe(), + private @java.lang.SuppressWarnings("all") TypeTest() { + super(); + } + () { + } + } + @FieldNameConstants.Include String iAmADvdPlayer; + @FieldNameConstants.Include int $dontSkipMe; + static @FieldNameConstants.Include double alsoDontSkipMe; + int butSkipMe; + () { + } + public FieldNameConstantsEnum() { + super(); + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/FieldNameConstantsWeird.java b/test/transform/resource/after-ecj/FieldNameConstantsWeird.java deleted file mode 100644 index 9958f664..00000000 --- a/test/transform/resource/after-ecj/FieldNameConstantsWeird.java +++ /dev/null @@ -1,13 +0,0 @@ -import lombok.experimental.FieldNameConstants; -import lombok.AccessLevel; -public @FieldNameConstants class FieldNameConstantsWeird { - public static final java.lang.String FIELD_AZ = "A"; - @FieldNameConstants(level = AccessLevel.NONE) String iAmADvdPlayer; - @FieldNameConstants(prefix = "") String X; - @FieldNameConstants(suffix = "Z") String A; - () { - } - public FieldNameConstantsWeird() { - super(); - } -} diff --git a/test/transform/resource/before/FieldNameConstantsBasic.java b/test/transform/resource/before/FieldNameConstantsBasic.java index 1bc15d84..2842dea3 100644 --- a/test/transform/resource/before/FieldNameConstantsBasic.java +++ b/test/transform/resource/before/FieldNameConstantsBasic.java @@ -1,11 +1,11 @@ import lombok.experimental.FieldNameConstants; import lombok.AccessLevel; -@FieldNameConstants +@FieldNameConstants(level = AccessLevel.PACKAGE) public class FieldNameConstantsBasic { - @FieldNameConstants(level = AccessLevel.PROTECTED) String iAmADvdPlayer; int $skipMe; static double skipMeToo; + @FieldNameConstants.Exclude int andMe; String butPrintMePlease; } diff --git a/test/transform/resource/before/FieldNameConstantsConfigKeys.java b/test/transform/resource/before/FieldNameConstantsConfigKeys.java index ab8e3091..5595222c 100644 --- a/test/transform/resource/before/FieldNameConstantsConfigKeys.java +++ b/test/transform/resource/before/FieldNameConstantsConfigKeys.java @@ -1,5 +1,4 @@ -//CONF: lombok.fieldNameConstants.prefix = -//CONF: lombok.fieldNameConstants.suffix = _SFX +//CONF: lombok.fieldNameConstants.innerTypeName = Foobar @lombok.experimental.FieldNameConstants public class FieldNameConstantsConfigKeys { diff --git a/test/transform/resource/before/FieldNameConstantsEnum.java b/test/transform/resource/before/FieldNameConstantsEnum.java new file mode 100644 index 00000000..d56bb280 --- /dev/null +++ b/test/transform/resource/before/FieldNameConstantsEnum.java @@ -0,0 +1,13 @@ +import lombok.experimental.FieldNameConstants; +import lombok.AccessLevel; + +@FieldNameConstants(onlyExplicitlyIncluded = true, asEnum = true, innerTypeName = "TypeTest") +public class FieldNameConstantsEnum { + @FieldNameConstants.Include + String iAmADvdPlayer; + @FieldNameConstants.Include + int $dontSkipMe; + @FieldNameConstants.Include + static double alsoDontSkipMe; + int butSkipMe; +} diff --git a/test/transform/resource/before/FieldNameConstantsWeird.java b/test/transform/resource/before/FieldNameConstantsWeird.java deleted file mode 100644 index 74ec299a..00000000 --- a/test/transform/resource/before/FieldNameConstantsWeird.java +++ /dev/null @@ -1,12 +0,0 @@ -import lombok.experimental.FieldNameConstants; -import lombok.AccessLevel; - -@FieldNameConstants -public class FieldNameConstantsWeird { - @FieldNameConstants(level = AccessLevel.NONE) - String iAmADvdPlayer; - @FieldNameConstants(prefix = "") - String X; - @FieldNameConstants(suffix = "Z") - String A; -} diff --git a/test/transform/resource/messages-delombok/FieldNameConstantsWeird.java.messages b/test/transform/resource/messages-delombok/FieldNameConstantsWeird.java.messages deleted file mode 100644 index 02a38d58..00000000 --- a/test/transform/resource/messages-delombok/FieldNameConstantsWeird.java.messages +++ /dev/null @@ -1 +0,0 @@ -9 Not generating constant for this field: The name of the constant would be equal to the name of this field. diff --git a/test/transform/resource/messages-ecj/FieldNameConstantsWeird.java.messages b/test/transform/resource/messages-ecj/FieldNameConstantsWeird.java.messages deleted file mode 100644 index 02a38d58..00000000 --- a/test/transform/resource/messages-ecj/FieldNameConstantsWeird.java.messages +++ /dev/null @@ -1 +0,0 @@ -9 Not generating constant for this field: The name of the constant would be equal to the name of this field. -- cgit