add tests to ensure onlyExplicitlyIncluded means nothing if no fields are annotated. Fixes #1772

This commit is contained in:
Roel Spilker committed 2018-10-15 23:19:55 +02:00
1 parent 7ee4ebb1a5
commit 89294fe03c
6 files changed
+70

No files matched your search

@@ -0,0 +1,22 @@
class EqualsAndHashCodeExplicitInclude {
int x;
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof EqualsAndHashCodeExplicitInclude)) return false;
final EqualsAndHashCodeExplicitInclude other = (EqualsAndHashCodeExplicitInclude) o;
if (!other.canEqual((java.lang.Object) this)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
protected boolean canEqual(final java.lang.Object other) {
return other instanceof EqualsAndHashCodeExplicitInclude;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
int result = 1;
return result;
}
}
@@ -0,0 +1,8 @@
class ToStringExplicitInclude {
int x;
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "ToStringExplicitInclude()";
}
}
@@ -0,0 +1,23 @@
@lombok.EqualsAndHashCode(onlyExplicitlyIncluded = true) class EqualsAndHashCodeExplicitInclude {
int x;
EqualsAndHashCodeExplicitInclude() {
super();
}
public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
if ((o == this))
return true;
if ((! (o instanceof EqualsAndHashCodeExplicitInclude)))
return false;
final EqualsAndHashCodeExplicitInclude other = (EqualsAndHashCodeExplicitInclude) o;
if ((! other.canEqual((java.lang.Object) this)))
return false;
return true;
}
protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
return (other instanceof EqualsAndHashCodeExplicitInclude);
}
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
int result = 1;
return result;
}
}
@@ -0,0 +1,9 @@
@lombok.ToString(onlyExplicitlyIncluded = true) class ToStringExplicitInclude {
int x;
ToStringExplicitInclude() {
super();
}
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
return "ToStringExplicitInclude()";
}
}
@@ -0,0 +1,4 @@
@lombok.EqualsAndHashCode(onlyExplicitlyIncluded = true)
class EqualsAndHashCodeExplicitInclude {
int x;
}
@@ -0,0 +1,4 @@
@lombok.ToString(onlyExplicitlyIncluded = true)
class ToStringExplicitInclude {
int x;
}