diff options
| author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2010-11-09 20:37:25 +0100 |
|---|---|---|
| committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2010-11-09 20:37:25 +0100 |
| commit | 46d471e9c3dc32b03c34804df1819739a4dffc50 (patch) | |
| tree | 9c31d75426bf8fdb1943bef2a996485640f7bf5e /test | |
| parent | 92b7efac48c18f22b81098cf1d844a891bb71648 (diff) | |
| parent | 98d8a9f63b3183005174abb7691a1692347b9a2e (diff) | |
| download | lombok-46d471e9c3dc32b03c34804df1819739a4dffc50.tar.gz lombok-46d471e9c3dc32b03c34804df1819739a4dffc50.tar.bz2 lombok-46d471e9c3dc32b03c34804df1819739a4dffc50.zip | |
Merge branch 'master' into annoGetSet
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; } + @ja |
