diff options
author | Roel Spilker <r.spilker@gmail.com> | 2018-05-28 21:54:12 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2018-05-28 21:54:12 +0200 |
commit | 6045c1b8f524064a492b0dae9fbfbe89a1dca232 (patch) | |
tree | 2761ead796c6203c8bd28a607b311bf57bf5a1ad /src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | |
parent | 4fb9c6f7f82d020a9ebcae9816e911ecd4c047a4 (diff) | |
download | lombok-6045c1b8f524064a492b0dae9fbfbe89a1dca232.tar.gz lombok-6045c1b8f524064a492b0dae9fbfbe89a1dca232.tar.bz2 lombok-6045c1b8f524064a492b0dae9fbfbe89a1dca232.zip |
Generate default no-args constructor
Diffstat (limited to 'src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java')
-rw-r--r-- | src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 1758a220..340e233c 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -1198,6 +1198,12 @@ public class EclipseHandlerUtil { return AnnotationValues.of(Accessors.class, field); } + + public static EclipseNode upToTypeNode(EclipseNode node) { + if (node == null) throw new NullPointerException("node"); + while (node != null && !(node.get() instanceof TypeDeclaration)) node = node.up(); + return node; + } /** * Checks if there is a field with the provided name. @@ -1206,10 +1212,7 @@ public class EclipseHandlerUtil { * @param node Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof. */ public static MemberExistsResult fieldExists(String fieldName, EclipseNode node) { - while (node != null && !(node.get() instanceof TypeDeclaration)) { - node = node.up(); - } - + node = upToTypeNode(node); if (node != null && node.get() instanceof TypeDeclaration) { TypeDeclaration typeDecl = (TypeDeclaration)node.get(); if (typeDecl.fields != null) for (FieldDeclaration def : typeDecl.fields) { @@ -1295,10 +1298,7 @@ public class EclipseHandlerUtil { * @param node Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof. */ public static MemberExistsResult constructorExists(EclipseNode node) { - while (node != null && !(node.get() instanceof TypeDeclaration)) { - node = node.up(); - } - + node = upToTypeNode(node); if (node != null && node.get() instanceof TypeDeclaration) { TypeDeclaration typeDecl = (TypeDeclaration)node.get(); if (typeDecl.methods != null) for (AbstractMethodDeclaration def : typeDecl.methods) { |