mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-19 04:16:15 +00:00
Fixes #2156: also clone the annotations on the setter.
This commit is contained in:
1 parent
38a48e8a85
commit
ed3c8a67e2
3 files changed
+2
-10
No files matched your search
@@ -9,6 +9,7 @@ Lombok Changelog
|
|||||||
* ENHANCEMENT: If you mix up eclipse's non-null support, such as `@NonNullByDefault`, with lombok's `@NonNull`, you get a bunch of warnings about dead code that are inappropriate. These warnings are now suppressed, thanks to a contribution from Till Brychcy! [Pull Request #2155](https://github.com/rzwitserloot/lombok/pull/2155)
|
* ENHANCEMENT: If you mix up eclipse's non-null support, such as `@NonNullByDefault`, with lombok's `@NonNull`, you get a bunch of warnings about dead code that are inappropriate. These warnings are now suppressed, thanks to a contribution from Till Brychcy! [Pull Request #2155](https://github.com/rzwitserloot/lombok/pull/2155)
|
||||||
* ENHANCEMENT: `@NonNull` can now also generate checks using jdk's `Objects.requireNonNull` or Guava's `Preconditions.checkNotNull`. [Issue #1197](https://github.com/rzwitserloot/lombok/issues/1197)
|
* ENHANCEMENT: `@NonNull` can now also generate checks using jdk's `Objects.requireNonNull` or Guava's `Preconditions.checkNotNull`. [Issue #1197](https://github.com/rzwitserloot/lombok/issues/1197)
|
||||||
* EXPERIMENT: Lombok is working together with [checkerframework](https://checkerframework.org/) to enable detection of improper builder use (such as forgetting to set a mandatory property prior to calling `build()`). This experiment can be turned on by adding `checkerframework = true` to your `lombok.config` file.
|
* EXPERIMENT: Lombok is working together with [checkerframework](https://checkerframework.org/) to enable detection of improper builder use (such as forgetting to set a mandatory property prior to calling `build()`). This experiment can be turned on by adding `checkerframework = true` to your `lombok.config` file.
|
||||||
|
* BUGFIX: Using `@JsonProperty` or `@JsonValue` on a field in combination with `@Setter` or `@Data` would sometimes throw a ClassCastException during compilation. [Issue #2156](https://github.com/rzwitserloot/lombok/issues/2156)
|
||||||
* BUGFIX: Delombok would turn something like `List<byte[]>...` in a method parameter to `List<byte...>...` [Issue #2140](https://github.com/rzwitserloot/lombok/issues/2140)
|
* BUGFIX: Delombok would turn something like `List<byte[]>...` in a method parameter to `List<byte...>...` [Issue #2140](https://github.com/rzwitserloot/lombok/issues/2140)
|
||||||
* BUGFIX: Javac would generate the wrong equals and hashCode if a type-use annotation was put on an array type field [Issue #2165](https://github.com/rzwitserloot/lombok/issues/2165)
|
* BUGFIX: Javac would generate the wrong equals and hashCode if a type-use annotation was put on an array type field [Issue #2165](https://github.com/rzwitserloot/lombok/issues/2165)
|
||||||
* BUGFIX: Eclipse 2019-06 + JDK-12 compatibility + an `@Singular` builder entry would produce a cascade of error dialogs. [Issue #2169](https://github.com/rzwitserloot/lombok/issues/2169)
|
* BUGFIX: Eclipse 2019-06 + JDK-12 compatibility + an `@Singular` builder entry would produce a cascade of error dialogs. [Issue #2169](https://github.com/rzwitserloot/lombok/issues/2169)
|
||||||
|
|||||||
@@ -675,15 +675,6 @@ public class EclipseHandlerUtil {
|
|||||||
return result == null ? null : result.toArray(new Annotation[0]);
|
return result == null ? null : result.toArray(new Annotation[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Annotation[] mergeAnnotations(Annotation[] a, Annotation[] b) {
|
|
||||||
if (a == null || a.length == 0) return (b == null || b.length == 0) ? null : b;
|
|
||||||
if (b == null || b.length == 0) return a.length == 0 ? null : a;
|
|
||||||
Annotation[] c = new Annotation[a.length + b.length];
|
|
||||||
System.arraycopy(a, 0, c, 0, a.length);
|
|
||||||
System.arraycopy(b, 0, c, a.length, b.length);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasAnnotation(Class<? extends java.lang.annotation.Annotation> type, EclipseNode node) {
|
public static boolean hasAnnotation(Class<? extends java.lang.annotation.Annotation> type, EclipseNode node) {
|
||||||
if (node == null) return false;
|
if (node == null) return false;
|
||||||
if (type == null) return false;
|
if (type == null) return false;
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public class HandleSetter extends EclipseAnnotationHandler<Setter> {
|
|||||||
if (isFieldDeprecated(fieldNode) || deprecate) {
|
if (isFieldDeprecated(fieldNode) || deprecate) {
|
||||||
deprecated = new Annotation[] { generateDeprecatedAnnotation(source) };
|
deprecated = new Annotation[] { generateDeprecatedAnnotation(source) };
|
||||||
}
|
}
|
||||||
method.annotations = mergeAnnotations(copyAnnotations(source, onMethod.toArray(new Annotation[0]), deprecated), findCopyableToSetterAnnotations(fieldNode));
|
method.annotations = copyAnnotations(source, onMethod.toArray(new Annotation[0]), deprecated, findCopyableToSetterAnnotations(fieldNode));
|
||||||
Argument param = new Argument(paramName, p, copyType(field.type, source), Modifier.FINAL);
|
Argument param = new Argument(paramName, p, copyType(field.type, source), Modifier.FINAL);
|
||||||
param.sourceStart = pS; param.sourceEnd = pE;
|
param.sourceStart = pS; param.sourceEnd = pE;
|
||||||
method.arguments = new Argument[] { param };
|
method.arguments = new Argument[] { param };
|
||||||
|
|||||||
Reference in new issue
Block a user