diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-08-22 23:26:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-22 23:26:55 +0200 |
commit | db19a9fd8320a0abf7a530e9e35639089ce77050 (patch) | |
tree | bfd83d64061f1606470e91ae24dc4c8693b10015 /src/core/lombok/eclipse/handlers/HandleToString.java | |
parent | 819d1956761f6077fdf897e77c4f6ac47e92104e (diff) | |
parent | ba8fd3782819682b3f4081cb410b6d43055989b9 (diff) | |
download | lombok-db19a9fd8320a0abf7a530e9e35639089ce77050.tar.gz lombok-db19a9fd8320a0abf7a530e9e35639089ce77050.tar.bz2 lombok-db19a9fd8320a0abf7a530e9e35639089ce77050.zip |
Merge branch 'master' into clone-type
Diffstat (limited to 'src/core/lombok/eclipse/handlers/HandleToString.java')
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleToString.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleToString.java b/src/core/lombok/eclipse/handlers/HandleToString.java index bb52feb5..39fd5937 100644 --- a/src/core/lombok/eclipse/handlers/HandleToString.java +++ b/src/core/lombok/eclipse/handlers/HandleToString.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2018 The Project Lombok Authors. + * Copyright (C) 2009-2019 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -60,6 +60,7 @@ import lombok.ToString; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; import lombok.core.configuration.CallSuperType; +import lombok.core.configuration.CheckerFrameworkVersion; import lombok.core.handlers.HandlerUtil.FieldAccess; import lombok.core.handlers.InclusionExclusionUtils; import lombok.core.handlers.InclusionExclusionUtils.Included; @@ -300,7 +301,12 @@ public class HandleToString extends EclipseAnnotationHandler<ToString> { method.modifiers = toEclipseModifier(AccessLevel.PUBLIC); method.returnType = new QualifiedTypeReference(TypeConstants.JAVA_LANG_STRING, new long[] {p, p, p}); setGeneratedBy(method.returnType, source); - method.annotations = new Annotation[] {makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, source)}; + Annotation overrideAnnotation = makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, source); + if (getCheckerFrameworkVersion(type).generateSideEffectFree()) { + method.annotations = new Annotation[] { overrideAnnotation, generateNamedAnnotation(source, CheckerFrameworkVersion.NAME__SIDE_EFFECT_FREE) }; + } else { + method.annotations = new Annotation[] { overrideAnnotation }; + } method.arguments = null; method.selector = "toString".toCharArray(); method.thrownExceptions = null; |