diff options
Diffstat (limited to 'src/core/lombok/eclipse')
-rw-r--r-- | src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 10 | ||||
-rwxr-xr-x | src/core/lombok/eclipse/handlers/HandleConstructor.java | 9 | ||||
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleSetter.java | 5 |
3 files changed, 15 insertions, 9 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index c313cf51..93b0028d 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -2770,15 +2770,7 @@ public class EclipseHandlerUtil { * Returns {@code true} if the provided node supports static methods and types (top level or static class) */ public static boolean isStaticAllowed(EclipseNode typeNode) { - boolean staticAllowed = true; - - while (typeNode.getKind() != Kind.COMPILATION_UNIT) { - if (!staticAllowed) return false; - - staticAllowed = typeNode.isStatic(); - typeNode = typeNode.up(); - } - return true; + return typeNode.isStatic() || typeNode.up() == null || typeNode.up().getKind() == Kind.COMPILATION_UNIT || isRecord(typeNode); } public static AbstractVariableDeclaration[] getRecordComponents(TypeDeclaration typeDeclaration) { diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java index e69c3267..52213846 100755 --- a/src/core/lombok/eclipse/handlers/HandleConstructor.java +++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java @@ -41,6 +41,7 @@ import lombok.RequiredArgsConstructor; import lombok.core.AST.Kind; import lombok.core.configuration.CheckerFrameworkVersion; import lombok.core.AnnotationValues; +import lombok.eclipse.Eclipse; import lombok.eclipse.EclipseAnnotationHandler; import lombok.eclipse.EclipseNode; import lombok.eclipse.handlers.EclipseHandlerUtil.MemberExistsResult; @@ -414,6 +415,10 @@ public class HandleConstructor { if (nullCheck != null) nullChecks.add(nullCheck); } parameter.annotations = copyAnnotations(source, copyableAnnotations); + if (parameter.annotations != null) { + parameter.bits |= Eclipse.HasTypeAnnotations; + constructor.bits |= Eclipse.HasTypeAnnotations; + } params.add(parameter); } @@ -555,6 +560,10 @@ public class HandleConstructor { Argument parameter = new Argument(field.name, fieldPos, copyType(field.type, source), Modifier.FINAL); parameter.annotations = copyAnnotations(source, findCopyableAnnotations(fieldNode)); + if (parameter.annotations != null) { + parameter.bits |= Eclipse.HasTypeAnnotations; + constructor.bits |= Eclipse.HasTypeAnnotations; + } params.add(parameter); } diff --git a/src/core/lombok/eclipse/handlers/HandleSetter.java b/src/core/lombok/eclipse/handlers/HandleSetter.java index fda1651d..f09f1485 100644 --- a/src/core/lombok/eclipse/handlers/HandleSetter.java +++ b/src/core/lombok/eclipse/handlers/HandleSetter.java @@ -35,6 +35,7 @@ import lombok.ConfigurationKeys; import lombok.Setter; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; +import lombok.eclipse.Eclipse; import lombok.eclipse.EclipseAnnotationHandler; import lombok.eclipse.EclipseNode; import lombok.experimental.Accessors; @@ -256,6 +257,10 @@ public class HandleSetter extends EclipseAnnotationHandler<Setter> { } method.statements = statements.toArray(new Statement[0]); param.annotations = copyAnnotations(source, copyableAnnotations, onParam.toArray(new Annotation[0])); + if (param.annotations != null) { + param.bits |= Eclipse.HasTypeAnnotations; + method.bits |= Eclipse.HasTypeAnnotations; + } if (returnType != null && returnStatement != null) createRelevantNonNullAnnotation(sourceNode, method); |