diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-03-28 00:38:07 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-03-28 00:38:07 +0200 |
commit | 2a6c0c16b303b6af0b96e296858c2c54140f6dfe (patch) | |
tree | 8129fad6a460e5e155f63aa35b37bcb82d6c456b /src/core/lombok/javac | |
parent | cde47abc26ae04ebd41f4a5ad7430b187fcbc03d (diff) | |
download | lombok-2a6c0c16b303b6af0b96e296858c2c54140f6dfe.tar.gz lombok-2a6c0c16b303b6af0b96e296858c2c54140f6dfe.tar.bz2 lombok-2a6c0c16b303b6af0b96e296858c2c54140f6dfe.zip |
[builderParentClass] Code to handle builder on enums removed; that doesn’t make a heck of a lot of sense and enums aren’t extensible in the first place. Also fixed up a wrong access level; now all existing builder tests pass.
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleBuilder.java | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java index 4c575d91..a74ebfda 100644 --- a/src/core/lombok/javac/handlers/HandleBuilder.java +++ b/src/core/lombok/javac/handlers/HandleBuilder.java @@ -195,7 +195,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { boolean callBuilderBasedSuperConstructor = extendsClause != null; generateBuilderBasedConstructor(tdParent, builderFields, annotationNode, builderClassName, callBuilderBasedSuperConstructor); } else { - handleConstructor.generateConstructor(tdParent, AccessLevel.PROTECTED, List.<JCAnnotation>nil(), allFields.toList(), false, null, SkipIfConstructorExists.I_AM_BUILDER, annotationNode); + handleConstructor.generateConstructor(tdParent, AccessLevel.PACKAGE, List.<JCAnnotation>nil(), allFields.toList(), false, null, SkipIfConstructorExists.I_AM_BUILDER, annotationNode); } returnType = namePlusTypeParamsToTypeReference(tdParent.getTreeMaker(), td.name, td.typarams); @@ -569,9 +569,6 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { private void generateBuilderBasedConstructor(JavacNode typeNode, java.util.List<BuilderFieldData> builderFields, JavacNode source, String builderClassnameAsParameter, boolean callBuilderBasedSuperConstructor) { JavacTreeMaker maker = typeNode.getTreeMaker(); - boolean isEnum = (((JCClassDecl) typeNode.get()).mods.flags & Flags.ENUM) != 0; - AccessLevel level = isEnum ? AccessLevel.PRIVATE : AccessLevel.PROTECTED; - ListBuffer<JCStatement> nullChecks = new ListBuffer<JCStatement>(); ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>(); @@ -599,7 +596,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { statements.append(maker.Exec(assign)); } - JCModifiers mods = maker.Modifiers(toJavacModifier(level), List.<JCAnnotation>nil()); + JCModifiers mods = maker.Modifiers(toJavacModifier(AccessLevel.PROTECTED), List.<JCAnnotation>nil()); // Create a constructor that has just the builder as parameter. ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>(); |