diff options
Diffstat (limited to 'test/transform/resource/before')
17 files changed, 269 insertions, 1 deletions
diff --git a/test/transform/resource/before/DataPlain.java b/test/transform/resource/before/DataPlain.java index 680ae46f..4151dd20 100644 --- a/test/transform/resource/before/DataPlain.java +++ b/test/transform/resource/before/DataPlain.java @@ -6,4 +6,16 @@ import lombok.Data; @Data class Data2 { final int x; String name; -}
\ No newline at end of file +} +final @Data class Data3 { + final int x; + String name; +} +@Data +@lombok.EqualsAndHashCode(callSuper=true) +final class Data4 extends java.util.Timer { + final int x; + Data4() { + super(); + } +} diff --git a/test/transform/resource/before/LoggerCommons.java b/test/transform/resource/before/LoggerCommons.java new file mode 100644 index 00000000..d6359bd7 --- /dev/null +++ b/test/transform/resource/before/LoggerCommons.java @@ -0,0 +1,11 @@ +@lombok.extern.apachecommons.Log +class LoggerCommons { +} + +@lombok.extern.apachecommons.Log(String.class) +class LoggerCommonsString { +} + +@lombok.extern.apachecommons.Log(java.lang.String.class) +class LoggerCommonsJavaLangString { +}
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerJul.java b/test/transform/resource/before/LoggerJul.java new file mode 100644 index 00000000..1c74ea4f --- /dev/null +++ b/test/transform/resource/before/LoggerJul.java @@ -0,0 +1,11 @@ +@lombok.extern.jul.Log +class LoggerJul { +} + +@lombok.extern.jul.Log(String.class) +class LoggerJulString { +} + +@lombok.extern.jul.Log(java.lang.String.class) +class LoggerJulJavaLangString { +}
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerLog4j.java b/test/transform/resource/before/LoggerLog4j.java new file mode 100644 index 00000000..0199809c --- /dev/null +++ b/test/transform/resource/before/LoggerLog4j.java @@ -0,0 +1,11 @@ +@lombok.extern.log4j.Log +class LoggerLog4j { +} + +@lombok.extern.log4j.Log(String.class) +class LoggerLog4jString { +} + +@lombok.extern.log4j.Log(java.lang.String.class) +class LoggerLog4jJavaLangString { +}
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerSlf4j.java b/test/transform/resource/before/LoggerSlf4j.java new file mode 100644 index 00000000..92aeefbd --- /dev/null +++ b/test/transform/resource/before/LoggerSlf4j.java @@ -0,0 +1,9 @@ +@lombok.extern.slf4j.Log +class LoggerSlf4j { +} +class LoggerSlf4jOuter { + @lombok.extern.slf4j.Log + static class Inner { + + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerSlf4jAlreadyExists.java b/test/transform/resource/before/LoggerSlf4jAlreadyExists.java new file mode 100644 index 00000000..8ac0225d --- /dev/null +++ b/test/transform/resource/before/LoggerSlf4jAlreadyExists.java @@ -0,0 +1,4 @@ +@lombok.extern.slf4j.Log +class LoggerSlf4jAlreadyExists { + int log; +}
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerSlf4jClassOfArray.java b/test/transform/resource/before/LoggerSlf4jClassOfArray.java new file mode 100644 index 00000000..87248538 --- /dev/null +++ b/test/transform/resource/before/LoggerSlf4jClassOfArray.java @@ -0,0 +1,6 @@ +@lombok.extern.slf4j.Log(String[].class) +class LoggerSlf4jClassOfArray { +} +@lombok.extern.slf4j.Log(java.lang.String[].class) +class LoggerSlf4jClassOfArrayJLS { +} diff --git a/test/transform/resource/before/LoggerSlf4jOnNonType.java b/test/transform/resource/before/LoggerSlf4jOnNonType.java new file mode 100644 index 00000000..c57e171c --- /dev/null +++ b/test/transform/resource/before/LoggerSlf4jOnNonType.java @@ -0,0 +1,5 @@ +class LoggerSlf4jOnNonType { + @lombok.extern.slf4j.Log + void foo() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerSlf4jTypes.java b/test/transform/resource/before/LoggerSlf4jTypes.java new file mode 100644 index 00000000..9f221f73 --- /dev/null +++ b/test/transform/resource/before/LoggerSlf4jTypes.java @@ -0,0 +1,18 @@ +@lombok.extern.slf4j.Log +interface LoggerSlf4jTypesInterface { +} +@lombok.extern.slf4j.Log +@interface LoggerSlf4jTypesAnnotation { +} +@lombok.extern.slf4j.Log +enum LoggerSlf4jTypesEnum { +} +@lombok.extern.slf4j.Log +enum LoggerSlf4jTypesEnumWithElement { + FOO; +} +interface LoggerSlf4jTypesInterfaceOuter { + @lombok.extern.slf4j.Log + class Inner { + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerSlf4jWithClass.java b/test/transform/resource/before/LoggerSlf4jWithClass.java new file mode 100644 index 00000000..b9cf8187 --- /dev/null +++ b/test/transform/resource/before/LoggerSlf4jWithClass.java @@ -0,0 +1,12 @@ +@lombok.extern.slf4j.Log(String.class) +class LoggerSlf4jWithClass { +} +@lombok.extern.slf4j.Log(java.util.List.class) +class LoggerSlf4jWithClassList { +} +@lombok.extern.slf4j.Log(value = java.lang.String.class) +class LoggerSlf4jWithClassValue { +} +@lombok.extern.slf4j.Log(void.class) +class LoggerSlf4jWithClassVoid { +} diff --git a/test/transform/resource/before/LoggerSlf4jWithPackage.java b/test/transform/resource/before/LoggerSlf4jWithPackage.java new file mode 100644 index 00000000..efbaef68 --- /dev/null +++ b/test/transform/resource/before/LoggerSlf4jWithPackage.java @@ -0,0 +1,9 @@ +package before; +@lombok.extern.slf4j.Log +class LoggerSlf4jWithPackage { +} +class LoggerSlf4jWithPackageOuter { + @lombok.extern.slf4j.Log + static class Inner { + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/ValComplex.java b/test/transform/resource/before/ValComplex.java new file mode 100644 index 00000000..5f718003 --- /dev/null +++ b/test/transform/resource/before/ValComplex.java @@ -0,0 +1,20 @@ +public class ValComplex { + private ValSimple field = new ValSimple(); + private static final int CONSTANT = 20; + + public void testReferencingOtherFiles() { + val shouldBeString = field.method(); + val shouldBeInt = CONSTANT; + val lock = new Object(); + synchronized (lock) { + val field = 20; //Shadowing + val inner = 10; + switch (field) { + case 5: + val shouldBeString2 = shouldBeString; + val innerInner = inner; + } + } + val shouldBeValSimple = field; //Unshadowing + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/ValErrors.java b/test/transform/resource/before/ValErrors.java new file mode 100644 index 00000000..742bca6d --- /dev/null +++ b/test/transform/resource/before/ValErrors.java @@ -0,0 +1,9 @@ +public class ValErrors { + public void nullType() { + val a = null; + } + + public void unresolvableExpression() { + val c = d; + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/ValInFor.java b/test/transform/resource/before/ValInFor.java new file mode 100644 index 00000000..af13540e --- /dev/null +++ b/test/transform/resource/before/ValInFor.java @@ -0,0 +1,20 @@ +public class ValInFor { + { + val x = 10; + val x2 = -1; + val a = "Hello"; + for (val y = x, z = x2; y < 20; y++) { + val q = y; + val w = z; + val v = a; + } + } + +/* public void enhancedFor() { + java.util.List<String> list = java.util.Arrays.asList("Hello, World!"); + for (val shouldBeString : list) { + System.out.println(shouldBeString.toLowerCase()); + val shouldBeString2 = shouldBeString; + } + }*/ +}
\ No newline at end of file diff --git a/test/transform/resource/before/ValLessSimple.java b/test/transform/resource/before/ValLessSimple.java new file mode 100644 index 00000000..bae7b73b --- /dev/null +++ b/test/transform/resource/before/ValLessSimple.java @@ -0,0 +1,31 @@ +public class ValLessSimple { + private short field2 = 5; + + private String method() { + return "method"; + } + + private double method2() { + return 2.0; + } + + { + System.out.println("Hello"); + val z = 20; + val x = 10; + val a = z; + val y = field2; + } + + private void testVal(String param) { + val fieldV = field; + val a = 10; + val b = 20; + { + val methodV = method(); + val foo = fieldV + methodV; + } + } + + private String field = "field"; +} diff --git a/test/transform/resource/before/ValSimple.java b/test/transform/resource/before/ValSimple.java new file mode 100644 index 00000000..15508bbc --- /dev/null +++ b/test/transform/resource/before/ValSimple.java @@ -0,0 +1,26 @@ +public class ValSimple { + private String field = "field"; + private short field2 = 5; + + private String method() { + return "method"; + } + + private double method2() { + return 2.0; + } + + private void testVal(String param) { + val fieldV = field; + val methodV = method(); + val paramV = param; + + val valOfVal = fieldV; + val operatorV = fieldV + valOfVal; + + val fieldW = field2; + val methodW = method2(); + byte localVar = 3; + val operatorW = fieldW + localVar; + } +} diff --git a/test/transform/resource/before/ValWeirdTypes.java b/test/transform/resource/before/ValWeirdTypes.java new file mode 100644 index 00000000..6f6eb9db --- /dev/null +++ b/test/transform/resource/before/ValWeirdTypes.java @@ -0,0 +1,54 @@ +import java.util.*; + +public class ValWeirdTypes<Z> { + private final List<Z> fieldList; + + public void testGenerics() { + List<String> list = new ArrayList<String>(); + list.add("Hello, World!"); + val shouldBeString = list.get(0); + val shouldBeListOfString = list; + val shouldBeListOfStringToo = Arrays.asList("hello", "world"); + val shouldBeString2 = shouldBeListOfString.get(0); + } + + public void testGenericsInference() { + val huh = Collections.emptyList(); + val huh2 = Collections.<Number>emptyList(); + } + + public void testPrimitives() { + val x = 10; + val y = 5 + 3L; + } + + public void testAnonymousInnerClass() { + val y = new Runnable() { + public void run() {} + }; + } + + public <T extends Number> void testTypeParams(List<T> param) { + val t = param.get(0); + val z = fieldList.get(0); + val k = param; + val y = fieldList; + } + + public void testBounds(List<? extends Number> lower, List<? super Number> upper) { + val a = lower.get(0); + val b = upper.get(0); + val c = lower; + val d = upper; + List<?> unbound = lower; + val e = unbound; + } + + public void testCompound() { + val a = new ArrayList<String>(); + val b = new Vector<String>(); + val c = 1 < System.currentTimeMillis(); + val d = c ? a : b; + java.util.RandomAccess confirm = c ? a : b; + } +}
\ No newline at end of file |