mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 06:15:41 +00:00
Fixed issue 513: If equals is present but hashCode isn't, @Data now generates a warning to explain this strange situation.
This commit is contained in:
1 parent
2e27817ca7
commit
f98bf919cc
8 files changed
+239
-13
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import lombok.*;
|
||||
import static lombok.AccessLevel.NONE;
|
||||
|
||||
@Data
|
||||
@Getter(NONE)
|
||||
@Setter(NONE)
|
||||
class EqualsAndHashCodeWithSomeExistingMethods {
|
||||
int x;
|
||||
|
||||
public int hashCode() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@Getter(NONE)
|
||||
@Setter(NONE)
|
||||
class EqualsAndHashCodeWithSomeExistingMethods2 {
|
||||
int x;
|
||||
|
||||
public boolean canEqual(Object other) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@Getter(NONE)
|
||||
@Setter(NONE)
|
||||
class EqualsAndHashCodeWithAllExistingMethods {
|
||||
int x;
|
||||
|
||||
public int hashCode() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
public boolean equals(Object other) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(lombok.AccessLevel.NONE)
|
||||
class EqualsAndHashCodeWithNoExistingMethods {
|
||||
int x;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user