diff options
Diffstat (limited to 'test')
91 files changed, 1157 insertions, 188 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java index 4241646b..7d5992be 100644 --- a/test/core/src/lombok/AbstractRunTests.java +++ b/test/core/src/lombok/AbstractRunTests.java @@ -37,12 +37,12 @@ public abstract class AbstractRunTests { public void compareFile(DirectoryRunner.TestParams params, File file) throws Throwable { StringBuilder messages = new StringBuilder(); - StringWriter result = new StringWriter(); - transformCode(messages, result, file); + StringWriter writer = new StringWriter(); + transformCode(messages, writer, file); compare( file.getName(), readFile(params.getAfterDirectory(), file, false), - result.toString(), + writer.toString(), readFile(params.getMessagesDirectory(), file, true), messages.toString(), params.printErrors()); @@ -111,6 +111,9 @@ public abstract class AbstractRunTests { private static void compareContent(String name, String expectedFile, String actualFile) { String[] expectedLines = expectedFile.split("(\\r?\\n)"); String[] actualLines = actualFile.split("(\\r?\\n)"); + if (expectedLines[0].startsWith("// Generated by delombok at ")) { + expectedLines[0] = ""; + } if (actualLines[0].startsWith("// Generated by delombok at ")) { actualLines[0] = ""; } diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java index 50fad33e..59a0ee89 100644 --- a/test/core/src/lombok/RunTestsViaDelombok.java +++ b/test/core/src/lombok/RunTestsViaDelombok.java @@ -51,6 +51,9 @@ public class RunTestsViaDelombok extends AbstractRunTests { } }); - delombok.delombok(file.getAbsolutePath(), result); + delombok.addFile(file.getParentFile(), file.getName()); + delombok.setSourcepath(file.getParentFile().getAbsolutePath()); + delombok.setWriter(result); + delombok.delombok(); } } diff --git a/test/pretty/resource/after/Interfaces.java b/test/pretty/resource/after/Interfaces.java index c8a5cca4..c5008f2b 100644 --- a/test/pretty/resource/after/Interfaces.java +++ b/test/pretty/resource/after/Interfaces.java @@ -2,6 +2,6 @@ interface Interfaces { int x = 10; void y(); - public static final int a = 20; - public abstract void b(); + int a = 20; + void b(); } diff --git a/test/pretty/resource/before/Annotation.java b/test/pretty/resource/before/Annotation.java index edd1a5e7..24868acd 100644 --- a/test/pretty/resource/before/Annotation.java +++ b/test/pretty/resource/before/Annotation.java @@ -1,3 +1,4 @@ +//ignore @SuppressWarnings("all") class Annotation { @Override diff --git a/test/transform/resource/after-delombok/CleanupName.java b/test/transform/resource/after-delombok/CleanupName.java index cd29eb68..0201008e 100644 --- a/test/transform/resource/after-delombok/CleanupName.java +++ b/test/transform/resource/after-delombok/CleanupName.java @@ -4,7 +4,9 @@ class CleanupName { try { System.out.println(o); } finally { - o.toString(); + if (o != null) { + o.toString(); + } } } void test2() { @@ -12,7 +14,9 @@ class CleanupName { try { System.out.println(o); } finally { - o.toString(); + if (o != null) { + o.toString(); + } } } } diff --git a/test/transform/resource/after-delombok/CleanupPlain.java b/test/transform/resource/after-delombok/CleanupPlain.java index 35d51543..1a19442f 100644 --- a/test/transform/resource/after-delombok/CleanupPlain.java +++ b/test/transform/resource/after-delombok/CleanupPlain.java @@ -9,10 +9,14 @@ class CleanupPlain { out.flush(); } } finally { - out.close(); + if (out != null) { + out.close(); + } } } finally { - in.close(); + if (in != null) { + in.close(); + } } } } diff --git a/test/transform/resource/after-delombok/DataExtended.java b/test/transform/resource/after-delombok/DataExtended.java index 6f55bc2c..be1c3b74 100644 --- a/test/transform/resource/after-delombok/DataExtended.java +++ b/test/transform/resource/after-delombok/DataExtended.java @@ -15,12 +15,16 @@ class DataExtended { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (o == null) return false; - if (o.getClass() != this.getClass()) return false; + if (!(o instanceof DataExtended)) return false; final DataExtended other = (DataExtended)o; + if (!other.canEqual(this)) return false; if (this.getX() != other.getX()) return false; return true; } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof DataExtended; + } @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { diff --git a/test/transform/resource/after-delombok/DataIgnore.java b/test/transform/resource/after-delombok/DataIgnore.java index 7e81432d..9f2a7d79 100644 --- a/test/transform/resource/after-delombok/DataIgnore.java +++ b/test/transform/resource/after-delombok/DataIgnore.java @@ -14,12 +14,16 @@ class DataIgnore { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (o == null) return false; - if (o.getClass() != this.getClass()) return false; + if (!(o instanceof DataIgnore)) return false; final DataIgnore other = (DataIgnore)o; + if (!other.canEqual(this)) return false; if (this.getX() != other.getX()) return false; return true; } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof DataIgnore; + } @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { @@ -33,4 +37,4 @@ class DataIgnore { public java.lang.String toString() { return "DataIgnore(x=" + this.getX() + ")"; } -} +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java index bb3f564d..02101a81 100644 --- a/test/transform/resource/after-delombok/DataOnLocalClass.java +++ b/test/transform/resource/after-delombok/DataOnLocalClass.java @@ -23,13 +23,17 @@ class DataOnLocalClass1 { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (o == null) return false; - if (o.getClass() != this.getClass()) return false; + if (!(o instanceof Local)) return false; final Local other = (Local)o; + if (!other.canEqual(this)) return false; if (this.getX() != other.getX()) return false; if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false; return true; } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof Local; + } @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { @@ -73,12 +77,16 @@ class DataOnLocalClass2 { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (o == null) return false; - if (o.getClass() != this.getClass()) return false; + if (!(o instanceof InnerLocal)) return false; final InnerLocal other = (InnerLocal)o; + if (!other.canEqual(this)) return false; if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false; return true; } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof InnerLocal; + } @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { @@ -105,12 +113,16 @@ class DataOnLocalClass2 { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (o == null) return false; - if (o.getClass() != this.getClass()) return false; + if (!(o instanceof Local)) return false; final Local other = (Local)o; + if (!other.canEqual(this)) return false; if (this.getX() != other.getX()) return false; return true; } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof Local; + } @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java index 1e11a33d..ef86f9d7 100644 --- a/test/transform/resource/after-delombok/DataPlain.java +++ b/test/transform/resource/after-delombok/DataPlain.java @@ -22,13 +22,17 @@ class Data1 { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (o == null) return false; - if (o.getClass() != this.getClass()) return false; + if (!(o instanceof Data1)) return false; final Data1 other = (Data1)o; + if (!other.canEqual(this)) return false; if (this.getX() != other.getX()) return false; if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false; return true; } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof Data1; + } @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { @@ -68,13 +72,17 @@ class Data2 { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (o == null) return false; - if (o.getClass() != this.getClass()) return false; + if (!(o instanceof Data2)) return false; final Data2 other = (Data2)o; + if (!other.canEqual(this)) return false; if (this.getX() != other.getX()) return false; if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false; return true; } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof Data2; + } @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { @@ -90,3 +98,87 @@ class Data2 { return "Data2(x=" + this.getX() + ", name=" + this.getName() + ")"; } } +final class Data3 { + final int x; + String name; + @java.beans.ConstructorProperties({"x"}) + @java.lang.SuppressWarnings("all") + public Data3(final int x) { + this.x = x; + } + @java.lang.SuppressWarnings("all") + public int getX() { + return this.x; + } + @java.lang.SuppressWarnings("all") + public String getName() { + return this.name; + } + @java.lang.SuppressWarnings("all") + public void setName(final String name) { + this.name = name; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof Data3)) return false; + final Data3 other = (Data3)o; + if (this.getX() != other.getX()) return false; + if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = result * PRIME + this.getX(); + result = result * PRIME + (this.getName() == null ? 0 : this.getName().hashCode()); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "Data3(x=" + this.getX() + ", name=" + this.getName() + ")"; + } +} +final class Data4 extends java.util.Timer { + final int x; + Data4() { + super(); + } + @java.lang.SuppressWarnings("all") + public int getX() { + return this.x; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "Data4(x=" + this.getX() + ")"; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof Data4)) return false; + final Data4 other = (Data4)o; + if (!other.canEqual(this)) return false; + if (!super.equals(o)) return false; + if (this.getX() != other.getX()) return false; + return true; + } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof Data4; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = result * PRIME + super.hashCode(); + result = result * PRIME + this.getX(); + return result; + } +} diff --git a/test/transform/resource/after-delombok/DataWithGetter.java b/test/transform/resource/after-delombok/DataWithGetter.java index 28b8dee0..1e181370 100644 --- a/test/transform/resource/after-delombok/DataWithGetter.java +++ b/test/transform/resource/after-delombok/DataWithGetter.java @@ -19,14 +19,18 @@ class DataWithGetter { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (o == null) return false; - if (o.getClass() != this.getClass()) return false; + if (!(o instanceof DataWithGetter)) return false; final DataWithGetter other = (DataWithGetter)o; + if (!other.canEqual(this)) return false; if (this.getX() != other.getX()) return false; if (this.getY() != other.getY()) return false; if (this.getZ() == null ? other.getZ() != null : !this.getZ().equals(other.getZ())) return false; return true; } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof DataWithGetter; + } @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { diff --git a/test/transform/resource/after-delombok/DataWithGetterNone.java b/test/transform/resource/after-delombok/DataWithGetterNone.java index 161c70f9..b1cab7cf 100644 --- a/test/transform/resource/after-delombok/DataWithGetterNone.java +++ b/test/transform/resource/after-delombok/DataWithGetterNone.java @@ -19,14 +19,18 @@ class DataWithGetterNone { @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; - if (o == null) return false; - if (o.getClass() != this.getClass()) return false; + if (!(o instanceof DataWithGetterNone)) return false; final DataWithGetterNone other = (DataWithGetterNone)o; + if (!other.canEqual(this)) return false; if (this.x != other.x) return false; if (this.y != other.y) return false; if (this.z == null ? other.z != null : !this.z.equals(other.z)) return false; return true; } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof DataWithGetterNone; + } @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { diff --git a/test/transform/resource/after-delombok/LoggerCommons.java b/test/transform/resource/after-delombok/LoggerCommons.java new file mode 100644 index 00000000..a55aa336 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerCommons.java @@ -0,0 +1,9 @@ +class LoggerCommons { + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommons.class); +} +class LoggerCommonsString { + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(String.class); +} +class LoggerCommonsJavaLangString { + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(java.lang.String.class); +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerJul.java b/test/transform/resource/after-delombok/LoggerJul.java new file mode 100644 index 00000000..51f19926 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerJul.java @@ -0,0 +1,9 @@ +class LoggerJul { + private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJul.class.getName()); +} +class LoggerJulString { + private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(String.class.getName()); +} +class LoggerJulJavaLangString { + private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(java.lang.String.class.getName()); +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerLog4j.java b/test/transform/resource/after-delombok/LoggerLog4j.java new file mode 100644 index 00000000..e946c858 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerLog4j.java @@ -0,0 +1,9 @@ +class LoggerLog4j { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4j.class); +} +class LoggerLog4jString { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(String.class); +} +class LoggerLog4jJavaLangString { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(java.lang.String.class); +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerSlf4j.java b/test/transform/resource/after-delombok/LoggerSlf4j.java new file mode 100644 index 00000000..c7c84631 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerSlf4j.java @@ -0,0 +1,8 @@ +class LoggerSlf4j { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4j.class); +} +class LoggerSlf4jOuter { + static class Inner { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Inner.class); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerSlf4jAlreadyExists.java b/test/transform/resource/after-delombok/LoggerSlf4jAlreadyExists.java new file mode 100644 index 00000000..a7cd9409 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerSlf4jAlreadyExists.java @@ -0,0 +1,3 @@ +class LoggerSlf4jAlreadyExists { + int log; +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerSlf4jClassOfArray.java b/test/transform/resource/after-delombok/LoggerSlf4jClassOfArray.java new file mode 100644 index 00000000..00b44d5c --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerSlf4jClassOfArray.java @@ -0,0 +1,6 @@ +class LoggerSlf4jClassOfArray { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(String[].class); +} +class LoggerSlf4jClassOfArrayJLS { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(java.lang.String[].class); +} diff --git a/test/transform/resource/after-delombok/LoggerSlf4jOnNonType.java b/test/transform/resource/after-delombok/LoggerSlf4jOnNonType.java new file mode 100644 index 00000000..4c944172 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerSlf4jOnNonType.java @@ -0,0 +1,4 @@ +class LoggerSlf4jOnNonType { + void foo() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerSlf4jTypes.java b/test/transform/resource/after-delombok/LoggerSlf4jTypes.java new file mode 100644 index 00000000..4950bc88 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerSlf4jTypes.java @@ -0,0 +1,17 @@ +interface LoggerSlf4jTypesInterface { +} +@interface LoggerSlf4jTypesAnnotation { +} +enum LoggerSlf4jTypesEnum { +; + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jTypesEnum.class); +} +enum LoggerSlf4jTypesEnumWithElement { + FOO; + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jTypesEnumWithElement.class); +} +interface LoggerSlf4jTypesInterfaceOuter { + class Inner { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Inner.class); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerSlf4jWithClass.java b/test/transform/resource/after-delombok/LoggerSlf4jWithClass.java new file mode 100644 index 00000000..b4e2181e --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerSlf4jWithClass.java @@ -0,0 +1,12 @@ +class LoggerSlf4jWithClass { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(String.class); +} +class LoggerSlf4jWithClassList { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(java.util.List.class); +} +class LoggerSlf4jWithClassValue { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(java.lang.String.class); +} +class LoggerSlf4jWithClassVoid { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(void.class); +} diff --git a/test/transform/resource/after-delombok/LoggerSlf4jWithPackage.java b/test/transform/resource/after-delombok/LoggerSlf4jWithPackage.java new file mode 100644 index 00000000..b337bd02 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerSlf4jWithPackage.java @@ -0,0 +1,9 @@ +package before; +class LoggerSlf4jWithPackage { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jWithPackage.class); +} +class LoggerSlf4jWithPackageOuter { + static class Inner { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Inner.class); + } +} diff --git a/test/transform/resource/after-delombok/ValComplex.java b/test/transform/resource/after-delombok/ValComplex.java new file mode 100644 index 00000000..54ef5c78 --- /dev/null +++ b/test/transform/resource/after-delombok/ValComplex.java @@ -0,0 +1,20 @@ +public class ValComplex { + private ValSimple field = new ValSimple(); + private static final int CONSTANT = 20; + public void testReferencingOtherFiles() { + final java.lang.String shouldBeString = field.method(); + final int shouldBeInt = CONSTANT; + final java.lang.Object lock = new Object(); + synchronized (lock) { + final int field = 20; //Shadowing + final int inner = 10; + switch (field) { + case 5: + final java.lang.String shouldBeString2 = shouldBeString; + final int innerInner = inner; + + } + } + final ValSimple shouldBeValSimple = field; //Unshadowing + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValErrors.java b/test/transform/resource/after-delombok/ValErrors.java new file mode 100644 index 00000000..5ac785ab --- /dev/null +++ b/test/transform/resource/after-delombok/ValErrors.java @@ -0,0 +1,8 @@ +public class ValErrors { + public void nullType() { + final val a = null; + } + public void unresolvableExpression() { + final val c = d; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValInFor.java b/test/transform/resource/after-delombok/ValInFor.java new file mode 100644 index 00000000..a04d0f0c --- /dev/null +++ b/test/transform/resource/after-delombok/ValInFor.java @@ -0,0 +1,19 @@ +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 (val shouldBeString : list) { + System.out.println(shouldBeString.toLowerCase()); + val shouldBeString2 = shouldBeString; + } + }*/ +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValLessSimple.java b/test/transform/resource/after-delombok/ValLessSimple.java new file mode 100644 index 00000000..678b419e --- /dev/null +++ b/test/transform/resource/after-delombok/ValLessSimple.java @@ -0,0 +1,26 @@ +public class ValLessSimple { + private short field2 = 5; + private String method() { + return "method"; + } + private double method2() { + return 2.0; + } + { + System.out.println("Hello"); + final int z = 20; + final int x = 10; + final int a = z; + final short y = field2; + } + private void testVal(String param) { + final java.lang.String fieldV = field; + final int a = 10; + final int b = 20; + { + final java.lang.String methodV = method(); + final java.lang.String foo = fieldV + methodV; + } + } + private String field = "field"; +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValSimple.java b/test/transform/resource/after-delombok/ValSimple.java new file mode 100644 index 00000000..b2783eac --- /dev/null +++ b/test/transform/resource/after-delombok/ValSimple.java @@ -0,0 +1,24 @@ +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) { + final java.lang.String fieldV = field; + final java.lang.String methodV = method(); + final java.lang.String paramV = param; + final java.lang.String valOfVal = fieldV; + final java.lang.String operatorV = fieldV + valOfVal; + final short fieldW = field2; + final double methodW = method2(); + byte localVar = 3; + final int operatorW = fieldW + localVar; + } +} diff --git a/test/transform/resource/after-delombok/ValWeirdTypes.java b/test/transform/resource/after-delombok/ValWeirdTypes.java new file mode 100644 index 00000000..66212906 --- /dev/null +++ b/test/transform/resource/after-delombok/ValWeirdTypes.java @@ -0,0 +1,47 @@ +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!"); + final java.lang.String shouldBeString = list.get(0); + final java.util.List<java.lang.String> shouldBeListOfString = list; + final java.util.List<java.lang.String> shouldBeListOfStringToo = Arrays.asList("hello", "world"); + final java.lang.String shouldBeString2 = shouldBeListOfString.get(0); + } + public void testGenericsInference() { + final java.util.List<java.lang.Object> huh = Collections.emptyList(); + final java.util.List<java.lang.Number> huh2 = Collections.<Number>emptyList(); + } + public void testPrimitives() { + final int x = 10; + final long y = 5 + 3L; + } + public void testAnonymousInnerClass() { + final java.lang.Runnable y = new Runnable(){ + public void run() { + } + }; + } + public <T extends Number>void testTypeParams(List<T> param) { + final T t = param.get(0); + final Z z = fieldList.get(0); + final java.util.List<T> k = param; + final java.util.List<Z> y = fieldList; + } + public void testBounds(List<? extends Number> lower, List<? super Number> upper) { + final java.lang.Number a = lower.get(0); + final java.lang.Object b = upper.get(0); + final java.util.List<? extends java.lang.Number> c = lower; + final java.util.List<? super java.lang.Number> d = upper; + List<?> unbound = lower; + final java.util.List<?> e = unbound; + } + public void testCompound() { + final java.util.ArrayList<java.lang.String> a = new ArrayList<String>(); + final java.util.Vector<java.lang.String> b = new Vector<String>(); + final boolean c = 1 < System.currentTimeMillis(); + final java.util.AbstractList<java.lang.String> d = c ? a : b; + java.util.RandomAccess confirm = c ? a : b; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/ClassNamedAfterGetter.java b/test/transform/resource/after-ecj/ClassNamedAfterGetter.java index fdb6f122..fb9df0ea 100644 --- a/test/transform/resource/after-ecj/ClassNamedAfterGetter.java +++ b/test/transform/resource/after-ecj/ClassNamedAfterGetter.java @@ -1,9 +1,9 @@ class GetFoo { private @lombok.Getter int foo; - GetFoo() { - super(); - } public @java.lang.SuppressWarnings("all") int getFoo() { return this.foo; } + GetFoo() { + super(); + } } diff --git a/test/transform/resource/after-ecj/CleanupName.java b/test/transform/resource/after-ecj/CleanupName.java index 944a81e1..4011721b 100644 --- a/test/transform/resource/after-ecj/CleanupName.java +++ b/test/transform/resource/after-ecj/CleanupName.java @@ -10,7 +10,10 @@ class CleanupName { } finally { - o.toString(); + if ((o != null)) + { + o.toString(); + } } } void test2() { @@ -21,7 +24,10 @@ class CleanupName { } finally { - o.toString(); + if ((o != null)) + { + o.toString(); + } } } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/CleanupPlain.java b/test/transform/resource/after-ecj/CleanupPlain.java index 6754b4f6..fe8d7571 100644 --- a/test/transform/resource/after-ecj/CleanupPlain.java +++ b/test/transform/resource/after-ecj/CleanupPlain.java @@ -18,12 +18,18 @@ class CleanupPlain { } finally { - out.close(); + if ((out != null)) + { + out.close(); + } } } finally { - in.close(); + if ((in != null)) + { + in.close(); + } } } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/CommentsInterspersed.java b/test/transform/resource/after-ecj/CommentsInterspersed.java index d708ad72..60c69aed 100644 --- a/test/transform/resource/after-ecj/CommentsInterspersed.java +++ b/test/transform/resource/after-ecj/CommentsInterspersed.java @@ -2,11 +2,11 @@ import lombok.Getter; public class CommentsInterspersed { private int x; private @Getter String test = "foo"; + public @java.lang.SuppressWarnings("all") String getTest() { + return this.test; + } public CommentsInterspersed() { super(); } public native void gwtTest(); - public @java.lang.SuppressWarnings("all") String getTest() { - return this.test; - } } diff --git a/test/transform/resource/after-ecj/DataExtended.java b/test/transform/resource/after-ecj/DataExtended.java index b7be8bcf..10a66547 100644 --- a/test/transform/resource/after-ecj/DataExtended.java +++ b/test/transform/resource/after-ecj/DataExtended.java @@ -12,15 +12,18 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((o == null)) - return false; - if ((o.getClass() != this.getClass())) + if ((! (o instanceof DataExtended))) return false; final DataExtended other = (DataExtended) o; + if ((! other.canEqual(this))) + return false; if ((this.getX() != other.getX())) return false; return true; } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof DataExtended); + } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 31; int result = 1; diff --git a/test/transform/resource/after-ecj/DataIgnore.java b/test/transform/resource/after-ecj/DataIgnore.java index df2254c8..13c8e2f7 100644 --- a/test/transform/resource/after-ecj/DataIgnore.java +++ b/test/transform/resource/after-ecj/DataIgnore.java @@ -11,15 +11,18 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((o == null)) - return false; - if ((o.getClass() != this.getClass())) + if ((! (o instanceof DataIgnore))) return false; final DataIgnore other = (DataIgnore) o; + if ((! other.canEqual(this))) + return false; if ((this.getX() != other.getX())) return false; return true; } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof DataIgnore); + } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 31; int result = 1; diff --git a/test/transform/resource/after-ecj/DataOnLocalClass.java b/test/transform/resource/after-ecj/DataOnLocalClass.java index a17033c2..b987b967 100644 --- a/test/transform/resource/after-ecj/DataOnLocalClass.java +++ b/test/transform/resource/after-ecj/DataOnLocalClass.java @@ -23,17 +23,20 @@ class DataOnLocalClass1 { public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((o == null)) - return false; - if ((o.getClass() != this.getClass())) + if ((! (o instanceof Local))) return false; final Local other = (Local) o; + if ((! other.canEqual(this))) + return false; if ((this.getX() != other.getX())) return false; if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals(other.getName())))) return false; return true; } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Local); + } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 31; int result = 1; @@ -69,15 +72,18 @@ class DataOnLocalClass2 { public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((o == null)) - return false; - if ((o.getClass() != this.getClass())) + if ((! (o instanceof InnerLocal))) return false; final InnerLocal other = (InnerLocal) o; + if ((! other.canEqual(this))) + return false; if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals(other.getName())))) return false; return true; } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof InnerLocal); + } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 31; int result = 1; @@ -99,15 +105,18 @@ class DataOnLocalClass2 { public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((o == null)) - return false; - if ((o.getClass() != this.getClass())) + if ((! (o instanceof Local))) return false; final Local other = (Local) o; + if ((! other.canEqual(this))) + return false; if ((this.getX() != other.getX())) return false; return true; } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Local); + } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 31; int result = 1; diff --git a/test/transform/resource/after-ecj/DataPlain.java b/test/transform/resource/after-ecj/DataPlain.java index b6e385f3..d704a249 100644 --- a/test/transform/resource/after-ecj/DataPlain.java +++ b/test/transform/resource/after-ecj/DataPlain.java @@ -18,17 +18,20 @@ import lombok.Data; public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((o == null)) - return false; - if ((o.getClass() != this.getClass())) + if ((! (o instanceof Data1))) return false; final Data1 other = (Data1) o; + if ((! other.canEqual(this))) + return false; if ((this.getX() != other.getX())) return false; if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals(other.getName())))) return false; return true; } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Data1); + } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 31; int result = 1; @@ -59,17 +62,20 @@ import lombok.Data; public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((o == null)) - return false; - if ((o.getClass() != this.getClass())) + if ((! (o instanceof Data2))) return false; final Data2 other = (Data2) o; + if ((! other.canEqual(this))) + return false; if ((this.getX() != other.getX())) return false; if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals(other.getName())))) return false; return true; } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Data2); + } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 31; int result = 1; @@ -81,3 +87,78 @@ import lombok.Data; return (((("Data2(x=" + this.getX()) + ", name=") + this.getName()) + ")"); } } +final @Data class Data3 { + final int x; + String name; + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data3(final int x) { + super(); + this.x = x; + } + public @java.lang.SuppressWarnings("all") int getX() { + return this.x; + } + public @java.lang.SuppressWarnings("all") String getName() { + return this.name; + } + public @java.lang.SuppressWarnings("all") void setName(final String name) { + this.name = name; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Data3))) + return false; + final Data3 other = (Data3) o; + if ((this.getX() != other.getX())) + return false; + if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals(other.getName())))) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 31; + int result = 1; + result = ((result * PRIME) + this.getX()); + result = ((result * PRIME) + ((this.getName() == null) ? 0 : this.getName().hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("Data3(x=" + this.getX()) + ", name=") + this.getName()) + ")"); + } +} +final @Data @lombok.EqualsAndHashCode(callSuper = true) class Data4 extends java.util.Timer { + final int x; + public @java.lang.SuppressWarnings("all") int getX() { + return this.x; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("Data4(x=" + this.getX()) + ")"); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Data4))) + return false; + final Data4 other = (Data4) o; + if ((! other.canEqual(this))) + return false; + if ((! super.equals(o))) + return false; + if ((this.getX() != other.getX())) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Data4); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 31; + int result = 1; + result = ((result * PRIME) + super.hashCode()); + result = ((result * PRIME) + this.getX()); + return result; + } + Data4() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/DataWithGetter.java b/test/transform/resource/after-ecj/DataWithGetter.java index abf1dc64..904ae0fa 100644 --- a/test/transform/resource/after-ecj/DataWithGetter.java +++ b/test/transform/resource/after-ecj/DataWithGetter.java @@ -15,11 +15,11 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((o == null)) - return false; - if ((o.getClass() != this.getClass())) + if ((! (o instanceof DataWithGetter))) return false; final DataWithGetter other = (DataWithGetter) o; + if ((! other.canEqual(this))) + return false; if ((this.getX() != other.getX())) return false; if ((this.getY() != other.getY())) @@ -28,6 +28,9 @@ return false; return true; } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof DataWithGetter); + } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 31; int result = 1; diff --git a/test/transform/resource/after-ecj/DataWithGetterNone.java b/test/transform/resource/after-ecj/DataWithGetterNone.java index 97509c07..0172f4f3 100644 --- a/test/transform/resource/after-ecj/DataWithGetterNone.java +++ b/test/transform/resource/after-ecj/DataWithGetterNone.java @@ -15,11 +15,11 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; - if ((o == null)) - return false; - if ((o.getClass() != this.getClass())) + if ((! (o instanceof DataWithGetterNone))) return false; final DataWithGetterNone other = (DataWithGetterNone) o; + if ((! other.canEqual(this))) + return false; if ((this.x != other.x)) return false; if ((this.y != other.y)) @@ -28,6 +28,9 @@ return false; return true; } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof DataWithGetterNone); + } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 31; int result = 1; diff --git a/test/transform/resource/after-ecj/GetterAccessLevel.java b/test/transform/resource/after-ecj/GetterAccessLevel.java index 14edfb56..f0de95e7 100644 --- a/test/transform/resource/after-ecj/GetterAccessLevel.java +++ b/test/transform/resource/after-ecj/GetterAccessLevel.java @@ -10,9 +10,6 @@ class GetterAccessLevel { @lombok.Getter(lombok.AccessLevel.PROTECTED) String protectedString; @lombok.Getter(lombok.AccessLevel.PUBLIC) String publicString; @lombok.Getter(value = lombok.AccessLevel.PUBLIC) String value; - GetterAccessLevel() { - super(); - } private @java.lang.SuppressWarnings("all") boolean isPrivate() { return this.isPrivate; } @@ -40,4 +37,7 @@ class GetterAccessLevel { public @java.lang.SuppressWarnings("all") String getValue() { return this.value; } + GetterAccessLevel() { + super(); + } } diff --git a/test/transform/resource/after-ecj/GetterAlreadyExists.java b/test/transform/resource/after-ecj/GetterAlreadyExists.java index 959b6a64..f491f147 100644 --- a/test/transform/resource/after-ecj/GetterAlreadyExists.java +++ b/test/transform/resource/after-ecj/GetterAlreadyExists.java @@ -27,27 +27,27 @@ class Getter3 { } class Getter4 { @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } Getter4() { super(); } String hasFoo() { return null; } - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } } class Getter5 { @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } Getter5() { super(); } String isFoo() { return null; } - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } } class Getter6 { @lombok.Getter String foo; @@ -60,27 +60,27 @@ class Getter6 { } class Getter7 { @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } Getter7() { super(); } boolean hasFoo() { return false; } - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } } class Getter8 { @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } Getter8() { super(); } boolean isFoo() { return false; } - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } } class Getter9 { @lombok.Getter String foo; @@ -120,27 +120,27 @@ class Getter12 { } class Getter13 { @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } Getter13() { super(); } static boolean hasFoo() { return false; } - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } } class Getter14 { @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } Getter14() { super(); } static boolean isFoo() { return false; } - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } } class Getter15 { @lombok.Getter String foo; @@ -153,27 +153,27 @@ class Getter15 { } class Getter16 { @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } Getter16() { super(); } static String hasFoo() { return false; } - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } } class Getter17 { @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } Getter17() { super(); } static String isFoo() { return false; } - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } } class Getter18 { @lombok.Getter String foo; diff --git a/test/transform/resource/after-ecj/GetterBoolean.java b/test/transform/resource/after-ecj/GetterBoolean.java index caf758c1..e9e4f370 100644 --- a/test/transform/resource/after-ecj/GetterBoolean.java +++ b/test/transform/resource/after-ecj/GetterBoolean.java @@ -2,9 +2,6 @@ class Getter { @lombok.Getter boolean foo; @lombok.Getter boolean isBar; @lombok.Getter boolean hasBaz; - Getter() { - super(); - } public @java.lang.SuppressWarnings("all") boolean isFoo() { return this.foo; } @@ -14,6 +11,9 @@ class Getter { public @java.lang.SuppressWarnings("all") boolean hasBaz() { return this.hasBaz; } + Getter() { + super(); + } } class MoreGetter { @lombok.Getter boolean foo; diff --git a/test/transform/resource/after-ecj/GetterOnClass.java b/test/transform/resource/after-ecj/GetterOnClass.java index 7668c9d3..421aa150 100644 --- a/test/transform/resource/after-ecj/GetterOnClass.java +++ b/test/transform/resource/after-ecj/GetterOnClass.java @@ -1,67 +1,68 @@ @lombok.Getter class GetterOnClass1 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isPublic; - GetterOnClass1() { - super(); - } public @java.lang.SuppressWarnings("all") boolean isPublic() { return this.isPublic; } + GetterOnClass1() { + super(); + } + } @lombok.Getter(lombok.AccessLevel.PROTECTED) class GetterOnClass2 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isProtected; @lombok.Getter(lombok.AccessLevel.PACKAGE) boolean isPackage; - GetterOnClass2() { - super(); - } @java.lang.SuppressWarnings("all") boolean isPackage() { return this.isPackage; } protected @java.lang.SuppressWarnings("all") boolean isProtected() { return this.isProtected; } + GetterOnClass2() { + super(); + } } @lombok.Getter(lombok.AccessLevel.PACKAGE) class GetterOnClass3 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isPackage; - GetterOnClass3() { - super(); - } @java.lang.SuppressWarnings("all") boolean isPackage() { return this.isPackage; } + GetterOnClass3() { + super(); + } } @lombok.Getter(lombok.AccessLevel.PRIVATE) class GetterOnClass4 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isPrivate; - GetterOnClass4() { - super(); - } private @java.lang.SuppressWarnings("all") boolean isPrivate() { return this.isPrivate; } + GetterOnClass4() { + super(); + } } @lombok.Getter(lombok.AccessLevel.PUBLIC) class GetterOnClass5 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isPublic; - GetterOnClass5() { - super(); - } public @java.lang.SuppressWarnings("all") boolean isPublic() { return this.isPublic; } + GetterOnClass5() { + super(); + } } @lombok.Getter class GetterOnClass6 { String couldBeNull; @lombok.NonNull String nonNull; - GetterOnClass6() { - super(); - } public @java.lang.SuppressWarnings("all") String getCouldBeNull() { return this.couldBeNull; } public @lombok.NonNull @java.lang.SuppressWarnings("all") String getNonNull() { return this.nonNull; } -} + GetterOnClass6() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterOnStatic.java b/test/transform/resource/after-ecj/GetterOnStatic.java index ee90b897..538f25cb 100644 --- a/test/transform/resource/after-ecj/GetterOnStatic.java +++ b/test/transform/resource/after-ecj/GetterOnStatic.java @@ -3,13 +3,13 @@ class Getter { static @lombok.Getter int bar; <clinit>() { } - Getter() { - super(); - } public static @java.lang.SuppressWarnings("all") boolean isFoo() { return Getter.foo; } public static @java.lang.SuppressWarnings("all") int getBar() { return Getter.bar; } + Getter() { + super(); + } } diff --git a/test/transform/resource/after-ecj/GetterPlain.java b/test/transform/resource/after-ecj/GetterPlain.java index 19e24c77..cd096ca3 100644 --- a/test/transform/resource/after-ecj/GetterPlain.java +++ b/test/transform/resource/after-ecj/GetterPlain.java @@ -2,13 +2,13 @@ import lombok.Getter; class GetterPlain { @lombok.Getter int i; @Getter int foo; - GetterPlain() { - super(); - } public @java.lang.SuppressWarnings("all") int getI() { return this.i; } public @java.lang.SuppressWarnings("all") int getFoo() { return this.foo; } + GetterPlain() { + super(); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterWithDollar.java b/test/transform/resource/after-ecj/GetterWithDollar.java index f4bc799c..b102ba66 100644 --- a/test/transform/resource/after-ecj/GetterWithDollar.java +++ b/test/transform/resource/after-ecj/GetterWithDollar.java @@ -1,22 +1,22 @@ class GetterWithDollar1 { @lombok.Getter int $i; - GetterWithDollar1() { - super(); - } public @java.lang.SuppressWarnings("all") int get$i() { return this.$i; } + GetterWithDollar1() { + super(); + } } class GetterWithDollar2 { @lombok.Getter int $i; @lombok.Getter int i; - GetterWithDollar2() { - super(); - } public @java.lang.SuppressWarnings("all") int get$i() { return this.$i; } public @java.lang.SuppressWarnings("all") int getI() { return this.i; } + GetterWithDollar2() { + super(); + } } diff --git a/test/transform/resource/after-ecj/LoggerCommons.java b/test/transform/resource/after-ecj/LoggerCommons.java new file mode 100644 index 00000000..bb38983f --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerCommons.java @@ -0,0 +1,24 @@ +@lombok.extern.apachecommons.Log class LoggerCommons { + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommons.class); + <clinit>() { + } + LoggerCommons() { + super(); + } +} +@lombok.extern.apachecommons.Log(String.class) class LoggerCommonsString { + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(String.class); + <clinit>() { + } + LoggerCommonsString() { + super(); + } +} +@lombok.extern.apachecommons.Log(java.lang.String.class) class LoggerCommonsJavaLangString { + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(java.lang.String.class); + <clinit>() { + } + LoggerCommonsJavaLangString() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerJul.java b/test/transform/resource/after-ecj/LoggerJul.java new file mode 100644 index 00000000..3d09cb71 --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerJul.java @@ -0,0 +1,24 @@ +@lombok.extern.jul.Log class LoggerJul { + private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJul.class.getName()); + <clinit>() { + } + LoggerJul() { + super(); + } +} +@lombok.extern.jul.Log(String.class) class LoggerJulString { + private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(String.class.getName()); + <clinit>() { + } + LoggerJulString() { + super(); + } +} +@lombok.extern.jul.Log(java.lang.String.class) class LoggerJulJavaLangString { + private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(java.lang.String.class.getName()); + <clinit>() { + } + LoggerJulJavaLangString() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerLog4j.java b/test/transform/resource/after-ecj/LoggerLog4j.java new file mode 100644 index 00000000..45898a57 --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerLog4j.java @@ -0,0 +1,24 @@ +@lombok.extern.log4j.Log class LoggerLog4j { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4j.class); + <clinit>() { + } + LoggerLog4j() { + super(); + } +} +@lombok.extern.log4j.Log(String.class) class LoggerLog4jString { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(String.class); + <clinit>() { + } + LoggerLog4jString() { + super(); + } +} +@lombok.extern.log4j.Log(java.lang.String.class) class LoggerLog4jJavaLangString { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(java.lang.String.class); + <clinit>() { + } + LoggerLog4jJavaLangString() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerSlf4j.java b/test/transform/resource/after-ecj/LoggerSlf4j.java new file mode 100644 index 00000000..e635ece8 --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerSlf4j.java @@ -0,0 +1,21 @@ +@lombok.extern.slf4j.Log class LoggerSlf4j { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4j.class); + <clinit>() { + } + LoggerSlf4j() { + super(); + } +} +class LoggerSlf4jOuter { + static @lombok.extern.slf4j.Log class Inner { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Inner.class); + <clinit>() { + } + Inner() { + super(); + } + } + LoggerSlf4jOuter() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerSlf4jAlreadyExists.java b/test/transform/resource/after-ecj/LoggerSlf4jAlreadyExists.java new file mode 100644 index 00000000..22fa0eeb --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerSlf4jAlreadyExists.java @@ -0,0 +1,6 @@ +@lombok.extern.slf4j.Log class LoggerSlf4jAlreadyExists { + int log; + LoggerSlf4jAlreadyExists() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerSlf4jClassOfArray.java b/test/transform/resource/after-ecj/LoggerSlf4jClassOfArray.java new file mode 100644 index 00000000..20fe0fde --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerSlf4jClassOfArray.java @@ -0,0 +1,16 @@ +@lombok.extern.slf4j.Log(String[].class) class LoggerSlf4jClassOfArray { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(String[].class); + <clinit>() { + } + LoggerSlf4jClassOfArray() { + super(); + } +} +@lombok.extern.slf4j.Log(java.lang.String[].class) class LoggerSlf4jClassOfArrayJLS { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(java.lang.String[].class); + <clinit>() { + } + LoggerSlf4jClassOfArrayJLS() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerSlf4jOnNonType.java b/test/transform/resource/after-ecj/LoggerSlf4jOnNonType.java new file mode 100644 index 00000000..a45612ae --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerSlf4jOnNonType.java @@ -0,0 +1,7 @@ +class LoggerSlf4jOnNonType { + LoggerSlf4jOnNonType() { + super(); + } + @lombok.extern.slf4j.Log void foo() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerSlf4jTypes.java b/test/transform/resource/after-ecj/LoggerSlf4jTypes.java new file mode 100644 index 00000000..25b3fd86 --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerSlf4jTypes.java @@ -0,0 +1,31 @@ +@lombok.extern.slf4j.Log interface LoggerSlf4jTypesInterface { +} +@lombok.extern.slf4j.Log @interface LoggerSlf4jTypesAnnotation { +} +@lombok.extern.slf4j.Log enum LoggerSlf4jTypesEnum { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jTypesEnum.class); + <clinit>() { + } + LoggerSlf4jTypesEnum() { + super(); + } +} +@lombok.extern.slf4j.Log enum LoggerSlf4jTypesEnumWithElement { + FOO(), + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jTypesEnumWithElement.class); + <clinit>() { + } + LoggerSlf4jTypesEnumWithElement() { + super(); + } +} +interface LoggerSlf4jTypesInterfaceOuter { + @lombok.extern.slf4j.Log class Inner { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Inner.class); + <clinit>() { + } + Inner() { + super(); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerSlf4jWithClass.java b/test/transform/resource/after-ecj/LoggerSlf4jWithClass.java new file mode 100644 index 00000000..9f4846aa --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerSlf4jWithClass.java @@ -0,0 +1,32 @@ +@lombok.extern.slf4j.Log(String.class) class LoggerSlf4jWithClass { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(String.class); + <clinit>() { + } + LoggerSlf4jWithClass() { + super(); + } +} +@lombok.extern.slf4j.Log(java.util.List.class) class LoggerSlf4jWithClassList { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(java.util.List.class); + <clinit>() { + } + LoggerSlf4jWithClassList() { + super(); + } +} +@lombok.extern.slf4j.Log(value = java.lang.String.class) class LoggerSlf4jWithClassValue { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(java.lang.String.class); + <clinit>() { + } + LoggerSlf4jWithClassValue() { + super(); + } +} +@lombok.extern.slf4j.Log(void.class) class LoggerSlf4jWithClassVoid { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(void.class); + <clinit>() { + } + LoggerSlf4jWithClassVoid() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/LoggerSlf4jWithPackage.java b/test/transform/resource/after-ecj/LoggerSlf4jWithPackage.java new file mode 100644 index 00000000..655d14f8 --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerSlf4jWithPackage.java @@ -0,0 +1,22 @@ +package before; +@lombok.extern.slf4j.Log class LoggerSlf4jWithPackage { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jWithPackage.class); + <clinit>() { + } + LoggerSlf4jWithPackage() { + super(); + } +} +class LoggerSlf4jWithPackageOuter { + static @lombok.extern.slf4j.Log class Inner { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Inner.class); + <clinit>() { + } + Inner() { + super(); + } + } + LoggerSlf4jWithPackageOuter() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/MultiFieldGetter.java b/test/transform/resource/after-ecj/MultiFieldGetter.java index 4ed6038d..16368f25 100644 --- a/test/transform/resource/after-ecj/MultiFieldGetter.java +++ b/test/transform/resource/after-ecj/MultiFieldGetter.java @@ -3,26 +3,26 @@ import lombok.AccessLevel; class MultiFieldGetter { @Getter(AccessLevel.PROTECTED) int x; @Getter(AccessLevel.PROTECTED) int y; - MultiFieldGetter() { - super(); - } protected @java.lang.SuppressWarnings("all") int getX() { return this.x; } protected @java.lang.SuppressWarnings("all") int getY() { return this.y; } + MultiFieldGetter() { + super(); + } } @Getter class MultiFieldGetter2 { @Getter(AccessLevel.PACKAGE) int x; @Getter(AccessLevel.PACKAGE) int y; - MultiFieldGetter2() { - super(); - } @java.lang.SuppressWarnings("all") int getX() { return this.x; } @java.lang.SuppressWarnings("all") int getY() { return this.y; } + MultiFieldGetter2() { + super(); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/NonNullPlain.java b/test/transform/resource/after-ecj/NonNullPlain.java index 877f97ae..6f552436 100644 --- a/test/transform/resource/after-ecj/NonNullPlain.java +++ b/test/transform/resource/after-ecj/NonNullPlain.java @@ -1,9 +1,6 @@ class NonNullPlain { @lombok.Setter @lombok.NonNull @lombok.Getter int i; @lombok.Getter @lombok.Setter @lombok.NonNull String s; - NonNullPlain() { - super(); - } public @java.lang.SuppressWarnings("all") void setI(final @lombok.NonNull int i) { this.i = i; } @@ -18,4 +15,7 @@ class NonNullPlain { throw new java.lang.NullPointerException("s"); this.s = s; } + NonNullPlain() { + super(); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterAccessLevel.java b/test/transform/resource/after-ecj/SetterAccessLevel.java index 20eb9d2c..deee8213 100644 --- a/test/transform/resource/after-ecj/SetterAccessLevel.java +++ b/test/transform/resource/after-ecj/SetterAccessLevel.java @@ -5,9 +5,6 @@ class SetterAccessLevel { @lombok.Setter(lombok.AccessLevel.PROTECTED) boolean isProtected; @lombok.Setter(lombok.AccessLevel.PUBLIC) boolean isPublic; @lombok.Setter(value = lombok.AccessLevel.PUBLIC) boolean value; - SetterAccessLevel() { - super(); - } private @java.lang.SuppressWarnings("all") void setIsPrivate(final boolean isPrivate) { this.isPrivate = isPrivate; } @@ -23,4 +20,7 @@ class SetterAccessLevel { public @java.lang.SuppressWarnings("all") void setValue(final boolean value) { this.value = value; } + SetterAccessLevel() { + super(); + } } diff --git a/test/transform/resource/after-ecj/SetterOnClass.java b/test/transform/resource/after-ecj/SetterOnClass.java index e92e217c..084323c4 100644 --- a/test/transform/resource/after-ecj/SetterOnClass.java +++ b/test/transform/resource/after-ecj/SetterOnClass.java @@ -1,63 +1,60 @@ @lombok.Setter class SetterOnClass1 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isPublic; - SetterOnClass1() { - super(); - } public @java.lang.SuppressWarnings("all") void setIsPublic(final boolean isPublic) { this.isPublic = isPublic; } + SetterOnClass1() { + super(); + } } @lombok.Setter(lombok.AccessLevel.PROTECTED) class SetterOnClass2 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isProtected; @lombok.Setter(lombok.AccessLevel.PACKAGE) boolean isPackage; - SetterOnClass2() { - super(); - } @java.lang.SuppressWarnings("all") void setIsPackage(final boolean isPackage) { this.isPackage = isPackage; } protected @java.lang.SuppressWarnings("all") void setIsProtected(final boolean isProtected) { this.isProtected = isProtected; } + SetterOnClass2() { + super(); + } } @lombok.Setter(lombok.AccessLevel.PACKAGE) class SetterOnClass3 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isPackage; - SetterOnClass3() { - super(); - } @java.lang.SuppressWarnings("all") void setIsPackage(final boolean isPackage) { this.isPackage = isPackage; } + SetterOnClass3() { + super(); + } } @lombok.Setter(lombok.AccessLevel.PRIVATE) class SetterOnClass4 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isPrivate; - SetterOnClass4() { - super(); - } private @java.lang.SuppressWarnings("all") void setIsPrivate(final boolean isPrivate) { this.isPrivate = isPrivate; } + SetterOnClass4() { + super(); + } } @lombok.Setter(lombok.AccessLevel.PUBLIC) class SetterOnClass5 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isPublic; - SetterOnClass5() { - super(); - } public @java.lang.SuppressWarnings("all") void setIsPublic(final boolean isPublic) { this.isPublic = isPublic; } + SetterOnClass5() { + super(); + } } @lombok.Setter class SetterOnClass6 { String couldBeNull; @lombok.NonNull String nonNull; - SetterOnClass6() { - super(); - } public @java.lang.SuppressWarnings("all") void setCouldBeNull(final String couldBeNull) { this.couldBeNull = couldBeNull; } @@ -66,4 +63,7 @@ throw new java.lang.NullPointerException("nonNull"); this.nonNull = nonNull; } + SetterOnClass6() { + super(); + } } diff --git a/test/transform/resource/after-ecj/SetterOnStatic.java b/test/transform/resource/after-ecj/SetterOnStatic.java index 8a5abdd8..c1e4d3d1 100644 --- a/test/transform/resource/after-ecj/SetterOnStatic.java +++ b/test/transform/resource/after-ecj/SetterOnStatic.java @@ -3,13 +3,13 @@ class Setter { static @lombok.Setter int bar; <clinit>() { } - Setter() { - super(); - } public static @java.lang.SuppressWarnings("all") void setFoo(final boolean foo) { Setter.foo = foo; } public static @java.lang.SuppressWarnings("all") void setBar(final int bar) { Setter.bar = bar; } + Setter() { + super(); + } } diff --git a/test/transform/resource/after-ecj/SetterPlain.java b/test/transform/resource/after-ecj/SetterPlain.java index 7f0a4a81..08154244 100644 --- a/test/transform/resource/after-ecj/SetterPlain.java +++ b/test/transform/resource/after-ecj/SetterPlain.java @@ -2,13 +2,13 @@ import lombok.Setter; class SetterPlain { @lombok.Setter int i; @Setter int foo; - SetterPlain() { - super(); - } public @java.lang.SuppressWarnings("all") void setI(final int i) { this.i = i; } public @java.lang.SuppressWarnings("all") void setFoo(final int foo) { this.foo = foo; } + SetterPlain() { + super(); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterWithDollar.java b/test/transform/resource/after-ecj/SetterWithDollar.java index c5bc14f1..bf27536b 100644 --- a/test/transform/resource/after-ecj/SetterWithDollar.java +++ b/test/transform/resource/after-ecj/SetterWithDollar.java @@ -1,22 +1,22 @@ class SetterWithDollar1 { @lombok.Setter int $i; - SetterWithDollar1() { - super(); - } public @java.lang.SuppressWarnings("all") void set$i(final int $i) { this.$i = $i; } + SetterWithDollar1() { + super(); + } } class SetterWithDollar2 { @lombok.Setter int $i; @lombok.Setter int i; - SetterWithDollar2() { - super(); - } public @java.lang.SuppressWarnings("all") void set$i(final int $i) { this.$i = $i; } public @java.lang.SuppressWarnings("all") void setI(final int i) { this.i = i; } + SetterWithDollar2() { + super(); + } } diff --git a/test/transform/resource/after-ecj/SynchronizedPlain.java b/test/transform/resource/after-ecj/SynchronizedPlain.java index b9f032c5..8e5b6297 100644 --- a/test/transform/resource/after-ecj/SynchronizedPlain.java +++ b/test/transform/resource/after-ecj/SynchronizedPlain.java @@ -19,6 +19,8 @@ class SynchronizedPlain1 { } class SynchronizedPlain2 { private static final @java.lang.SuppressWarnings("all") java.lang.Object $LOCK = new java.lang.Object[0]; + <clinit>() { + } SynchronizedPlain2() { super(); } diff --git a/test/transform/resource/after-ecj/ToStringInner.java b/test/transform/resource/after-ecj/ToStringInner.java index 2f14407e..963299db 100644 --- a/test/transform/resource/after-ecj/ToStringInner.java +++ b/test/transform/resource/after-ecj/ToStringInner.java @@ -2,31 +2,31 @@ import lombok.ToString; @ToString class ToStringOuter { @ToString class ToStringInner { final int y; - ToStringInner() { - super(); - } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("ToStringOuter.ToStringInner(y=" + this.y) + ")"); } + ToStringInner() { + super(); + } } static @ToString class ToStringStaticInner { final int y; - ToStringStaticInner() { - super(); - } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("ToStringOuter.ToStringStaticInner(y=" + this.y) + ")"); } + ToStringStaticInner() { + super(); + } } class ToStringMiddle { @ToString class ToStringMoreInner { final String name; - ToStringMoreInner() { - super(); - } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("ToStringOuter.ToStringMiddle.ToStringMoreInner(name=" + this.name) + ")"); } + ToStringMoreInner() { + super(); + } } ToStringMiddle() { super(); @@ -34,10 +34,10 @@ import lombok.ToString; } final int x; String name; - ToStringOuter() { - super(); - } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("ToStringOuter(x=" + this.x) + ", name=") + this.name) + ")"); } + ToStringOuter() { + super(); + } } diff --git a/test/transform/resource/after-ecj/ToStringPlain.java b/test/transform/resource/after-ecj/ToStringPlain.java index 7196abb9..458f78d0 100644 --- a/test/transform/resource/after-ecj/ToStringPlain.java +++ b/test/transform/resource/after-ecj/ToStringPlain.java @@ -2,20 +2,20 @@ import lombok.ToString; @lombok.ToString class ToString1 { final int x; String name; - ToString1() { - super(); - } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("ToString1(x=" + this.x) + ", name=") + this.name) + ")"); } + ToString1() { + super(); + } } @ToString class ToString2 { final int x; String name; - ToString2() { - super(); - } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("ToString2(x=" + this.x) + ", name=") + this.name) + ")"); } + ToString2() { + super(); + } } 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 diff --git a/test/transform/resource/messages-delombok/LoggerSlf4jAlreadyExists.java.messages b/test/transform/resource/messages-delombok/LoggerSlf4jAlreadyExists.java.messages new file mode 100644 index 00000000..ede6defa --- /dev/null +++ b/test/transform/resource/messages-delombok/LoggerSlf4jAlreadyExists.java.messages @@ -0,0 +1 @@ +1:1 WARNING Field 'log' already exists. diff --git a/test/transform/resource/messages-delombok/LoggerSlf4jOnNonStaticInnerClass.java.messages b/test/transform/resource/messages-delombok/LoggerSlf4jOnNonStaticInnerClass.java.messages new file mode 100644 index 00000000..e0bbdb2a --- /dev/null +++ b/test/transform/resource/messages-delombok/LoggerSlf4jOnNonStaticInnerClass.java.messages @@ -0,0 +1 @@ +2:9 ERROR @Log is not legal on non-static inner classes.
\ No newline at end of file diff --git a/test/transform/resource/messages-delombok/LoggerSlf4jOnNonType.java.messages b/test/transform/resource/messages-delombok/LoggerSlf4jOnNonType.java.messages new file mode 100644 index 00000000..9143d4bc --- /dev/null +++ b/test/transform/resource/messages-delombok/LoggerSlf4jOnNonType.java.messages @@ -0,0 +1 @@ +2:9 ERROR @Log is legal only on types.
\ No newline at end of file diff --git a/test/transform/resource/messages-delombok/LoggerSlf4jTypes.java.messages b/test/transform/resource/messages-delombok/LoggerSlf4jTypes.java.messages new file mode 100644 index 00000000..ba97e38f --- /dev/null +++ b/test/transform/resource/messages-delombok/LoggerSlf4jTypes.java.messages @@ -0,0 +1,2 @@ +1:1 ERROR @Log is legal only on classes and enums. +4:1 ERROR @Log is legal only on classes and enums.
\ No newline at end of file diff --git a/test/transform/resource/messages-delombok/ValErrors.java.messages b/test/transform/resource/messages-delombok/ValErrors.java.messages new file mode 100644 index 00000000..feba6912 --- /dev/null +++ b/test/transform/resource/messages-delombok/ValErrors.java.messages @@ -0,0 +1,2 @@ +3:21 ERROR Cannot use 'val' here because initializer expression does not have a representable type: <nulltype> +7:21 ERROR Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved diff --git a/test/transform/resource/messages-ecj/LoggerSlf4jAlreadyExists.java.messages b/test/transform/resource/messages-ecj/LoggerSlf4jAlreadyExists.java.messages new file mode 100644 index 00000000..f03c7660 --- /dev/null +++ b/test/transform/resource/messages-ecj/LoggerSlf4jAlreadyExists.java.messages @@ -0,0 +1 @@ +1 warning Field 'log' already exists. diff --git a/test/transform/resource/messages-ecj/LoggerSlf4jOnNonStaticInnerClass.java.messages b/test/transform/resource/messages-ecj/LoggerSlf4jOnNonStaticInnerClass.java.messages new file mode 100644 index 00000000..e0bbdb2a --- /dev/null +++ b/test/transform/resource/messages-ecj/LoggerSlf4jOnNonStaticInnerClass.java.messages @@ -0,0 +1 @@ +2:9 ERROR @Log is not legal on non-static inner classes.
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/LoggerSlf4jOnNonType.java.messages b/test/transform/resource/messages-ecj/LoggerSlf4jOnNonType.java.messages new file mode 100644 index 00000000..4a446f28 --- /dev/null +++ b/test/transform/resource/messages-ecj/LoggerSlf4jOnNonType.java.messages @@ -0,0 +1 @@ +2 error @Log is legal only on types.
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/LoggerSlf4jTypes.java.messages b/test/transform/resource/messages-ecj/LoggerSlf4jTypes.java.messages new file mode 100644 index 00000000..42236c7c --- /dev/null +++ b/test/transform/resource/messages-ecj/LoggerSlf4jTypes.java.messages @@ -0,0 +1,2 @@ +1 error @Log is legal only on classes and enums. +4 error @Log is legal only on classes and enums.
\ No newline at end of file |