aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/changelog.markdown1
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java8
-rw-r--r--src/core/lombok/eclipse/handlers/HandleConstructor.java9
-rw-r--r--src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java7
-rw-r--r--src/core/lombok/javac/handlers/HandleConstructor.java41
-rw-r--r--src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java37
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java8
-rw-r--r--test/transform/resource/after-delombok/PrivateNoArgsConstructor.java236
-rw-r--r--test/transform/resource/after-ecj/PrivateNoArgsConstructor.java219
-rw-r--r--test/transform/resource/before/PrivateNoArgsConstructor.java40
10 files changed, 563 insertions, 43 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index e54ab2e4..771ccc55 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -3,6 +3,7 @@ Lombok Changelog
### v1.16.23 "Edgy Guinea Pig"
* v1.16.22 is the latest stable release of Project Lombok.
+* BUGFIX: Do not generate a private no-args constructor if that breaks the code. [Issue #1703](https://github.com/rzwitserloot/lombok/issues/1703), [Issue #1704](https://github.com/rzwitserloot/lombok/issues/1704), [Issue #1712](https://github.com/rzwitserloot/lombok/issues/1712)
* BUGFIX: Using boolean parameters in lombok annotations would fail. [Issue #1709](https://github.com/rzwitserloot/lombok/issues/1709)
* BUGFIX: Delombok would give an error message. [Issue #1705](https://github.com/rzwitserloot/lombok/issues/1705)
* FEATURE: Google's [Flogger (a.k.a. FluentLogger)](https://google.github.io/flogger/) is now available via `@Flogger`. [Issue #1697](https://github.com/rzwitserloot/lombok/issues/1697)
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 340e233c..2dce285c 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -1854,4 +1854,12 @@ public class EclipseHandlerUtil {
private static long[] copy(long[] array) {
return array == null ? null : array.clone();
}
+
+ public static boolean isDirectDescendantOfObject(EclipseNode typeNode) {
+ if (!(typeNode.get() instanceof TypeDeclaration)) throw new IllegalArgumentException("not a type node");
+ TypeDeclaration typeDecl = (TypeDeclaration) typeNode.get();
+ if (typeDecl.superclass == null) return true;
+ String p = typeDecl.superclass.toString();
+ return p.equals("Object") || p.equals("java.lang.Object");
+ }
}
diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java
index 295c89ca..f9029319 100644
--- a/src/core/lombok/eclipse/handlers/HandleConstructor.java
+++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java
@@ -211,6 +211,8 @@ public class HandleConstructor {
}
public void generateExtraNoArgsConstructor(EclipseNode typeNode, EclipseNode sourceNode) {
+ if (!isDirectDescendantOfObject(typeNode)) return;
+
Boolean v = typeNode.getAst().readConfiguration(ConfigurationKeys.NO_ARGS_CONSTRUCTOR_EXTRA_PRIVATE);
if (v != null && !v) return;
@@ -298,6 +300,13 @@ public class HandleConstructor {
}
}
}
+
+ for (EclipseNode child : node.down()) {
+ if (annotationTypeMatches(NoArgsConstructor.class, child)) return true;
+ if (annotationTypeMatches(RequiredArgsConstructor.class, child) && findRequiredFields(node).isEmpty()) return true;
+ if (annotationTypeMatches(AllArgsConstructor.class, child) && findAllFields(node).isEmpty()) return true;
+ }
+
return false;
}
diff --git a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
index e30df698..c99b9b5f 100644
--- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
@@ -157,12 +157,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
}
}
- boolean isDirectDescendantOfObject = true;
-
- if (typeDecl.superclass != null) {
- String p = typeDecl.superclass.toString();
- isDirectDescendantOfObject = p.equals("Object") || p.equals("java.lang.Object");
- }
+ boolean isDirectDescendantOfObject = isDirectDescendantOfObject(typeNode);
if (isDirectDescendantOfObject && callSuper) {
errorNode.addError("Generating equals/hashCode with a supercall to java.lang.Object is pointless.");
diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java
index 2314a5e4..f4aa6fbf 100644
--- a/src/core/lombok/javac/handlers/HandleConstructor.java
+++ b/src/core/lombok/javac/handlers/HandleConstructor.java
@@ -22,23 +22,8 @@
package lombok.javac.handlers;
import static lombok.core.handlers.HandlerUtil.*;
-import static lombok.javac.handlers.JavacHandlerUtil.*;
import static lombok.javac.Javac.*;
-
-import lombok.AccessLevel;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.ConfigurationKeys;
-import lombok.NoArgsConstructor;
-import lombok.RequiredArgsConstructor;
-import lombok.core.AnnotationValues;
-import lombok.core.AST.Kind;
-import lombok.delombok.LombokOptionsFactory;
-import lombok.javac.Javac;
-import lombok.javac.JavacAnnotationHandler;
-import lombok.javac.JavacNode;
-import lombok.javac.JavacTreeMaker;
-import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
+import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
@@ -62,6 +47,21 @@ import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.ConfigurationKeys;
+import lombok.NoArgsConstructor;
+import lombok.RequiredArgsConstructor;
+import lombok.core.AST.Kind;
+import lombok.core.AnnotationValues;
+import lombok.delombok.LombokOptionsFactory;
+import lombok.javac.Javac;
+import lombok.javac.JavacAnnotationHandler;
+import lombok.javac.JavacNode;
+import lombok.javac.JavacTreeMaker;
+import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
+
public class HandleConstructor {
@ProviderFor(JavacAnnotationHandler.class)
public static class HandleNoArgsConstructor extends JavacAnnotationHandler<NoArgsConstructor> {
@@ -197,6 +197,8 @@ public class HandleConstructor {
}
public void generateExtraNoArgsConstructor(JavacNode typeNode, JavacNode source) {
+ if (!isDirectDescendantOfObject(typeNode)) return;
+
Boolean v = typeNode.getAst().readConfiguration(ConfigurationKeys.NO_ARGS_CONSTRUCTOR_EXTRA_PRIVATE);
if (v != null && !v) return;
@@ -278,6 +280,13 @@ public class HandleConstructor {
}
}
}
+
+ for (JavacNode child : node.down()) {
+ if (annotationTypeMatches(NoArgsConstructor.class, child)) return true;
+ if (annotationTypeMatches(RequiredArgsConstructor.class, child) && findRequiredFields(node).isEmpty()) return true;
+ if (annotationTypeMatches(AllArgsConstructor.class, child) && findAllFields(node).isEmpty()) return true;
+ }
+
return false;
}
diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
index 12071cfd..aa0fe633 100644
--- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
@@ -21,7 +21,7 @@
*/
package lombok.javac.handlers;
-import static lombok.core.handlers.HandlerUtil.*;
+import static lombok.core.handlers.HandlerUtil.handleFlagUsage;
import static lombok.javac.Javac.*;
import static lombok.javac.handlers.JavacHandlerUtil.*;
@@ -29,20 +29,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import lombok.ConfigurationKeys;
-import lombok.EqualsAndHashCode;
-import lombok.core.AST.Kind;
-import lombok.core.configuration.CallSuperType;
-import lombok.core.AnnotationValues;
-import lombok.core.handlers.HandlerUtil;
-import lombok.core.handlers.InclusionExclusionUtils;
-import lombok.core.handlers.InclusionExclusionUtils.Included;
-import lombok.javac.Javac;
-import lombok.javac.JavacAnnotationHandler;
-import lombok.javac.JavacNode;
-import lombok.javac.JavacTreeMaker;
-import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
-
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.BoundKind;
@@ -67,6 +53,20 @@ import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
+import lombok.ConfigurationKeys;
+import lombok.EqualsAndHashCode;
+import lombok.core.AST.Kind;
+import lombok.core.AnnotationValues;
+import lombok.core.configuration.CallSuperType;
+import lombok.core.handlers.HandlerUtil;
+import lombok.core.handlers.HandlerUtil.FieldAccess;
+import lombok.core.handlers.InclusionExclusionUtils;
+import lombok.core.handlers.InclusionExclusionUtils.Included;
+import lombok.javac.JavacAnnotationHandler;
+import lombok.javac.JavacNode;
+import lombok.javac.JavacTreeMaker;
+import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
+
/**
* Handles the {@code lombok.EqualsAndHashCode} annotation for javac.
*/
@@ -122,7 +122,6 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
return;
}
- boolean isDirectDescendantOfObject = true;
boolean implicitCallSuper = callSuper == null;
if (callSuper == null) {
try {
@@ -132,11 +131,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
}
}
- JCTree extending = Javac.getExtendsClause((JCClassDecl)typeNode.get());
- if (extending != null) {
- String p = extending.toString();
- isDirectDescendantOfObject = p.equals("Object") || p.equals("java.lang.Object");
- }
+ boolean isDirectDescendantOfObject = isDirectDescendantOfObject(typeNode);
if (isDirectDescendantOfObject && callSuper) {
source.addError("Generating equals/hashCode with a supercall to java.lang.Object is pointless.");
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index b5bc6e6b..f335cf94 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -1813,4 +1813,12 @@ public class JavacHandlerUtil {
docComments.put(from.get(), filtered[1]);
}
}
+
+ public static boolean isDirectDescendantOfObject(JavacNode typeNode) {
+ if (!(typeNode.get() instanceof JCClassDecl)) throw new IllegalArgumentException("not a type node");
+ JCTree extending = Javac.getExtendsClause((JCClassDecl)typeNode.get());
+ if (extending == null) return true;
+ String p = extending.toString();
+ return p.equals("Object") || p.equals("java.lang.Object");
+ }
}
diff --git a/test/transform/resource/after-delombok/PrivateNoArgsConstructor.java b/test/transform/resource/after-delombok/PrivateNoArgsConstructor.java
new file mode 100644
index 00000000..18e6f211
--- /dev/null
+++ b/test/transform/resource/after-delombok/PrivateNoArgsConstructor.java
@@ -0,0 +1,236 @@
+public class PrivateNoArgsConstructor {
+ private static class Base {
+ }
+ public static class PrivateNoArgsConstructorNotOnExtends extends Base {
+ private final int a;
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorNotOnExtends(final int a) {
+ this.a = a;
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getA() {
+ return this.a;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (!super.equals(o)) return false;
+ if (this.getA() != other.getA()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = super.hashCode();
+ result = result * PRIME + this.getA();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends(a=" + this.getA() + ")";
+ }
+ }
+ public static class PrivateNoArgsConstructorOnExtendsObject extends Object {
+ private final int b;
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorOnExtendsObject(final int b) {
+ this.b = b;
+ }
+ @java.lang.SuppressWarnings("all")
+ private PrivateNoArgsConstructorOnExtendsObject() {
+ this.b = 0;
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getB() {
+ return this.b;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getB() != other.getB()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getB();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject(b=" + this.getB() + ")";
+ }
+ }
+ public static class PrivateNoArgsConstructorExplicitBefore {
+ private final int c;
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitBefore() {
+ this.c = 0;
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getC() {
+ return this.c;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getC() != other.getC()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getC();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore(c=" + this.getC() + ")";
+ }
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitBefore(final int c) {
+ this.c = c;
+ }
+ }
+ public static class PrivateNoArgsConstructorExplicitAfter {
+ private final int d;
+ @java.lang.SuppressWarnings("all")
+ public int getD() {
+ return this.d;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getD() != other.getD()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getD();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter(d=" + this.getD() + ")";
+ }
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitAfter() {
+ this.d = 0;
+ }
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitAfter(final int d) {
+ this.d = d;
+ }
+ }
+ public static class PrivateNoArgsConstructorExplicitNone {
+ private final int e;
+ @java.lang.SuppressWarnings("all")
+ public int getE() {
+ return this.e;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getE() != other.getE()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getE();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone(e=" + this.getE() + ")";
+ }
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitNone(final int e) {
+ this.e = e;
+ }
+ }
+ public static class PrivateNoArgsConstructorNoFields {
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorNoFields() {
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields) 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 PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ int result = 1;
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields()";
+ }
+ }
+}
diff --git a/test/transform/resource/after-ecj/PrivateNoArgsConstructor.java b/test/transform/resource/after-ecj/PrivateNoArgsConstructor.java
new file mode 100644
index 00000000..f746ec9a
--- /dev/null
+++ b/test/transform/resource/after-ecj/PrivateNoArgsConstructor.java
@@ -0,0 +1,219 @@
+public class PrivateNoArgsConstructor {
+ private static class Base {
+ private Base() {
+ super();
+ }
+ }
+ public static @lombok.Data class PrivateNoArgsConstructorNotOnExtends extends Base {
+ private final int a;
+ public @java.lang.SuppressWarnings("all") int getA() {
+ return this.a;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((! super.equals(o)))
+ return false;
+ if ((this.getA() != other.getA()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = super.hashCode();
+ result = ((result * PRIME) + this.getA());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends(a=" + this.getA()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorNotOnExtends(final int a) {
+ super();
+ this.a = a;
+ }
+ }
+ public static @lombok.Data class PrivateNoArgsConstructorOnExtendsObject extends Object {
+ private final int b;
+ public @java.lang.SuppressWarnings("all") int getB() {
+ return this.b;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getB() != other.getB()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getB());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject(b=" + this.getB()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorOnExtendsObject(final int b) {
+ super();
+ this.b = b;
+ }
+ private @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorOnExtendsObject() {
+ super();
+ this.b = 0;
+ }
+ }
+ public static @lombok.NoArgsConstructor(force = true) @lombok.Data @lombok.RequiredArgsConstructor class PrivateNoArgsConstructorExplicitBefore {
+ private final int c;
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitBefore() {
+ super();
+ this.c = 0;
+ }
+ public @java.lang.SuppressWarnings("all") int getC() {
+ return this.c;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getC() != other.getC()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getC());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore(c=" + this.getC()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitBefore(final int c) {
+ super();
+ this.c = c;
+ }
+ }
+ public static @lombok.Data @lombok.NoArgsConstructor(force = true) @lombok.RequiredArgsConstructor class PrivateNoArgsConstructorExplicitAfter {
+ private final int d;
+ public @java.lang.SuppressWarnings("all") int getD() {
+ return this.d;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getD() != other.getD()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getD());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter(d=" + this.getD()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitAfter() {
+ super();
+ this.d = 0;
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitAfter(final int d) {
+ super();
+ this.d = d;
+ }
+ }
+ public static @lombok.Data @lombok.NoArgsConstructor(access = lombok.AccessLevel.NONE) @lombok.RequiredArgsConstructor class PrivateNoArgsConstructorExplicitNone {
+ private final int e;
+ public @java.lang.SuppressWarnings("all") int getE() {
+ return this.e;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getE() != other.getE()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getE());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone(e=" + this.getE()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitNone(final int e) {
+ super();
+ this.e = e;
+ }
+ }
+ public static @lombok.Data class PrivateNoArgsConstructorNoFields {
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields) 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 PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ int result = 1;
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields()";
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorNoFields() {
+ super();
+ }
+ }
+ public PrivateNoArgsConstructor() {
+ super();
+ }
+}
diff --git a/test/transform/resource/before/PrivateNoArgsConstructor.java b/test/transform/resource/before/PrivateNoArgsConstructor.java
new file mode 100644
index 00000000..911e430f
--- /dev/null
+++ b/test/transform/resource/before/PrivateNoArgsConstructor.java
@@ -0,0 +1,40 @@
+// CONF: lombok.equalsAndHashCode.callSuper = call
+public class PrivateNoArgsConstructor {
+ private static class Base {
+ }
+
+ @lombok.Data
+ public static class PrivateNoArgsConstructorNotOnExtends extends Base {
+ private final int a;
+ }
+
+ @lombok.Data
+ public static class PrivateNoArgsConstructorOnExtendsObject extends Object {
+ private final int b;
+ }
+
+ @lombok.NoArgsConstructor(force=true)
+ @lombok.Data
+ @lombok.RequiredArgsConstructor
+ public static class PrivateNoArgsConstructorExplicitBefore {
+ private final int c;
+ }
+
+ @lombok.Data
+ @lombok.NoArgsConstructor(force=true)
+ @lombok.RequiredArgsConstructor
+ public static class PrivateNoArgsConstructorExplicitAfter {
+ private final int d;
+ }
+
+ @lombok.Data
+ @lombok.NoArgsConstructor(access=lombok.AccessLevel.NONE)
+ @lombok.RequiredArgsConstructor
+ public static class PrivateNoArgsConstructorExplicitNone {
+ private final int e;
+ }
+
+ @lombok.Data
+ public static class PrivateNoArgsConstructorNoFields {
+ }
+}