diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-05-15 00:50:58 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-05-15 00:50:58 +0200 |
commit | 649a7b72bf8119e286e991bce29fb63bdb26c09d (patch) | |
tree | 6dc4c63ab9658f1fba390a98072511e560247064 /test | |
parent | 323cc5267e5c86277c0e3edfb16755202cec04ba (diff) | |
download | lombok-649a7b72bf8119e286e991bce29fb63bdb26c09d.tar.gz lombok-649a7b72bf8119e286e991bce29fb63bdb26c09d.tar.bz2 lombok-649a7b72bf8119e286e991bce29fb63bdb26c09d.zip |
[new-style include/exclude] added new-style include/exclude support to EqualsAndHashCode.
Diffstat (limited to 'test')
3 files changed, 115 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeNewStyle.java b/test/transform/resource/after-delombok/EqualsAndHashCodeNewStyle.java new file mode 100644 index 00000000..59c7b806 --- /dev/null +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeNewStyle.java @@ -0,0 +1,46 @@ +public class EqualsAndHashCodeNewStyle { + int b; + double c; + int f; + int d; + int f() { + return 0; + } + int g; + long i() { + return 0; + } + int j; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCodeNewStyle)) return false; + final EqualsAndHashCodeNewStyle other = (EqualsAndHashCodeNewStyle) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (this.b != other.b) return false; + if (java.lang.Double.compare(this.c, other.c) != 0) return false; + if (this.d != other.d) return false; + if (this.f() != other.f()) return false; + if (this.i() != other.i()) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCodeNewStyle; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.b; + final long $c = java.lang.Double.doubleToLongBits(this.c); + result = result * PRIME + (int) ($c >>> 32 ^ $c); + result = result * PRIME + this.d; + result = result * PRIME + this.f(); + final long $$i = this.i(); + result = result * PRIME + (int) ($$i >>> 32 ^ $$i); + return result; + } +} diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeNewStyle.java b/test/transform/resource/after-ecj/EqualsAndHashCodeNewStyle.java new file mode 100644 index 00000000..7fbe6d24 --- /dev/null +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeNewStyle.java @@ -0,0 +1,53 @@ +import lombok.EqualsAndHashCode; +public @EqualsAndHashCode class EqualsAndHashCodeNewStyle { + @EqualsAndHashCode.Include int b; + double c; + int f; + @EqualsAndHashCode.Include int d; + int g; + @EqualsAndHashCode.Exclude int j; + public EqualsAndHashCodeNewStyle() { + super(); + } + @EqualsAndHashCode.Include int f() { + return 0; + } + @EqualsAndHashCode.Include(replaces = "g") long i() { + return 0; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCodeNewStyle))) + return false; + final EqualsAndHashCodeNewStyle other = (EqualsAndHashCodeNewStyle) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.b != other.b)) + return false; + if ((java.lang.Double.compare(this.c, other.c) != 0)) + return false; + if ((this.d != other.d)) + return false; + if ((this.f() != other.f())) + return false; + if ((this.i() != other.i())) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof EqualsAndHashCodeNewStyle); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.b); + final long $c = java.lang.Double.doubleToLongBits(this.c); + result = ((result * PRIME) + (int) ($c ^ ($c >>> 32))); + result = ((result * PRIME) + this.d); + result = ((result * PRIME) + this.f()); + final long $$i = this.i(); + result = ((result * PRIME) + (int) ($$i ^ ($$i >>> 32))); + return result; + } +} diff --git a/test/transform/resource/before/EqualsAndHashCodeNewStyle.java b/test/transform/resource/before/EqualsAndHashCodeNewStyle.java new file mode 100644 index 00000000..0665d120 --- /dev/null +++ b/test/transform/resource/before/EqualsAndHashCodeNewStyle.java @@ -0,0 +1,16 @@ +import lombok.EqualsAndHashCode; +@EqualsAndHashCode +public class EqualsAndHashCodeNewStyle { + @EqualsAndHashCode.Include int b; + double c; + int f; + @EqualsAndHashCode.Include int d; + @EqualsAndHashCode.Include int f() { + return 0; + } + int g; + @EqualsAndHashCode.Include(replaces = "g") long i() { + return 0; + } + @EqualsAndHashCode.Exclude int j; +} |