diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-02-14 16:39:48 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-02-14 16:39:48 +0100 |
commit | 06581537f24fe31ee096960be496bc503059a95e (patch) | |
tree | 3732f6fe2117c390f9812b5961dd2d95d4293026 /test/transform/resource/after-delombok | |
parent | 5e9e16a6b98da5a17f5efe785917bc1e92265fc8 (diff) | |
download | lombok-06581537f24fe31ee096960be496bc503059a95e.tar.gz lombok-06581537f24fe31ee096960be496bc503059a95e.tar.bz2 lombok-06581537f24fe31ee096960be496bc503059a95e.zip |
More test files, test files updated to be valid java, and ecj test now goes through the complete compile process. This means val and @Delegate testing is now enabled.
TODO: Update -eclipse tests.
Diffstat (limited to 'test/transform/resource/after-delombok')
14 files changed, 68 insertions, 41 deletions
diff --git a/test/transform/resource/after-delombok/Constructors.java b/test/transform/resource/after-delombok/Constructors.java index fb906c73..baea640f 100644 --- a/test/transform/resource/after-delombok/Constructors.java +++ b/test/transform/resource/after-delombok/Constructors.java @@ -39,7 +39,7 @@ class AllArgsConstructor1 { } } class NoArgsConstructor1 { - final int x; + int x; String name; @java.lang.SuppressWarnings("all") public NoArgsConstructor1() { diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java index 5124fbeb..86d0ec18 100644 --- a/test/transform/resource/after-delombok/DataPlain.java +++ b/test/transform/resource/after-delombok/DataPlain.java @@ -144,7 +144,7 @@ final class Data3 { } } final class Data4 extends java.util.Timer { - final int x; + int x; Data4() { super(); } @@ -152,6 +152,10 @@ final class Data4 extends java.util.Timer { public int getX() { return this.x; } + @java.lang.SuppressWarnings("all") + public void setX(final int x) { + this.x = x; + } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/DelegateOnGetter.java b/test/transform/resource/after-delombok/DelegateOnGetter.java index ee34018a..08d682a2 100644 --- a/test/transform/resource/after-delombok/DelegateOnGetter.java +++ b/test/transform/resource/after-delombok/DelegateOnGetter.java @@ -11,13 +11,14 @@ class DelegateOnGetter { synchronized (this.bar) { value = this.bar.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<Bar>(new Bar(){ + final Bar actualValue = new Bar(){ public void setList(java.util.ArrayList<String> list) { } public int getInt() { return 42; } - }); + }; + value = new java.util.concurrent.atomic.AtomicReference<Bar>(actualValue); this.bar.set(value); } } diff --git a/test/transform/resource/after-delombok/DelegateOnGetterNone.java b/test/transform/resource/after-delombok/DelegateOnGetterNone.java index b3258f25..9f9411f4 100644 --- a/test/transform/resource/after-delombok/DelegateOnGetterNone.java +++ b/test/transform/resource/after-delombok/DelegateOnGetterNone.java @@ -1,5 +1,5 @@ class DelegateOnGetterNone { - private final Bar bar; + private final Bar bar = null; private interface Bar { void setList(java.util.ArrayList<java.lang.String> list); int getInt(); diff --git a/test/transform/resource/after-delombok/GetterAlreadyExists.java b/test/transform/resource/after-delombok/GetterAlreadyExists.java index d0a01c88..8389ae31 100644 --- a/test/transform/resource/after-delombok/GetterAlreadyExists.java +++ b/test/transform/resource/after-delombok/GetterAlreadyExists.java @@ -123,7 +123,7 @@ class Getter15 { class Getter16 { String foo; static String hasFoo() { - return false; + return ""; } @java.lang.SuppressWarnings("all") public String getFoo() { @@ -133,7 +133,7 @@ class Getter16 { class Getter17 { String foo; static String isFoo() { - return false; + return ""; } @java.lang.SuppressWarnings("all") public String getFoo() { @@ -143,6 +143,6 @@ class Getter17 { class Getter18 { String foo; static String getFoo() { - return false; + return ""; } }
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/GetterLazy.java b/test/transform/resource/after-delombok/GetterLazy.java index d7f97f0d..95be39e3 100644 --- a/test/transform/resource/after-delombok/GetterLazy.java +++ b/test/transform/resource/after-delombok/GetterLazy.java @@ -9,7 +9,8 @@ class GetterLazy { synchronized (this.fieldName) { value = this.fieldName.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<ValueType>(new ValueType()); + final ValueType actualValue = new ValueType(); + value = new java.util.concurrent.atomic.AtomicReference<ValueType>(actualValue); this.fieldName.set(value); } } diff --git a/test/transform/resource/after-delombok/GetterLazyEahcToString.java b/test/transform/resource/after-delombok/GetterLazyEahcToString.java index 74ce716e..a542061d 100644 --- a/test/transform/resource/after-delombok/GetterLazyEahcToString.java +++ b/test/transform/resource/after-delombok/GetterLazyEahcToString.java @@ -43,7 +43,8 @@ class GetterLazyEahcToString { synchronized (this.value) { value = this.value.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<String>(""); + final String actualValue = ""; + value = new java.util.concurrent.atomic.AtomicReference<String>(actualValue); this.value.set(value); } } diff --git a/test/transform/resource/after-delombok/GetterLazyNative.java b/test/transform/resource/after-delombok/GetterLazyNative.java index 650d0496..29e7d66d 100644 --- a/test/transform/resource/after-delombok/GetterLazyNative.java +++ b/test/transform/resource/after-delombok/GetterLazyNative.java @@ -15,7 +15,8 @@ class GetterLazyNative { synchronized (this.booleanField) { value = this.booleanField.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(true); + final boolean actualValue = true; + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(actualValue); this.booleanField.set(value); } } @@ -29,7 +30,8 @@ class GetterLazyNative { synchronized (this.byteField) { value = this.byteField.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(1); + final byte actualValue = 1; + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(actualValue); this.byteField.set(value); } } @@ -43,7 +45,8 @@ class GetterLazyNative { synchronized (this.shortField) { value = this.shortField.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(1); + final short actualValue = 1; + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(actualValue); this.shortField.set(value); } } @@ -57,7 +60,8 @@ class GetterLazyNative { synchronized (this.intField) { value = this.intField.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(1); + final int actualValue = 1; + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(actualValue); this.intField.set(value); } } @@ -71,7 +75,8 @@ class GetterLazyNative { synchronized (this.longField) { value = this.longField.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(1); + final long actualValue = 1; + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(actualValue); this.longField.set(value); } } @@ -85,7 +90,8 @@ class GetterLazyNative { synchronized (this.floatField) { value = this.floatField.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(1.0F); + final float actualValue = 1.0F; + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(actualValue); this.floatField.set(value); } } @@ -99,7 +105,8 @@ class GetterLazyNative { synchronized (this.doubleField) { value = this.doubleField.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(1.0); + final double actualValue = 1.0; + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(actualValue); this.doubleField.set(value); } } @@ -113,7 +120,8 @@ class GetterLazyNative { synchronized (this.charField) { value = this.charField.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>('1'); + final char actualValue = '1'; + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>(actualValue); this.charField.set(value); } } @@ -127,7 +135,8 @@ class GetterLazyNative { synchronized (this.intArrayField) { value = this.intArrayField.get(); if (value == null) { - value = new java.util.concurrent.atomic.AtomicReference<int[]>(new int[]{1}); + final int[] actualValue = new int[]{1}; + value = new java.util.concurrent.atomic.AtomicReference<int[]>(actualValue); this.intArrayField.set(value); } } diff --git a/test/transform/resource/after-delombok/ToStringInner.java b/test/transform/resource/after-delombok/ToStringInner.java index bd8967b7..7b1d5e21 100644 --- a/test/transform/resource/after-delombok/ToStringInner.java +++ b/test/transform/resource/after-delombok/ToStringInner.java @@ -1,8 +1,8 @@ class ToStringOuter { - final int x; + int x; String name; class ToStringInner { - final int y; + int y; @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -10,7 +10,7 @@ class ToStringOuter { } } static class ToStringStaticInner { - final int y; + int y; @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -19,7 +19,7 @@ class ToStringOuter { } class ToStringMiddle { class ToStringMoreInner { - final String name; + String name; @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/ToStringPlain.java b/test/transform/resource/after-delombok/ToStringPlain.java index 20227464..e6f3db7a 100644 --- a/test/transform/resource/after-delombok/ToStringPlain.java +++ b/test/transform/resource/after-delombok/ToStringPlain.java @@ -1,5 +1,5 @@ class ToString1 { - final int x; + int x; String name; @java.lang.Override @java.lang.SuppressWarnings("all") @@ -8,7 +8,7 @@ class ToString1 { } } class ToString2 { - final int x; + int x; String name; @java.lang.Override @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/ValComplex.java b/test/transform/resource/after-delombok/ValComplex.java index 54ef5c78..0df87fac 100644 --- a/test/transform/resource/after-delombok/ValComplex.java +++ b/test/transform/resource/after-delombok/ValComplex.java @@ -1,8 +1,8 @@ public class ValComplex { - private ValSimple field = new ValSimple(); + private String field = ""; private static final int CONSTANT = 20; - public void testReferencingOtherFiles() { - final java.lang.String shouldBeString = field.method(); + public void testComplex() { + final char[] shouldBeCharArray = field.toCharArray(); final int shouldBeInt = CONSTANT; final java.lang.Object lock = new Object(); synchronized (lock) { @@ -10,11 +10,11 @@ public class ValComplex { final int inner = 10; switch (field) { case 5: - final java.lang.String shouldBeString2 = shouldBeString; + final char[] shouldBeCharArray2 = shouldBeCharArray; final int innerInner = inner; } } - final ValSimple shouldBeValSimple = field; //Unshadowing + final java.lang.String shouldBeString = field; //Unshadowing } }
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValInFor.java b/test/transform/resource/after-delombok/ValInFor.java index 013cd02e..de75803b 100644 --- a/test/transform/resource/after-delombok/ValInFor.java +++ b/test/transform/resource/after-delombok/ValInFor.java @@ -1,14 +1,4 @@ public class ValInFor { - { - final int x = 10; - final int x2 = -1; - final java.lang.String a = "Hello"; - for (final int y = x, z = x2; y < 20; y++) { - final int q = y; - final int w = z; - final java.lang.String v = a; - } - } public void enhancedFor() { java.util.List<String> list = java.util.Arrays.asList("Hello, World!"); for (final java.lang.String shouldBeString : list) { diff --git a/test/transform/resource/after-delombok/ValOutersWithGenerics.java b/test/transform/resource/after-delombok/ValOutersWithGenerics.java new file mode 100644 index 00000000..150e3a2a --- /dev/null +++ b/test/transform/resource/after-delombok/ValOutersWithGenerics.java @@ -0,0 +1,21 @@ +import java.util.*; +public class ValOutersWithGenerics<Z> { + class Inner { + } + public void testOutersWithGenerics() { + final java.lang.String foo = ""; + List<Inner> list = new ArrayList<Inner>(); + final ValOutersWithGenerics<Z>.Inner elem = list.get(0); + } + public void testLocalClasses() { + class Local<A> { + } + final Local<java.lang.String> q = new Local<String>(); + } + static class SubClass extends ValOutersWithGenerics<String> { + public void testSubClassOfOutersWithGenerics() { + List<Inner> list = new ArrayList<Inner>(); + final ValOutersWithGenerics<java.lang.String>.Inner elem = list.get(0); + } + } +} diff --git a/test/transform/resource/after-delombok/ValWeirdTypes.java b/test/transform/resource/after-delombok/ValWeirdTypes.java index 34beb80b..9eb211b3 100644 --- a/test/transform/resource/after-delombok/ValWeirdTypes.java +++ b/test/transform/resource/after-delombok/ValWeirdTypes.java @@ -1,6 +1,6 @@ import java.util.*; public class ValWeirdTypes<Z> { - private final List<Z> fieldList; + private List<Z> fieldList; public void testGenerics() { List<String> list = new ArrayList<String>(); list.add("Hello, World!"); |