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:
Reinier Zwitserloot
2013-05-06 22:09:13 +02:00
parent 2e27817ca7
commit f98bf919cc
8 changed files with 239 additions and 13 deletions
@@ -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;
}