From d8da2b9438056e945ecc38d98fed413444c847b3 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 2 Feb 2015 04:47:21 +0100 Subject: added impl for @UtilityClass. --- .../resource/after-delombok/UtilityClass.java | 26 +++++++++++++++++ .../after-delombok/UtilityClassErrors.java | 12 ++++++++ .../transform/resource/after-ecj/UtilityClass.java | 33 ++++++++++++++++++++++ .../resource/after-ecj/UtilityClassErrors.java | 20 +++++++++++++ test/transform/resource/before/UtilityClass.java | 20 +++++++++++++ .../resource/before/UtilityClassErrors.java | 14 +++++++++ .../UtilityClassErrors.java.messages | 3 ++ .../messages-ecj/UtilityClassErrors.java.messages | 3 ++ 8 files changed, 131 insertions(+) create mode 100644 test/transform/resource/after-delombok/UtilityClass.java create mode 100644 test/transform/resource/after-delombok/UtilityClassErrors.java create mode 100644 test/transform/resource/after-ecj/UtilityClass.java create mode 100644 test/transform/resource/after-ecj/UtilityClassErrors.java create mode 100644 test/transform/resource/before/UtilityClass.java create mode 100644 test/transform/resource/before/UtilityClassErrors.java create mode 100644 test/transform/resource/messages-delombok/UtilityClassErrors.java.messages create mode 100644 test/transform/resource/messages-ecj/UtilityClassErrors.java.messages (limited to 'test') diff --git a/test/transform/resource/after-delombok/UtilityClass.java b/test/transform/resource/after-delombok/UtilityClass.java new file mode 100644 index 00000000..f9fe02a0 --- /dev/null +++ b/test/transform/resource/after-delombok/UtilityClass.java @@ -0,0 +1,26 @@ +final class UtilityClass { + private static String someField; + static void someMethod() { + System.out.println(); + } + protected static class InnerClass { + private String innerInnerMember; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private UtilityClass() { + throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } +} +class UtilityInner { + static class InnerInner { + static final class InnerInnerInner { + static int member; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private InnerInnerInner() { + throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } + } + } +} \ No newline at end of file diff --git a/test/transform/resource/after-delombok/UtilityClassErrors.java b/test/transform/resource/after-delombok/UtilityClassErrors.java new file mode 100644 index 00000000..b19b4e72 --- /dev/null +++ b/test/transform/resource/after-delombok/UtilityClassErrors.java @@ -0,0 +1,12 @@ +final class UtilityClassErrors1 { + private static String someField; + protected UtilityClassErrors1() { + } + static void method() { + class MethodLocalClass { + } + } +} +enum UtilityClassErrors2 { +; +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/UtilityClass.java b/test/transform/resource/after-ecj/UtilityClass.java new file mode 100644 index 00000000..c3e06fbc --- /dev/null +++ b/test/transform/resource/after-ecj/UtilityClass.java @@ -0,0 +1,33 @@ +final @lombok.experimental.UtilityClass class UtilityClass { + protected static class InnerClass { + private String innerInnerMember; + protected InnerClass() { + super(); + } + } + private static String someField; + static void someMethod() { + System.out.println(); + } + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") UtilityClass() { + super(); + throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } +} +class UtilityInner { + static class InnerInner { + static final @lombok.experimental.UtilityClass class InnerInnerInner { + static int member; + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") InnerInnerInner() { + super(); + throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } + } + InnerInner() { + super(); + } + } + UtilityInner() { + super(); + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/UtilityClassErrors.java b/test/transform/resource/after-ecj/UtilityClassErrors.java new file mode 100644 index 00000000..03206592 --- /dev/null +++ b/test/transform/resource/after-ecj/UtilityClassErrors.java @@ -0,0 +1,20 @@ +final @lombok.experimental.UtilityClass class UtilityClassErrors1 { + private static String someField; + protected UtilityClassErrors1() { + super(); + } + static void method() { + @lombok.experimental.UtilityClass class MethodLocalClass { + MethodLocalClass() { + super(); + } + } + } +} +@lombok.experimental.UtilityClass enum UtilityClassErrors2 { + () { + } + UtilityClassErrors2() { + super(); + } +} diff --git a/test/transform/resource/before/UtilityClass.java b/test/transform/resource/before/UtilityClass.java new file mode 100644 index 00000000..ccfa43e1 --- /dev/null +++ b/test/transform/resource/before/UtilityClass.java @@ -0,0 +1,20 @@ +@lombok.experimental.UtilityClass +class UtilityClass { + private String someField; + + void someMethod() { + System.out.println(); + } + + protected class InnerClass { + private String innerInnerMember; + } +} +class UtilityInner { + static class InnerInner { + @lombok.experimental.UtilityClass + class InnerInnerInner { + int member; + } + } +} diff --git a/test/transform/resource/before/UtilityClassErrors.java b/test/transform/resource/before/UtilityClassErrors.java new file mode 100644 index 00000000..5f72274b --- /dev/null +++ b/test/transform/resource/before/UtilityClassErrors.java @@ -0,0 +1,14 @@ +@lombok.experimental.UtilityClass +class UtilityClassErrors1 { + private String someField; + protected UtilityClassErrors1() { + } + void method() { + @lombok.experimental.UtilityClass + class MethodLocalClass { + } + } +} +@lombok.experimental.UtilityClass +enum UtilityClassErrors2 { +} \ No newline at end of file diff --git a/test/transform/resource/messages-delombok/UtilityClassErrors.java.messages b/test/transform/resource/messages-delombok/UtilityClassErrors.java.messages new file mode 100644 index 00000000..230ba04f --- /dev/null +++ b/test/transform/resource/messages-delombok/UtilityClassErrors.java.messages @@ -0,0 +1,3 @@ +4 @UtilityClasses cannot have declared constructors. +7 @UtilityClass cannot be placed on a method local or anonymous inner class, or any class nested in such a class. +12 @UtilityClass is only supported on a class (can't be an interface, enum, or annotation). diff --git a/test/transform/resource/messages-ecj/UtilityClassErrors.java.messages b/test/transform/resource/messages-ecj/UtilityClassErrors.java.messages new file mode 100644 index 00000000..c80a18dc --- /dev/null +++ b/test/transform/resource/messages-ecj/UtilityClassErrors.java.messages @@ -0,0 +1,3 @@ +4 @UtilityClasses cannot have declared constructors. +7 @UtilityClass cannot be placed on a method local or anonymous inner class, or any class nested in such a class. +12 @UtilityClass is only supported on a class (can't be an interface, enum, or annotation) \ No newline at end of file -- cgit