aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2012-04-29 22:24:59 +0200
committerRoel Spilker <r.spilker@gmail.com>2012-04-29 23:57:47 +0200
commit5a13db5dc967367b9e3ec85bb5f07e65a1df09b7 (patch)
tree3efc9cd7bd106745d158054b103d20d6478114ab /test/transform/resource/after-delombok
parentd8e933223fb162175f550bee69b5a0153e11ff66 (diff)
downloadlombok-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')
-rw-r--r--test/transform/resource/after-delombok/Accessors.java28
-rw-r--r--test/transform/resource/after-delombok/DataOnLocalClass.java14
-rw-r--r--test/transform/resource/after-delombok/DataPlain.java21
-rw-r--r--test/transform/resource/after-delombok/DataWithGetter.java7
-rw-r--r--test/transform/resource/after-delombok/DataWithGetterNone.java7
-rw-r--r--test/transform/resource/after-delombok/EqualsAndHashCode.java24
-rw-r--r--test/transform/resource/after-delombok/GetterLazyEahcToString.java14
7 files changed, 72 insertions, 43 deletions
diff --git a/test/transform/resource/after-delombok/Accessors.java b/test/transform/resource/after-delombok/Accessors.java
index b21f2de9..28ffc531 100644
--- a/test/transform/resource/after-delombok/Accessors.java
+++ b/test/transform/resource/after-delombok/Accessors.java
@@ -1,89 +1,70 @@
class AccessorsFluent {
private String fieldName = "";
-
@java.lang.SuppressWarnings("all")
public String fieldName() {
return this.fieldName;
}
-
@java.lang.SuppressWarnings("all")
public AccessorsFluent fieldName(final String fieldName) {
this.fieldName = fieldName;
return this;
}
}
-
class AccessorsFluentOnClass {
private String fieldName = "";
private String otherFieldWithOverride = "";
-
@java.lang.SuppressWarnings("all")
public String fieldName() {
return this.fieldName;
}
-
@java.lang.SuppressWarnings("all")
public String getOtherFieldWithOverride() {
return this.otherFieldWithOverride;
}
-
@java.lang.SuppressWarnings("all")
public AccessorsFluentOnClass fieldName(final String fieldName) {
this.fieldName = fieldName;
return this;
}
}
-
class AccessorsChain {
private boolean isRunning;
-
@java.lang.SuppressWarnings("all")
public AccessorsChain setRunning(final boolean isRunning) {
this.isRunning = isRunning;
return this;
}
}
-
class AccessorsPrefix {
-
private String fieldName;
private String fActualField;
-
@java.lang.SuppressWarnings("all")
public void setActualField(final String fActualField) {
this.fActualField = fActualField;
}
}
-
class AccessorsPrefix2 {
-
private String fieldName;
private String fActualField;
-
@java.lang.SuppressWarnings("all")
public void setFieldName(final String fieldName) {
this.fieldName = fieldName;
}
-
@java.lang.SuppressWarnings("all")
public void setActualField(final String fActualField) {
this.fActualField = fActualField;
}
}
-
class AccessorsPrefix3 {
private String fName;
-
private String getName() {
return fName;
}
-
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "AccessorsPrefix3(fName=" + this.getName() + ")";
}
-
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
@@ -91,21 +72,22 @@ class AccessorsPrefix3 {
if (!(o instanceof AccessorsPrefix3)) return false;
final AccessorsPrefix3 other = (AccessorsPrefix3)o;
if (!other.canEqual((java.lang.Object)this)) return false;
- if (this.getName() == null ? other.getName() != null : !this.getName().equals((java.lang.Object)other.getName())) return false;
+ final java.lang.Object this$fName = this.getName();
+ final java.lang.Object other$fName = other.getName();
+ if (this$fName == null ? other$fName != null : !this$fName.equals(other$fName)) return false;
return true;
}
-
@java.lang.SuppressWarnings("all")
public boolean canEqual(final java.lang.Object other) {
return other instanceof AccessorsPrefix3;
}
-
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = result * PRIME + (this.getName() == null ? 0 : this.getName().hashCode());
+ final java.lang.Object $fName = this.getName();
+ result = result * PRIME + ($fName == null ? 0 : $fName.hashCode());
return result;
}
}
diff --git a/test/transform/resource/after-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java
index af5c12a5..ed4d30ca 100644
--- a/test/transform/resource/after-delombok/DataOnLocalClass.java
+++ b/test/transform/resource/after-delombok/DataOnLocalClass.java
@@ -27,7 +27,9 @@ class DataOnLocalClass1 {
final Local other = (Local)o;
if (!other.canEqual((java.lang.Object)this)) return false;
if (this.getX() != other.getX()) return false;
- if (this.getName() == null ? other.getName() != null : !this.getName().equals((java.lang.Object)other.getName())) return false;
+ final java.lang.Object this$name = this.getName();
+ final java.lang.Object other$name = other.getName();
+ if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@@ -40,7 +42,8 @@ class DataOnLocalClass1 {
final int PRIME = 31;
int result = 1;
result = result * PRIME + this.getX();
- result = result * PRIME + (this.getName() == null ? 0 : this.getName().hashCode());
+ final java.lang.Object $name = this.getName();
+ result = result * PRIME + ($name == null ? 0 : $name.hashCode());
return result;
}
@java.lang.Override
@@ -80,7 +83,9 @@ class DataOnLocalClass2 {
if (!(o instanceof Local.InnerLocal)) return false;
final InnerLocal other = (InnerLocal)o;
if (!other.canEqual((java.lang.Object)this)) return false;
- if (this.getName() == null ? other.getName() != null : !this.getName().equals((java.lang.Object)other.getName())) return false;
+ final java.lang.Object this$name = this.getName();
+ final java.lang.Object other$name = other.getName();
+ if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@@ -92,7 +97,8 @@ class DataOnLocalClass2 {
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = result * PRIME + (this.getName() == null ? 0 : this.getName().hashCode());
+ final java.lang.Object $name = this.getName();
+ result = result * PRIME + ($name == null ? 0 : $name.hashCode());
return result;
}
@java.lang.Override
diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java
index 86d0ec18..cb002e07 100644
--- a/test/transform/resource/after-delombok/DataPlain.java
+++ b/test/transform/resource/after-delombok/DataPlain.java
@@ -26,7 +26,9 @@ class Data1 {
final Data1 other = (Data1)o;
if (!other.canEqual((java.lang.Object)this)) return false;
if (this.getX() != other.getX()) return false;
- if (this.getName() == null ? other.getName() != null : !this.getName().equals((java.lang.Object)other.getName())) return false;
+ final java.lang.Object this$name = this.getName();
+ final java.lang.Object other$name = other.getName();
+ if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@@ -39,7 +41,8 @@ class Data1 {
final int PRIME = 31;
int result = 1;
result = result * PRIME + this.getX();
- result = result * PRIME + (this.getName() == null ? 0 : this.getName().hashCode());
+ final java.lang.Object $name = this.getName();
+ result = result * PRIME + ($name == null ? 0 : $name.hashCode());
return result;
}
@java.lang.Override
@@ -76,7 +79,9 @@ class Data2 {
final Data2 other = (Data2)o;
if (!other.canEqual((java.lang.Object)this)) return false;
if (this.getX() != other.getX()) return false;
- if (this.getName() == null ? other.getName() != null : !this.getName().equals((java.lang.Object)other.getName())) return false;
+ final java.lang.Object this$name = this.getName();
+ final java.lang.Object other$name = other.getName();
+ if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@@ -89,7 +94,8 @@ class Data2 {
final int PRIME = 31;
int result = 1;
result = result * PRIME + this.getX();
- result = result * PRIME + (this.getName() == null ? 0 : this.getName().hashCode());
+ final java.lang.Object $name = this.getName();
+ result = result * PRIME + ($name == null ? 0 : $name.hashCode());
return result;
}
@java.lang.Override
@@ -125,7 +131,9 @@ final class Data3 {
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((java.lang.Object)other.getName())) return false;
+ final java.lang.Object this$name = this.getName();
+ final java.lang.Object other$name = other.getName();
+ if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
return true;
}
@java.lang.Override
@@ -134,7 +142,8 @@ final class Data3 {
final int PRIME = 31;
int result = 1;
result = result * PRIME + this.getX();
- result = result * PRIME + (this.getName() == null ? 0 : this.getName().hashCode());
+ final java.lang.Object $name = this.getName();
+ result = result * PRIME + ($name == null ? 0 : $name.hashCode());
return result;
}
@java.lang.Override
diff --git a/test/transform/resource/after-delombok/DataWithGetter.java b/test/transform/resource/after-delombok/DataWithGetter.java
index 79df7aa1..95a4bcbc 100644
--- a/test/transform/resource/after-delombok/DataWithGetter.java
+++ b/test/transform/resource/after-delombok/DataWithGetter.java
@@ -24,7 +24,9 @@ class DataWithGetter {
if (!other.canEqual((java.lang.Object)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((java.lang.Object)other.getZ())) return false;
+ final java.lang.Object this$z = this.getZ();
+ final java.lang.Object other$z = other.getZ();
+ if (this$z == null ? other$z != null : !this$z.equals(other$z)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@@ -38,7 +40,8 @@ class DataWithGetter {
int result = 1;
result = result * PRIME + this.getX();
result = result * PRIME + this.getY();
- result = result * PRIME + (this.getZ() == null ? 0 : this.getZ().hashCode());
+ final java.lang.Object $z = this.getZ();
+ result = result * PRIME + ($z == null ? 0 : $z.hashCode());
return result;
}
@java.lang.Override
diff --git a/test/transform/resource/after-delombok/DataWithGetterNone.java b/test/transform/resource/after-delombok/DataWithGetterNone.java
index 6b907d37..2dea5e49 100644
--- a/test/transform/resource/after-delombok/DataWithGetterNone.java
+++ b/test/transform/resource/after-delombok/DataWithGetterNone.java
@@ -24,7 +24,9 @@ class DataWithGetterNone {
if (!other.canEqual((java.lang.Object)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((java.lang.Object)other.z)) return false;
+ final java.lang.Object this$z = this.z;
+ final java.lang.Object other$z = other.z;
+ if (this$z == null ? other$z != null : !this$z.equals(other$z)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@@ -38,7 +40,8 @@ class DataWithGetterNone {
int result = 1;
result = result * PRIME + this.x;
result = result * PRIME + this.y;
- result = result * PRIME + (this.z == null ? 0 : this.z.hashCode());
+ final java.lang.Object $z = this.z;
+ result = result * PRIME + ($z == null ? 0 : $z.hashCode());
return result;
}
@java.lang.Override
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;
}
}
diff --git a/test/transform/resource/after-delombok/GetterLazyEahcToString.java b/test/transform/resource/after-delombok/GetterLazyEahcToString.java
index a542061d..ce3555fe 100644
--- a/test/transform/resource/after-delombok/GetterLazyEahcToString.java
+++ b/test/transform/resource/after-delombok/GetterLazyEahcToString.java
@@ -10,8 +10,12 @@ class GetterLazyEahcToString {
if (!(o instanceof GetterLazyEahcToString)) return false;
final GetterLazyEahcToString other = (GetterLazyEahcToString)o;
if (!other.canEqual((java.lang.Object)this)) return false;
- if (this.getValue() == null ? other.getValue() != null : !this.getValue().equals((java.lang.Object)other.getValue())) return false;
- if (this.value2 == null ? other.value2 != null : !this.value2.equals((java.lang.Object)other.value2)) return false;
+ final java.lang.Object this$value = this.getValue();
+ final java.lang.Object other$value = other.getValue();
+ if (this$value == null ? other$value != null : !this$value.equals(other$value)) return false;
+ final java.lang.Object this$value2 = this.value2;
+ final java.lang.Object other$value2 = other.value2;
+ if (this$value2 == null ? other$value2 != null : !this$value2.equals(other$value2)) return false;
return true;
}
@@ -25,8 +29,10 @@ class GetterLazyEahcToString {
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = result * PRIME + (this.getValue() == null ? 0 : this.getValue().hashCode());
- result = result * PRIME + (this.value2 == null ? 0 : this.value2.hashCode());
+ final java.lang.Object $value = this.getValue();
+ result = result * PRIME + ($value == null ? 0 : $value.hashCode());
+ final java.lang.Object $value2 = this.value2;
+ result = result * PRIME + ($value2 == null ? 0 : $value2.hashCode());
return result;
}