diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-01-08 01:06:35 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-01-08 01:06:35 +0100 |
commit | 9ad2bd563b001c0742d767fea9ddaaeb60400ec7 (patch) | |
tree | 82d9653d555b46b1a42f7c8086e87bd6aefd16a8 /test | |
parent | 0b0656ae3c38ae915c86e17c2744d5e3d8fc805c (diff) | |
download | lombok-9ad2bd563b001c0742d767fea9ddaaeb60400ec7.tar.gz lombok-9ad2bd563b001c0742d767fea9ddaaeb60400ec7.tar.bz2 lombok-9ad2bd563b001c0742d767fea9ddaaeb60400ec7.zip |
[fixes #788] lombok generated equals method plus a non-null-by-default annotation no longer clash.
Diffstat (limited to 'test')
6 files changed, 71 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeWithNNBD.java b/test/transform/resource/after-delombok/EqualsAndHashCodeWithNNBD.java new file mode 100644 index 00000000..6eaf9f36 --- /dev/null +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeWithNNBD.java @@ -0,0 +1,30 @@ +import javax.annotation.ParametersAreNonnullByDefault; + +@ParametersAreNonnullByDefault +class EqualsAndHashCodeWithNNBD { + + @org.eclipse.jdt.annotation.NonNullByDefault + static class Inner { + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.@javax.annotation.Nullable @org.eclipse.jdt.annotation.Nullable Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCodeWithNNBD.Inner)) return false; + final EqualsAndHashCodeWithNNBD.Inner other = (EqualsAndHashCodeWithNNBD.Inner) 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 EqualsAndHashCodeWithNNBD.Inner; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int result = 1; + return result; + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeWithNNBD.java b/test/transform/resource/after-ecj/EqualsAndHashCodeWithNNBD.java new file mode 100644 index 00000000..4781839d --- /dev/null +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeWithNNBD.java @@ -0,0 +1,28 @@ +import javax.annotation.ParametersAreNonnullByDefault; +@ParametersAreNonnullByDefault class EqualsAndHashCodeWithNNBD { + static @lombok.EqualsAndHashCode @org.eclipse.jdt.annotation.NonNullByDefault class Inner { + Inner() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.@javax.annotation.Nullable @org.eclipse.jdt.annotation.Nullable Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCodeWithNNBD.Inner))) + return false; + final EqualsAndHashCodeWithNNBD.Inner other = (EqualsAndHashCodeWithNNBD.Inner) 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 EqualsAndHashCodeWithNNBD.Inner); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int result = 1; + return result; + } + } + EqualsAndHashCodeWithNNBD() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/EqualsAndHashCodeWithNNBD.java b/test/transform/resource/before/EqualsAndHashCodeWithNNBD.java new file mode 100644 index 00000000..dc86cb55 --- /dev/null +++ b/test/transform/resource/before/EqualsAndHashCodeWithNNBD.java @@ -0,0 +1,8 @@ +// version 8: +import javax.annotation.ParametersAreNonnullByDefault; +@ParametersAreNonnullByDefault +class EqualsAndHashCodeWithNNBD { + @lombok.EqualsAndHashCode @org.eclipse.jdt.annotation.NonNullByDefault + static class Inner { + } +} diff --git a/test/transform/resource/messages-delombok/EqualsAndHashCodeWithNNBD.java.messages b/test/transform/resource/messages-delombok/EqualsAndHashCodeWithNNBD.java.messages new file mode 100644 index 00000000..31259a51 --- /dev/null +++ b/test/transform/resource/messages-delombok/EqualsAndHashCodeWithNNBD.java.messages @@ -0,0 +1 @@ +5 package org.eclipse.jdt.annotation does not exist diff --git a/test/transform/resource/messages-ecj/EqualsAndHashCodeWithNNBD.java.messages b/test/transform/resource/messages-ecj/EqualsAndHashCodeWithNNBD.java.messages new file mode 100644 index 00000000..8fa7c194 --- /dev/null +++ b/test/transform/resource/messages-ecj/EqualsAndHashCodeWithNNBD.java.messages @@ -0,0 +1 @@ +2 The import javax.annotation.ParametersAreNonnullByDefault cannot be resolved diff --git a/test/transform/resource/messages-idempotent/EqualsAndHashCodeWithNNBD.java.messages b/test/transform/resource/messages-idempotent/EqualsAndHashCodeWithNNBD.java.messages new file mode 100644 index 00000000..76ed9da0 --- /dev/null +++ b/test/transform/resource/messages-idempotent/EqualsAndHashCodeWithNNBD.java.messages @@ -0,0 +1,3 @@ +6 package org.eclipse.jdt.annotation does not exist +10 package org.eclipse.jdt.annotation does not exist +10 annotation @javax.annotation.Nullable not applicable in this type context |