Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for explicit empty "of" and "exclude" annotation values for @to…
…string and @EqualsAndHashCode fixed #342
- Loading branch information
1 parent
1d8f525
commit 125b247
Showing
24 changed files
with
228 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
58 changes: 58 additions & 0 deletions
58
testData/after/equalsandhashcode/EqualsAndHashCodeExplicitEmptyOf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
class EqualsAndHashCode { | |||
int x; | |||
boolean[] y; | |||
Object[] z; | |||
String a; | |||
String b; | |||
|
|||
@java.lang.Override | |||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
public boolean equals(final java.lang.Object o) { | |||
if (o == this) return true; | |||
if (!(o instanceof EqualsAndHashCode)) return false; | |||
final EqualsAndHashCode other = (EqualsAndHashCode) o; | |||
if (!other.canEqual((java.lang.Object) this)) return false; | |||
return true; | |||
} | |||
|
|||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
protected boolean canEqual(final java.lang.Object other) { | |||
return other instanceof EqualsAndHashCode; | |||
} | |||
|
|||
@java.lang.Override | |||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
public int hashCode() { | |||
int result = 1; | |||
return result; | |||
} | |||
} | |||
|
|||
final class EqualsAndHashCode2 { | |||
int x; | |||
long y; | |||
float f; | |||
double d; | |||
boolean b; | |||
|
|||
@java.lang.Override | |||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
public boolean equals(final java.lang.Object o) { | |||
if (o == this) return true; | |||
if (!(o instanceof EqualsAndHashCode2)) return false; | |||
final EqualsAndHashCode2 other = (EqualsAndHashCode2) o; | |||
return true; | |||
} | |||
|
|||
@java.lang.Override | |||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
public int hashCode() { | |||
int result = 1; | |||
return result; | |||
} | |||
} |
37 changes: 37 additions & 0 deletions
37
testData/after/equalsandhashcode/EqualsAndHashCodeExplicitOfAndExclude.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
class EqualsAndHashCode { | |||
int x; | |||
boolean[] y; | |||
Object[] z; | |||
String a; | |||
String b; | |||
|
|||
@java.lang.Override | |||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
public boolean equals(final java.lang.Object o) { | |||
if (o == this) return true; | |||
if (!(o instanceof EqualsAndHashCode)) return false; | |||
final EqualsAndHashCode other = (EqualsAndHashCode) o; | |||
if (!other.canEqual((java.lang.Object) this)) return false; | |||
if (this.x != other.x) return false; | |||
if (!java.util.Arrays.deepEquals(this.z, other.z)) return false; | |||
return true; | |||
} | |||
|
|||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
protected boolean canEqual(final java.lang.Object other) { | |||
return other instanceof EqualsAndHashCode; | |||
} | |||
|
|||
@java.lang.Override | |||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
public int hashCode() { | |||
final int PRIME = 59; | |||
int result = 1; | |||
result = result * PRIME + this.x; | |||
result = result * PRIME + java.util.Arrays.deepHashCode(this.z); | |||
return result; | |||
} | |||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
class ToStringExplicitEmptyOf1 { | |||
int x; | |||
String name; | |||
|
|||
@java.lang.Override | |||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
public java.lang.String toString() { | |||
return "ToStringExplicitEmptyOf1()"; | |||
} | |||
} | |||
|
|||
class ToStringExplicitEmptyOf2 { | |||
int x; | |||
String name; | |||
|
|||
@java.lang.Override | |||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
public java.lang.String toString() { | |||
return "ToStringExplicitEmptyOf2()"; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
class ToStringExplicitOfAndExclude { | |||
int x; | |||
float y; | |||
long z; | |||
String name; | |||
|
|||
@java.lang.Override | |||
@java.lang.SuppressWarnings("all") | |||
@javax.annotation.Generated("lombok") | |||
public java.lang.String toString() { | |||
return "ToStringExplicitOfAndExclude(x=" + this.x + ", z=" + this.z + ")"; | |||
} | |||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions
17
testData/before/equalsandhashcode/EqualsAndHashCodeExplicitEmptyOf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
@lombok.EqualsAndHashCode(of={}) | |||
class EqualsAndHashCode { | |||
int x; | |||
boolean[] y; | |||
Object[] z; | |||
String a; | |||
String b; | |||
} | |||
|
|||
@lombok.EqualsAndHashCode(of="") | |||
final class EqualsAndHashCode2 { | |||
int x; | |||
long y; | |||
float f; | |||
double d; | |||
boolean b; | |||
} |
9 changes: 9 additions & 0 deletions
9
testData/before/equalsandhashcode/EqualsAndHashCodeExplicitOfAndExclude.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
@lombok.EqualsAndHashCode(of = {"x", "z"}, exclude = {"x", "y"}) | |||
class EqualsAndHashCode { | |||
int x; | |||
boolean[] y; | |||
Object[] z; | |||
String a; | |||
String b; | |||
} | |||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,11 @@ | |||
@lombok.ToString(of = {}) | |||
class ToStringExplicitEmptyOf1 { | |||
int x; | |||
String name; | |||
} | |||
|
|||
@lombok.ToString(of = "") | |||
class ToStringExplicitEmptyOf2 { | |||
int x; | |||
String name; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
@lombok.ToString(of = {"x", "z"}, exclude = "x") | |||
class ToStringExplicitOfAndExclude { | |||
int x; | |||
float y; | |||
long z; | |||
String name; | |||
} |
File renamed without changes.
File renamed without changes.