diff options
author | Roel Spilker <r.spilker@gmail.com> | 2012-04-29 22:24:59 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2012-04-29 23:57:47 +0200 |
commit | 5a13db5dc967367b9e3ec85bb5f07e65a1df09b7 (patch) | |
tree | 3efc9cd7bd106745d158054b103d20d6478114ab /test/transform/resource/after-delombok/EqualsAndHashCode.java | |
parent | d8e933223fb162175f550bee69b5a0153e11ff66 (diff) | |
download | lombok-5a13db5dc967367b9e3ec85bb5f07e65a1df09b7.tar.gz lombok-5a13db5dc967367b9e3ec85bb5f07e65a1df09b7.tar.bz2 lombok-5a13db5dc967367b9e3ec85bb5f07e65a1df09b7.zip |
Issue 366: don't call the getter twice, fixed for javac.
Diffstat (limited to 'test/transform/resource/after-delombok/EqualsAndHashCode.java')
-rw-r--r-- | test/transform/resource/after-delombok/EqualsAndHashCode.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCode.java b/test/transform/resource/after-delombok/EqualsAndHashCode.java index e7f701e8..8f84fb22 100644 --- a/test/transform/resource/after-delombok/EqualsAndHashCode.java +++ b/test/transform/resource/after-delombok/EqualsAndHashCode.java @@ -3,6 +3,7 @@ class EqualsAndHashCode { boolean[] y; Object[] z; String a; + String b; @java.lang.Override @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { @@ -13,7 +14,12 @@ class EqualsAndHashCode { if (this.x != other.x) return false; if (!java.util.Arrays.equals(this.y, other.y)) return false; if (!java.util.Arrays.deepEquals(this.z, other.z)) return false; - if (this.a == null ? other.a != null : !this.a.equals((java.lang.Object)other.a)) return false; + final java.lang.Object this$a = this.a; + final java.lang.Object other$a = other.a; + if (this$a == null ? other$a != null : !this$a.equals(other$a)) return false; + final java.lang.Object this$b = this.b; + final java.lang.Object other$b = other.b; + if (this$b == null ? other$b != null : !this$b.equals(other$b)) return false; return true; } @java.lang.SuppressWarnings("all") @@ -28,12 +34,18 @@ class EqualsAndHashCode { result = result * PRIME + this.x; result = result * PRIME + java.util.Arrays.hashCode(this.y); result = result * PRIME + java.util.Arrays.deepHashCode(this.z); - result = result * PRIME + (this.a == null ? 0 : this.a.hashCode()); + final java.lang.Object $a = this.a; + result = result * PRIME + ($a == null ? 0 : $a.hashCode()); + final java.lang.Object $b = this.b; + result = result * PRIME + ($b == null ? 0 : $b.hashCode()); return result; } } final class EqualsAndHashCode2 { int x; + long y; + float f; + double d; @java.lang.Override @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { @@ -41,6 +53,9 @@ final class EqualsAndHashCode2 { if (!(o instanceof EqualsAndHashCode2)) return false; final EqualsAndHashCode2 other = (EqualsAndHashCode2)o; if (this.x != other.x) return false; + if (this.y != other.y) return false; + if (java.lang.Float.compare(this.f, other.f) != 0) return false; + if (java.lang.Double.compare(this.d, other.d) != 0) return false; return true; } @java.lang.Override @@ -49,6 +64,11 @@ final class EqualsAndHashCode2 { final int PRIME = 31; int result = 1; result = result * PRIME + this.x; + final long $y = this.y; + result = result * PRIME + (int)($y >>> 32 ^ $y); + result = result * PRIME + java.lang.Float.floatToIntBits(this.f); + final long $d = java.lang.Double.doubleToLongBits(this.d); + result = result * PRIME + (int)($d >>> 32 ^ $d); return result; } } |