Merge branch 'master' into cachescrubber-gh-3950

# Conflicts:
#	src/core/lombok/eclipse/handlers/HandleJacksonized.java
#	src/core/lombok/javac/handlers/HandleJacksonized.java
This commit is contained in:
Reinier Zwitserloot committed 2026-02-06 00:22:11 +01:00
commit d62b2d5b80
56 files changed
+377 -364

No files matched your search

+4 -4
View File
@@ -150,10 +150,10 @@ jobs:
needs: build
strategy:
matrix:
jdk: [8, 11, 17, 21, 23]
jdk: [8, 11, 17, 21, 25]
tool:
- {name: "maven", cmd: "mvn compile"}
- {name: "gradle", cmd: "gradle assemble"}
- {name: "gradle", cmd: "gradle assemble", buildArgs: {"25": "--build-arg gradle=9.1.0"}}
- {name: "ant", cmd: "ant dist"}
- {name: "bazel", cmd: "bazel build //:ProjectRunner"}
fail-fast: false
@@ -170,7 +170,7 @@ jobs:
- name: Build container
working-directory: ./docker
run: docker build --build-arg jdk=${{ matrix.jdk }} -t $IMAGE_NAME -f ${{ matrix.tool.name }}/Dockerfile .
run: docker build --build-arg jdk=${{ matrix.jdk }} ${{ matrix.tool.buildArgs[matrix.jdk] }} -t $IMAGE_NAME -f ${{ matrix.tool.name }}/Dockerfile .
- name: Compile in container
run: docker run --entrypoint="" -v $(pwd)/lombok.jar:/workspace/lombok.jar $IMAGE_NAME /bin/bash -c "cd classpath; ${{ matrix.tool.cmd }}"
@@ -180,7 +180,7 @@ jobs:
needs: build
strategy:
matrix:
jdk: [8, 11, 17, 21, 23]
jdk: [8, 11, 17, 21, 25]
dir: [compileTests]
fail-fast: false
+2 -1
View File
@@ -2,7 +2,8 @@ Lombok Changelog
----------------
### v1.18.43 "Edgy Guinea Pig"
* No changes since v1.18.42 yet.
* BUGFIX: On JDK25, `val` and `@ExtensionMethod` could sometimes cause erroneous errors (in that you see errors but compilation succeeds anyway) using javac. [#3947](https://github.com/projectlombok/lombok/issues/3947).
* BUGFIX: `@Jacksonized` + fields marked `transient` would result in those transient fields being serialised which is surprising (and thus undesired) behaviour. [#3936](https://github.com/projectlombok/lombok/issues/3936).
### v1.18.42 (September 18th, 2025)
* FEATURE: All the various `@Log` annotations now allow you to change their access level (they still default to `private`). [#2280](https://github.com/projectlombok/lombok/issues/2280). Thanks to new contributor Liam Pace!
@@ -7,7 +7,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>23</java.version>
<java.version>25</java.version>
</properties>
<build>
@@ -7,7 +7,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>23</java.version>
<java.version>25</java.version>
</properties>
<build>
-4
View File
@@ -1,4 +0,0 @@
apt-get update && apt-get install -y wget
wget https://download.java.net/java/GA/jdk23/3c5b90190c68498b986a97f276efd28a/37/GPL/openjdk-23_linux-x64_bin.tar.gz -O jdk.tar.gz
tar -xzf jdk.tar.gz -C /opt/
mv /opt/jdk-23 /opt/jdk
+4
View File
@@ -0,0 +1,4 @@
apt-get update && apt-get install -y wget
wget https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25%2B36/OpenJDK25U-jdk_x64_linux_hotspot_25_36.tar.gz -O jdk.tar.gz
tar -xzf jdk.tar.gz -C /opt/
mv /opt/jdk-25+36 /opt/jdk
@@ -97,7 +97,7 @@ public abstract class ConfigurationFile {
return file.exists() && file.isFile();
}
private static String read(InputStream is) throws IOException {
static String read(InputStream is) throws IOException {
byte[] b = buffers.get();
ByteArrayOutputStream out = new ByteArrayOutputStream();
while (true) {
@@ -111,7 +111,7 @@ public abstract class ConfigurationFile {
private static class RegularConfigurationFile extends ConfigurationFile {
private final File file;
private ConfigurationFile parent;
private RegularConfigurationFile(File file) {
super(file.getPath());
this.file = file;
@@ -172,7 +172,7 @@ public abstract class ConfigurationFile {
is.close();
}
}
@Override ConfigurationFile parent() {
if (parent == null) {
File parentFile = file.getParentFile().getParentFile();
@@ -322,15 +322,15 @@ public abstract class ConfigurationFile {
@Override CharSequence contents() throws IOException {
return contents;
}
@Override boolean exists() {
return true;
}
@Override public ConfigurationFile resolve(String path) {
return null;
}
@Override ConfigurationFile parent() {
return null;
}
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2025 The Project Lombok Authors.
* Copyright (C) 2020-2026 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
@@ -43,6 +43,7 @@ import lombok.Builder;
import lombok.ConfigurationKeys;
import lombok.core.AnnotationValues;
import lombok.core.HandlerPriority;
import lombok.core.JacksonAnnotationType;
import lombok.core.AST.Kind;
import lombok.core.configuration.JacksonVersion;
import lombok.core.handlers.HandlerUtil;
@@ -62,12 +63,9 @@ import lombok.spi.Provides;
@Provides
@HandlerPriority(-512) // Above Handle(Super)Builder's level (builders must be already generated).
public class HandleJacksonized extends EclipseAnnotationHandler<Jacksonized> {
private static final char[][] JACKSON3_JSON_POJO_BUILDER_ANNOTATION = Eclipse.fromQualifiedName("tools.jackson.databind.annotation.JsonPOJOBuilder");
private static final char[][] JACKSON2_JSON_POJO_BUILDER_ANNOTATION = Eclipse.fromQualifiedName("com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder");
private static final char[][] JACKSON3_JSON_DESERIALIZE_ANNOTATION = Eclipse.fromQualifiedName("tools.jackson.databind.annotation.JsonDeserialize");
private static final char[][] JACKSON2_JSON_DESERIALIZE_ANNOTATION = Eclipse.fromQualifiedName("com.fasterxml.jackson.databind.annotation.JsonDeserialize");
private static final char[][] JSON_PROPERTY_ANNOTATION = Eclipse.fromQualifiedName("com.fasterxml.jackson.annotation.JsonProperty");
static boolean hasAnnotation(EclipseNode node, JacksonAnnotationType annotation) {
return EclipseHandlerUtil.hasAnnotation(annotation.getQualifiedName(), node);
}
@Override public void handle(AnnotationValues<Jacksonized> annotation, Annotation ast, EclipseNode annotationNode) {
handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.JACKSONIZED_FLAG_USAGE, "@Jacksonized");
@@ -135,11 +133,7 @@ public class HandleJacksonized extends EclipseAnnotationHandler<Jacksonized> {
}
// Insert @JsonDeserialize on annotated class.
if (hasAnnotation("com.fasterxml.jackson.databind.annotation.JsonDeserialize", tdNode)) {
annotationNode.addError("@JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson.");
return;
}
if (hasAnnotation("tools.jackson.databind.annotation.JsonDeserialize", tdNode)) {
if (hasAnnotation(tdNode, JacksonAnnotationType.JSON_DESERIALIZE2) || hasAnnotation(tdNode, JacksonAnnotationType.JSON_DESERIALIZE3)) {
annotationNode.addError("@JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson.");
return;
}
@@ -147,19 +141,22 @@ public class HandleJacksonized extends EclipseAnnotationHandler<Jacksonized> {
TypeReference builderClassExpression = namePlusTypeParamsToTypeReference(builderClassNode, null, p);
ClassLiteralAccess builderClassLiteralAccess = new ClassLiteralAccess(td.sourceEnd, builderClassExpression);
MemberValuePair builderMvp = new MemberValuePair("builder".toCharArray(), td.sourceStart, td.sourceEnd, builderClassLiteralAccess);
JacksonVersion jacksonVersion = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, JacksonVersion.getDefault());
if (jacksonVersion == null || !jacksonVersion.isValid()) {
annotationNode.addError("No valid jackson version selected.");
return;
List<JacksonVersion> jacksonVersions = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, Arrays.<JacksonVersion>asList());
if (jacksonVersions.isEmpty()) {
annotationNode.addWarning("Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized");
jacksonVersions = Arrays.asList(JacksonVersion.TWO);
}
if (jacksonVersion.useJackson2()) {
td.annotations = addAnnotation(td, td.annotations, JACKSON2_JSON_DESERIALIZE_ANNOTATION, builderMvp);
if (jacksonVersions.contains(JacksonVersion.TWO)) {
td.annotations = addAnnotation(td, td.annotations, JacksonAnnotationType.JSON_DESERIALIZE2.getQualifiednameAsCharArrayArray(), builderMvp);
}
if (jacksonVersion.useJackson3()) {
td.annotations = addAnnotation(td, td.annotations, JACKSON3_JSON_DESERIALIZE_ANNOTATION, builderMvp);
if (jacksonVersions.contains(JacksonVersion.THREE)) {
td.annotations = addAnnotation(td, td.annotations, JacksonAnnotationType.JSON_DESERIALIZE3.getQualifiednameAsCharArrayArray(), builderMvp);
}
// Copy annotations from the class to the builder class.
Annotation[] copyableAnnotations = findJacksonAnnotationsOnClass(td, tdNode);
builderClass.annotations = copyAnnotations(builderClass, builderClass.annotations, copyableAnnotations);
@@ -169,15 +166,16 @@ public class HandleJacksonized extends EclipseAnnotationHandler<Jacksonized> {
MemberValuePair withPrefixMvp = new MemberValuePair("withPrefix".toCharArray(), builderClass.sourceStart, builderClass.sourceEnd, withPrefixLiteral);
StringLiteral buildMethodNameLiteral = new StringLiteral(buildMethodName.toCharArray(), builderClass.sourceStart, builderClass.sourceEnd, 0);
MemberValuePair buildMethodNameMvp = new MemberValuePair("buildMethodName".toCharArray(), builderClass.sourceStart, builderClass.sourceEnd, buildMethodNameLiteral);
if (jacksonVersion.useJackson2()) {
builderClass.annotations = addAnnotation(builderClass, builderClass.annotations, JACKSON2_JSON_POJO_BUILDER_ANNOTATION, withPrefixMvp, buildMethodNameMvp);
if (jacksonVersions.contains(JacksonVersion.TWO)) {
builderClass.annotations = addAnnotation(builderClass, builderClass.annotations, JacksonAnnotationType.JSON_POJO_BUILDER2.getQualifiednameAsCharArrayArray(), withPrefixMvp, buildMethodNameMvp);
}
if (jacksonVersion.useJackson3()) {
builderClass.annotations = addAnnotation(builderClass, builderClass.annotations, JACKSON3_JSON_POJO_BUILDER_ANNOTATION, withPrefixMvp, buildMethodNameMvp);
if (jacksonVersions.contains(JacksonVersion.THREE)) {
builderClass.annotations = addAnnotation(builderClass, builderClass.annotations, JacksonAnnotationType.JSON_POJO_BUILDER3.getQualifiednameAsCharArrayArray(), withPrefixMvp, buildMethodNameMvp);
}
// @SuperBuilder? Make it package-private!
if (superBuilderAnnotationNode != null)
builderClass.modifiers = builderClass.modifiers & ~ClassFileConstants.AccPrivate;
if (superBuilderAnnotationNode != null) builderClass.modifiers = builderClass.modifiers & ~ClassFileConstants.AccPrivate;
}
private void handleJacksonizedAccessors(Annotation ast, EclipseNode annotationNode, EclipseNode annotatedNode, EclipseNode tdNode, TypeDeclaration td, EclipseNode accessorsAnnotationNode, boolean jacksonizedBuilder) {
@@ -196,19 +194,33 @@ public class HandleJacksonized extends EclipseAnnotationHandler<Jacksonized> {
// Add @JsonProperty to all fields. It will be automatically copied to the getter/setters later.
for (EclipseNode eclipseNode : tdNode.down()) {
if (eclipseNode.getKind() == Kind.FIELD) {
createJsonPropertyForField(eclipseNode, annotationNode);
if (hasAnnotation(eclipseNode, JacksonAnnotationType.JSON_PROPERTY2) ||
hasAnnotation(eclipseNode, JacksonAnnotationType.JSON_IGNORE2)) {
return;
} else if (eclipseNode.isTransient()) {
createJsonIgnoreForField(eclipseNode, annotationNode);
} else {
createJsonPropertyForField(eclipseNode, annotationNode);
}
}
}
tdNode.rebuild();
}
private void createJsonPropertyForField(EclipseNode fieldNode, EclipseNode annotationNode) {
if (hasAnnotation("com.fasterxml.jackson.annotation.JsonProperty", fieldNode)) return;
ASTNode astNode = fieldNode.get();
if (astNode instanceof FieldDeclaration) {
FieldDeclaration fd = (FieldDeclaration)astNode;
FieldDeclaration fd = (FieldDeclaration) astNode;
StringLiteral fieldName = new StringLiteral(fd.name, 0, 0, 0);
((FieldDeclaration) astNode).annotations = addAnnotation(fieldNode.get(), fd.annotations, JSON_PROPERTY_ANNOTATION, fieldName);
((FieldDeclaration) astNode).annotations = addAnnotation(fieldNode.get(), fd.annotations, JacksonAnnotationType.JSON_PROPERTY2.getQualifiednameAsCharArrayArray(), fieldName);
}
}
private void createJsonIgnoreForField(EclipseNode fieldNode, EclipseNode annotationNode) {
ASTNode astNode = fieldNode.get();
if (astNode instanceof FieldDeclaration) {
FieldDeclaration fd = (FieldDeclaration) astNode;
((FieldDeclaration) astNode).annotations = addAnnotation(fieldNode.get(), fd.annotations, JacksonAnnotationType.JSON_IGNORE2.getQualifiednameAsCharArrayArray());
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2021 The Project Lombok Authors.
* Copyright (C) 2011-2025 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
@@ -24,7 +24,10 @@ package lombok.javac;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
@@ -36,7 +39,6 @@ import javax.tools.JavaFileObject;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.JCDiagnostic;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Log;
import lombok.permit.Permit;
@@ -53,9 +55,14 @@ public final class CompilerMessageSuppressor {
private static final Field deferDiagnosticsField, deferredDiagnosticsField, diagnosticHandlerField;
private static final ConcurrentMap<Class<?>, Field> handlerDeferredFields = new ConcurrentHashMap<Class<?>, Field>();
private static final Field NULL_FIELD;
private static final Class<?> DIAGNOSTIC_HANDLER;
private static final Class<?> DISCARD_DIAGNOSTIC_HANDLER;
private static final Method POP_DIAGNOSTIC_HANDLER;
private static final Constructor<?> DISCARD_DIAGNOSTIC_HANDLER_CONSTRUCTOR;
private Boolean dumpOnError, promptOnError;
private DiagnosticListener<?> contextDiagnosticListener, logDiagnosticListener;
private final Context context;
private Object diagnosticHandler;
private static final ThreadLocal<Queue<?>> queueCache = new ThreadLocal<Queue<?>>();
@@ -87,6 +94,11 @@ public final class CompilerMessageSuppressor {
diagnosticHandlerField = getDeclaredField(Log.class, "diagnosticHandler");
NULL_FIELD = getDeclaredField(JavacResolution.class, "NULL_FIELD");
DIAGNOSTIC_HANDLER = getClass("com.sun.tools.javac.util.Log$DiagnosticHandler");
DISCARD_DIAGNOSTIC_HANDLER = getClass("com.sun.tools.javac.util.Log$DiscardDiagnosticHandler");
POP_DIAGNOSTIC_HANDLER = DIAGNOSTIC_HANDLER != null ? Permit.permissiveGetMethod(Log.class, "popDiagnosticHandler", DIAGNOSTIC_HANDLER) : null;
DISCARD_DIAGNOSTIC_HANDLER_CONSTRUCTOR = DISCARD_DIAGNOSTIC_HANDLER != null ? Permit.permissiveGetConstructor(DISCARD_DIAGNOSTIC_HANDLER, Log.class) : null;
}
static Field getDeclaredField(Class<?> c, String fieldName) {
@@ -97,6 +109,14 @@ public final class CompilerMessageSuppressor {
}
}
static Class<?> getClass(String name) {
try {
return Class.forName(name);
} catch (Throwable t) {
return null;
}
}
public CompilerMessageSuppressor(Context context) {
this.log = Log.instance(context);
this.context = context;
@@ -118,16 +138,6 @@ public final class CompilerMessageSuppressor {
}
} catch (Exception e) {}
if (diagnosticHandlerField != null) try {
Object handler = diagnosticHandlerField.get(log);
Field field = getDeferredField(handler);
if (field != null) {
queueCache.set((Queue<?>) field.get(handler));
Queue<?> empty = new LinkedList<Object>();
field.set(handler, empty);
}
} catch (Exception e) {}
if (dumpOnErrorField != null) try {
dumpOnError = (Boolean) dumpOnErrorField.get(log);
dumpOnErrorField.set(log, false);
@@ -145,6 +155,11 @@ public final class CompilerMessageSuppressor {
diagnosticListenerField.set(log, null);
} catch (Exception e) {
}
if (DISCARD_DIAGNOSTIC_HANDLER != null) try {
diagnosticHandler = Permit.newInstance(DISCARD_DIAGNOSTIC_HANDLER_CONSTRUCTOR, log);
} catch (Exception e) {
}
}
private static Field getDeferredField(Object handler) {
@@ -183,19 +198,15 @@ public final class CompilerMessageSuppressor {
logDiagnosticListener = null;
} catch (Exception e) {}
if (diagnosticHandlerField != null && queueCache.get() != null) try {
Object handler = diagnosticHandlerField.get(log);
Field field = getDeferredField(handler);
if (field != null) {
field.set(handler, queueCache.get());
queueCache.set(null);
}
} catch (Exception e) {}
if (deferDiagnosticsField != null && queueCache.get() != null) try {
deferredDiagnosticsField.set(log, queueCache.get());
queueCache.set(null);
} catch (Exception e) {}
if (diagnosticHandler != null) try {
Permit.invoke(POP_DIAGNOSTIC_HANDLER, log, diagnosticHandler);
} catch (Exception e) {}
diagnosticHandler = null;
}
public void removeAllBetween(JavaFileObject sourcefile, int startPos, int endPos) {
@@ -222,11 +233,12 @@ public final class CompilerMessageSuppressor {
if (field == null || receiver == null) return;
try {
ListBuffer<?> deferredDiagnostics = (ListBuffer<?>) field.get(receiver);
ListBuffer<Object> newDeferredDiagnostics = new ListBuffer<Object>();
Collection<?> deferredDiagnostics = (Collection<?>) field.get(receiver);
if (deferredDiagnostics.isEmpty()) return;
LinkedList<Object> newDeferredDiagnostics = new LinkedList<Object>();
for (Object diag_ : deferredDiagnostics) {
if (!(diag_ instanceof JCDiagnostic)) {
newDeferredDiagnostics.append(diag_);
newDeferredDiagnostics.add(diag_);
continue;
}
JCDiagnostic diag = (JCDiagnostic) diag_;
@@ -234,7 +246,7 @@ public final class CompilerMessageSuppressor {
if (here >= startPos && here < endPos && diag.getSource() == sourcefile) {
// We eliminate it
} else {
newDeferredDiagnostics.append(diag);
newDeferredDiagnostics.add(diag);
}
}
field.set(receiver, newDeferredDiagnostics);
+2
View File
@@ -68,6 +68,7 @@ import com.sun.tools.javac.util.JCDiagnostic;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Position;
/**
* Wraps around javac's internal AST view to add useful features as well as the ability to visit parents from children,
@@ -595,6 +596,7 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
}
public void removeFromDeferredDiagnostics(int startPos, int endPos) {
if (startPos == Position.NOPOS || endPos == Position.NOPOS) return;
JCCompilationUnit self = (JCCompilationUnit) top().get();
new CompilerMessageSuppressor(getContext()).removeAllBetween(self.sourcefile, startPos, endPos);
}
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2021 The Project Lombok Authors.
* Copyright (C) 2011-2025 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
@@ -416,7 +416,7 @@ public class JavacResolution {
}
private static int compare(Name a, Name b) {
return a.compareTo(b);
return a.toString().compareTo(b.toString());
}
private static boolean isLocalType(TypeSymbol symbol) {
@@ -469,7 +469,7 @@ public class JavacResolution {
winLevel = level;
continue;
}
if (compare(winner.tsym.getQualifiedName(), t.tsym.getQualifiedName()) < 0) winner = t;
if (compare(winner.tsym.getQualifiedName(), t.tsym.getQualifiedName()) > 0) winner = t;
}
if (winner == null) return createJavaLangObject(ast);
return typeToJCTree(winner, ast, allowCompound, allowVoid, allowCapture);
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2025 The Project Lombok Authors.
* Copyright (C) 2020-2026 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
@@ -24,6 +24,9 @@ package lombok.javac.handlers;
import static lombok.core.handlers.HandlerUtil.handleExperimentalFlagUsage;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import java.util.Arrays;
import java.util.Collection;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -42,6 +45,7 @@ import lombok.ConfigurationKeys;
import lombok.core.AST.Kind;
import lombok.core.AnnotationValues;
import lombok.core.HandlerPriority;
import lombok.core.JacksonAnnotationType;
import lombok.core.configuration.JacksonVersion;
import lombok.core.handlers.HandlerUtil;
import lombok.experimental.Accessors;
@@ -60,6 +64,13 @@ import lombok.spi.Provides;
@Provides
@HandlerPriority(-512) // Above Handle(Super)Builder's level (builders must be already generated), but before all handlers generating getters/setters.
public class HandleJacksonized extends JavacAnnotationHandler<Jacksonized> {
static JCExpression chainDots(JavacNode node, JacksonAnnotationType annotation) {
return JavacHandlerUtil.chainDots(node, annotation.getQualifiedNameAsStringArray());
}
static boolean hasAnnotation(JavacNode node, JacksonAnnotationType annotation) {
return JavacHandlerUtil.hasAnnotation(annotation.getQualifiedName(), node);
}
@Override public void handle(AnnotationValues<Jacksonized> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.JACKSONIZED_FLAG_USAGE, "@Jacksonized");
@@ -101,27 +112,43 @@ public class HandleJacksonized extends JavacAnnotationHandler<Jacksonized> {
return;
}
// Add @JsonProperty to all fields. It will be automatically copied to the getter/setters later.
// Add @JsonProperty to all non-transient fields. It will be automatically copied to the getter/setters later.
// Add @JsonIgnore to all transient fields. It will be automatically copied to the getter/setters later.
for (JavacNode javacNode : tdNode.down()) {
if (javacNode.getKind() == Kind.FIELD) {
createJsonPropertyForField(javacNode, annotationNode);
if (hasAnnotation(annotationNode, JacksonAnnotationType.JSON_PROPERTY2) ||
hasAnnotation(annotationNode, JacksonAnnotationType.JSON_IGNORE2)) {
return;
} else if (javacNode.isTransient()) {
createJsonIgnoreForField(javacNode, annotationNode);
} else {
createJsonPropertyForField(javacNode, annotationNode);
}
}
}
}
private void createJsonPropertyForField(JavacNode fieldNode, JavacNode annotationNode) {
if (hasAnnotation("com.fasterxml.jackson.annotation.JsonProperty", fieldNode)) {
return;
}
JavacTreeMaker maker = fieldNode.getTreeMaker();
JCExpression jsonPropertyType = chainDots(fieldNode, "com", "fasterxml", "jackson", "annotation", "JsonProperty");
JCExpression jsonPropertyType = chainDots(fieldNode, JacksonAnnotationType.JSON_PROPERTY2);
JCAnnotation annotationJsonProperty = maker.Annotation(jsonPropertyType, List.<JCExpression>of(maker.Literal(fieldNode.getName())));
recursiveSetGeneratedBy(annotationJsonProperty, annotationNode);
JCVariableDecl fieldDecl = ((JCVariableDecl)fieldNode.get());
fieldDecl.mods.annotations = fieldDecl.mods.annotations.append(annotationJsonProperty);
}
private void createJsonIgnoreForField(JavacNode fieldNode, JavacNode annotationNode) {
JavacTreeMaker maker = fieldNode.getTreeMaker();
JCExpression jsonPropertyType = chainDots(fieldNode, JacksonAnnotationType.JSON_IGNORE2);
JCAnnotation annotationJsonProperty = maker.Annotation(jsonPropertyType, List.<JCExpression>nil());
recursiveSetGeneratedBy(annotationJsonProperty, annotationNode);
JCVariableDecl fieldDecl = ((JCVariableDecl)fieldNode.get());
fieldDecl.mods.annotations = fieldDecl.mods.annotations.append(annotationJsonProperty);
}
private void handleJacksonizedBuilder(JavacNode annotationNode, JavacNode annotatedNode, JavacNode tdNode, JCClassDecl td, JavacNode builderAnnotationNode, JavacNode superBuilderAnnotationNode) {
if (builderAnnotationNode != null && superBuilderAnnotationNode != null) {
annotationNode.addError("@Jacksonized cannot process both @Builder and @SuperBuilder on the same class.");
@@ -165,26 +192,24 @@ public class HandleJacksonized extends JavacAnnotationHandler<Jacksonized> {
}
// Insert @JsonDeserialize on annotated class.
if (hasAnnotation("com.fasterxml.jackson.databind.annotation.JsonDeserialize", tdNode)) {
if (hasAnnotation(tdNode, JacksonAnnotationType.JSON_DESERIALIZE2) || hasAnnotation(tdNode, JacksonAnnotationType.JSON_DESERIALIZE3)) {
annotationNode.addError("@JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson.");
return;
}
if (hasAnnotation("tools.jackson.databind.annotation.JsonDeserialize", tdNode)) {
annotationNode.addError("@JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson.");
return;
Collection<JacksonVersion> jacksonVersions = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, Arrays.<JacksonVersion>asList());
if (jacksonVersions.isEmpty()) {
annotationNode.addWarning("Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized");
jacksonVersions = Arrays.asList(JacksonVersion.TWO);
}
JacksonVersion jacksonVersion = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, JacksonVersion.getDefault());
if (jacksonVersion == null || !jacksonVersion.isValid()) {
annotationNode.addError("No valid jackson version selected.");
return;
}
if (jacksonVersion.useJackson2()) {
JCExpression jsonDeserializeType = chainDots(annotatedNode, "com", "fasterxml", "jackson", "databind", "annotation", "JsonDeserialize");
if (jacksonVersions.contains(JacksonVersion.TWO)) {
JCExpression jsonDeserializeType = chainDots(annotatedNode, JacksonAnnotationType.JSON_DESERIALIZE2);
insertJsonDeserializeAnnotation(annotationNode, annotatedNode, tdNode, td, maker, builderClassName, jsonDeserializeType);
}
if (jacksonVersion.useJackson3()) {
JCExpression jsonDeserializeType = chainDots(annotatedNode, "tools", "jackson", "databind", "annotation", "JsonDeserialize");
if (jacksonVersions.contains(JacksonVersion.THREE)) {
JCExpression jsonDeserializeType = chainDots(annotatedNode, JacksonAnnotationType.JSON_DESERIALIZE3);
insertJsonDeserializeAnnotation(annotationNode, annotatedNode, tdNode, td, maker, builderClassName, jsonDeserializeType);
}
@@ -195,28 +220,28 @@ public class HandleJacksonized extends JavacAnnotationHandler<Jacksonized> {
recursiveSetGeneratedBy(anno, annotationNode);
}
builderClass.mods.annotations = builderClass.mods.annotations.appendList(copiedAnnotations);
if (jacksonVersion.useJackson2()) {
JCExpression jsonPOJOBuilderType = chainDots(annotatedNode, "com", "fasterxml", "jackson", "databind", "annotation", "JsonPOJOBuilder");
insertJsonPojoAnnotation(annotationNode, annotatedNode, setPrefix, buildMethodName, maker, builderClass, jsonPOJOBuilderType);
if (jacksonVersions.contains(JacksonVersion.TWO)) {
JCExpression jsonPojoBuilderType = chainDots(annotatedNode, JacksonAnnotationType.JSON_POJO_BUILDER2);
insertJsonPojoAnnotation(annotationNode, annotatedNode, setPrefix, buildMethodName, maker, builderClass, jsonPojoBuilderType);
}
if (jacksonVersion.useJackson3()) {
JCExpression jsonPOJOBuilderType = chainDots(annotatedNode, "tools", "jackson", "databind", "annotation", "JsonPOJOBuilder");
insertJsonPojoAnnotation(annotationNode, annotatedNode, setPrefix, buildMethodName, maker, builderClass, jsonPOJOBuilderType);
if (jacksonVersions.contains(JacksonVersion.THREE)) {
JCExpression jsonPojoBuilderType = chainDots(annotatedNode, JacksonAnnotationType.JSON_POJO_BUILDER3);
insertJsonPojoAnnotation(annotationNode, annotatedNode, setPrefix, buildMethodName, maker, builderClass, jsonPojoBuilderType);
}
// @SuperBuilder? Make it package-private!
if (superBuilderAnnotationNode != null) builderClass.mods.flags = builderClass.mods.flags & ~Flags.PRIVATE;
}
// Insert @JsonPOJOBuilder on the builder class.
private void insertJsonPojoAnnotation(JavacNode annotationNode, JavacNode annotatedNode, String setPrefix, String buildMethodName, JavacTreeMaker maker, JCClassDecl builderClass, JCExpression jsonPOJOBuilderType) {
// Insert @JsonPojoBuilder on the builder class.
private void insertJsonPojoAnnotation(JavacNode annotationNode, JavacNode annotatedNode, String setPrefix, String buildMethodName, JavacTreeMaker maker, JCClassDecl builderClass, JCExpression jsonPojoBuilderType) {
JCExpression withPrefixExpr = maker.Assign(maker.Ident(annotationNode.toName("withPrefix")), maker.Literal(setPrefix));
JCExpression buildMethodNameExpr = maker.Assign(maker.Ident(annotationNode.toName("buildMethodName")), maker.Literal(buildMethodName));
JCAnnotation annotationJsonPOJOBuilder = maker.Annotation(jsonPOJOBuilderType, List.of(withPrefixExpr, buildMethodNameExpr));
recursiveSetGeneratedBy(annotationJsonPOJOBuilder, annotatedNode);
builderClass.mods.annotations = builderClass.mods.annotations.append(annotationJsonPOJOBuilder);
JCAnnotation annotationJsonPojoBuilder = maker.Annotation(jsonPojoBuilderType, List.of(withPrefixExpr, buildMethodNameExpr));
recursiveSetGeneratedBy(annotationJsonPojoBuilder, annotatedNode);
builderClass.mods.annotations = builderClass.mods.annotations.append(annotationJsonPojoBuilder);
}
// Insert @JsonDeserialize on the class.
private void insertJsonDeserializeAnnotation(JavacNode annotationNode, JavacNode annotatedNode, JavacNode tdNode, JCClassDecl td, JavacTreeMaker maker, String builderClassName, JCExpression jsonDeserializeType) {
JCExpression builderClassExpression = namePlusTypeParamsToTypeReference(maker, tdNode, annotationNode.toName(builderClassName), false, List.<JCTypeParameter>nil());
+9 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 The Project Lombok Authors.
* Copyright (C) 2018-2025 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
@@ -165,6 +165,14 @@ public class Permit {
return setAccessible(c.getDeclaredConstructor(parameterTypes));
}
public static <T> Constructor<T> permissiveGetConstructor(Class<T> c, Class<?>... parameterTypes) {
try {
return getConstructor(c, parameterTypes);
} catch (Exception ignore) {
return null;
}
}
private static Object reflectiveStaticFieldAccess(Class<?> c, String fName) {
try {
Field f = c.getDeclaredField(fName);
@@ -2,6 +2,8 @@
import java.util.function.Function;
public class ExtensionMethodInLambda {
private static final Function<String, String> testStatic = s -> ExtensionMethodInLambda.Extensions.reverse(s);
public void testSimple() {
String test = "test";
test = ExtensionMethodInLambda.Extensions.map(test, s -> ExtensionMethodInLambda.Extensions.reverse(s));
@@ -0,0 +1,62 @@
public class JacksonizedAccessorsTransient {
@com.fasterxml.jackson.annotation.JsonIgnore
private transient int intValue;
@com.fasterxml.jackson.annotation.JsonIgnore
private transient long longValue;
@com.fasterxml.jackson.annotation.JsonIgnore
private double doubleValue;
@com.fasterxml.jackson.annotation.JsonIgnore
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int intValue() {
return this.intValue;
}
@com.fasterxml.jackson.annotation.JsonIgnore
@java.lang.SuppressWarnings("all")
@lombok.Generated
public long longValue() {
return this.longValue;
}
@com.fasterxml.jackson.annotation.JsonIgnore
@java.lang.SuppressWarnings("all")
@lombok.Generated
public double doubleValue() {
return this.doubleValue;
}
/**
* @return {@code this}.
*/
@com.fasterxml.jackson.annotation.JsonIgnore
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedAccessorsTransient intValue(final int intValue) {
this.intValue = intValue;
return this;
}
/**
* @return {@code this}.
*/
@com.fasterxml.jackson.annotation.JsonIgnore
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedAccessorsTransient longValue(final long longValue) {
this.longValue = longValue;
return this;
}
/**
* @return {@code this}.
*/
@com.fasterxml.jackson.annotation.JsonIgnore
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedAccessorsTransient doubleValue(final double doubleValue) {
this.doubleValue = doubleValue;
return this;
}
}
@@ -4,12 +4,6 @@ class LoggerCommonsAccessPublic {
@lombok.Generated
public static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommonsAccessPublic.class);
}
class LoggerCommonsAccessModule {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommonsAccessModule.class);
}
class LoggerCommonsAccessProtected {
@java.lang.SuppressWarnings("all")
@@ -4,12 +4,6 @@ class LoggerCustomAccessPublic {
@lombok.Generated
public static final MyLogger log = MyLoggerFactory.create(LoggerCustomAccessPublic.class);
}
class LoggerCustomAccessModule {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final MyLogger log = MyLoggerFactory.create(LoggerCustomAccessModule.class);
}
class LoggerCustomAccessProtected {
@java.lang.SuppressWarnings("all")
@@ -4,12 +4,6 @@ class LoggerFloggerAccessPublic {
@lombok.Generated
public static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
}
class LoggerFloggerAccessModule {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
}
class LoggerFloggerAccessProtected {
@java.lang.SuppressWarnings("all")
@@ -4,12 +4,6 @@ class LoggerJBossLogAccessPublic {
@lombok.Generated
public static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(LoggerJBossLogAccessPublic.class);
}
class LoggerJBossLogAccessModule {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(LoggerJBossLogAccessModule.class);
}
class LoggerJBossLogAccessProtected {
@java.lang.SuppressWarnings("all")
@@ -4,12 +4,6 @@ class LoggerJulAccessPublic {
@lombok.Generated
public static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJulAccessPublic.class.getName());
}
class LoggerJulAccessModule {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJulAccessModule.class.getName());
}
class LoggerJulAccessProtected {
@java.lang.SuppressWarnings("all")
@@ -1,4 +1,4 @@
//version 8:
//version 8: Our Log4j2 version doesn't support Java 6
class LoggerLog4j2 {
@java.lang.SuppressWarnings("all")
@lombok.Generated
@@ -1,15 +1,10 @@
//version 8: Our Log4j2 version doesn't support Java 6
import lombok.AccessLevel;
class LoggerLog4j2AccessPublic {
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LoggerLog4j2AccessPublic.class);
}
class LoggerLog4j2AccessModule {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LoggerLog4j2AccessModule.class);
}
class LoggerLog4j2AccessProtected {
@java.lang.SuppressWarnings("all")
@@ -4,12 +4,6 @@ class LoggerLog4jAccessPublic {
@lombok.Generated
public static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4jAccessPublic.class);
}
class LoggerLog4jAccessModule {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4jAccessModule.class);
}
class LoggerLog4jAccessProtected {
@java.lang.SuppressWarnings("all")
@@ -4,12 +4,6 @@ class LoggerSlf4jAccessPublic {
@lombok.Generated
public static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jAccessPublic.class);
}
class LoggerSlf4jAccessModule {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jAccessModule.class);
}
class LoggerSlf4jAccessProtected {
@java.lang.SuppressWarnings("all")
@@ -0,0 +1,27 @@
import lombok.AccessLevel;
class LoggerXSlf4jAccessPublic {
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jAccessPublic.class);
}
class LoggerXSlf4jAccessProtected {
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jAccessProtected.class);
}
class LoggerXSlf4jAccessPackage {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jAccessPackage.class);
}
class LoggerXSlf4jAccessPrivate {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jAccessPrivate.class);
}
class LoggerXSlf4jAccessNone {
}
@@ -1,33 +0,0 @@
import lombok.AccessLevel;
class LoggerXslf4jAccessPublic {
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessPublic.class);
}
class LoggerXslf4jAccessModule {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessModule.class);
}
class LoggerXslf4jAccessProtected {
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessProtected.class);
}
class LoggerXslf4jAccessPackage {
@java.lang.SuppressWarnings("all")
@lombok.Generated
static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessPackage.class);
}
class LoggerXslf4jAccessPrivate {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessPrivate.class);
}
class LoggerXslf4jAccessNone {
}
@@ -15,6 +15,9 @@ public @ExtensionMethod(value = ExtensionMethodInLambda.Extensions.class) class
return "0";
}
}
private static final Function<String, String> testStatic = (<no type> s) -> ExtensionMethodInLambda.Extensions.reverse(s);
<clinit>() {
}
public ExtensionMethodInLambda() {
super();
}
@@ -0,0 +1,38 @@
public @lombok.extern.jackson.Jacksonized @lombok.experimental.Accessors(fluent = true) @lombok.Getter @lombok.Setter class JacksonizedAccessorsTransient {
private transient @com.fasterxml.jackson.annotation.JsonIgnore int intValue;
private transient @com.fasterxml.jackson.annotation.JsonIgnore long longValue;
private @com.fasterxml.jackson.annotation.JsonIgnore double doubleValue;
public JacksonizedAccessorsTransient() {
super();
}
public @java.lang.SuppressWarnings("all") @lombok.Generated int intValue() {
return this.intValue;
}
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated long longValue() {
return this.longValue;
}
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated double doubleValue() {
return this.doubleValue;
}
/**
* @return {@code this}.
*/
public @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsTransient intValue(final int intValue) {
this.intValue = intValue;
return this;
}
/**
* @return {@code this}.
*/
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsTransient longValue(final long longValue) {
this.longValue = longValue;
return this;
}
/**
* @return {@code this}.
*/
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsTransient doubleValue(final double doubleValue) {
this.doubleValue = doubleValue;
return this;
}
}
@@ -9,15 +9,6 @@ import lombok.extern.apachecommons.CommonsLog;
super();
}
}
@CommonsLog(access = AccessLevel.MODULE) class LoggerCommonsAccessModule {
static final @java.lang.SuppressWarnings("all") @lombok.Generated org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommonsAccessModule.class);
<clinit>() {
}
LoggerCommonsAccessModule() {
super();
}
}
@CommonsLog(access = AccessLevel.PROTECTED) class LoggerCommonsAccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommonsAccessProtected.class);
<clinit>() {
@@ -9,15 +9,6 @@ import lombok.CustomLog;
super();
}
}
@CustomLog(access = AccessLevel.MODULE) class LoggerCustomAccessModule {
static final @java.lang.SuppressWarnings("all") @lombok.Generated MyLogger log = MyLoggerFactory.create(LoggerCustomAccessModule.class);
<clinit>() {
}
LoggerCustomAccessModule() {
super();
}
}
@CustomLog(access = AccessLevel.PROTECTED) class LoggerCustomAccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated MyLogger log = MyLoggerFactory.create(LoggerCustomAccessProtected.class);
<clinit>() {
@@ -9,15 +9,6 @@ import lombok.extern.flogger.Flogger;
super();
}
}
@Flogger(access = AccessLevel.MODULE) class LoggerFloggerAccessModule {
static final @java.lang.SuppressWarnings("all") @lombok.Generated com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
<clinit>() {
}
LoggerFloggerAccessModule() {
super();
}
}
@Flogger(access = AccessLevel.PROTECTED) class LoggerFloggerAccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
<clinit>() {
@@ -9,15 +9,6 @@ import lombok.extern.jbosslog.JBossLog;
super();
}
}
@JBossLog(access = AccessLevel.MODULE) class LoggerJBossLogAccessModule {
static final @java.lang.SuppressWarnings("all") @lombok.Generated org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(LoggerJBossLogAccessModule.class);
<clinit>() {
}
LoggerJBossLogAccessModule() {
super();
}
}
@JBossLog(access = AccessLevel.PROTECTED) class LoggerJBossLogAccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(LoggerJBossLogAccessProtected.class);
<clinit>() {
@@ -9,15 +9,6 @@ import lombok.extern.java.Log;
super();
}
}
@Log(access = AccessLevel.MODULE) class LoggerJulAccessModule {
static final @java.lang.SuppressWarnings("all") @lombok.Generated java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJulAccessModule.class.getName());
<clinit>() {
}
LoggerJulAccessModule() {
super();
}
}
@Log(access = AccessLevel.PROTECTED) class LoggerJulAccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJulAccessProtected.class.getName());
<clinit>() {
@@ -9,15 +9,6 @@ import lombok.extern.log4j.Log4j2;
super();
}
}
@Log4j2(access = AccessLevel.MODULE) class LoggerLog4j2AccessModule {
static final @java.lang.SuppressWarnings("all") @lombok.Generated org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LoggerLog4j2AccessModule.class);
<clinit>() {
}
LoggerLog4j2AccessModule() {
super();
}
}
@Log4j2(access = AccessLevel.PROTECTED) class LoggerLog4j2AccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LoggerLog4j2AccessProtected.class);
<clinit>() {
@@ -9,15 +9,6 @@ import lombok.extern.log4j.Log4j;
super();
}
}
@Log4j(access = AccessLevel.MODULE) class LoggerLog4jAccessModule {
static final @java.lang.SuppressWarnings("all") @lombok.Generated org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4jAccessModule.class);
<clinit>() {
}
LoggerLog4jAccessModule() {
super();
}
}
@Log4j(access = AccessLevel.PROTECTED) class LoggerLog4jAccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4jAccessProtected.class);
<clinit>() {
@@ -9,15 +9,6 @@ import lombok.extern.slf4j.Slf4j;
super();
}
}
@Slf4j(access = AccessLevel.MODULE) class LoggerSlf4jAccessModule {
static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jAccessModule.class);
<clinit>() {
}
LoggerSlf4jAccessModule() {
super();
}
}
@Slf4j(access = AccessLevel.PROTECTED) class LoggerSlf4jAccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jAccessProtected.class);
<clinit>() {
@@ -0,0 +1,43 @@
import lombok.AccessLevel;
import lombok.extern.slf4j.XSlf4j;
@XSlf4j(access = AccessLevel.PUBLIC) class LoggerXSlf4jAccessPublic {
public static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jAccessPublic.class);
<clinit>() {
}
LoggerXSlf4jAccessPublic() {
super();
}
}
@XSlf4j(access = AccessLevel.PROTECTED) class LoggerXSlf4jAccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jAccessProtected.class);
<clinit>() {
}
LoggerXSlf4jAccessProtected() {
super();
}
}
@XSlf4j(access = AccessLevel.PACKAGE) class LoggerXSlf4jAccessPackage {
static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jAccessPackage.class);
<clinit>() {
}
LoggerXSlf4jAccessPackage() {
super();
}
}
@XSlf4j(access = AccessLevel.PRIVATE) class LoggerXSlf4jAccessPrivate {
private static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jAccessPrivate.class);
<clinit>() {
}
LoggerXSlf4jAccessPrivate() {
super();
}
}
@XSlf4j(access = AccessLevel.NONE) class LoggerXSlf4jAccessNone {
LoggerXSlf4jAccessNone() {
super();
}
}
@@ -1,52 +0,0 @@
import lombok.AccessLevel;
import lombok.extern.slf4j.XSlf4j;
@XSlf4j(access = AccessLevel.PUBLIC) class LoggerXslf4jAccessPublic {
public static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessPublic.class);
<clinit>() {
}
LoggerXslf4jAccessPublic() {
super();
}
}
@XSlf4j(access = AccessLevel.MODULE) class LoggerXslf4jAccessModule {
static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessModule.class);
<clinit>() {
}
LoggerXslf4jAccessModule() {
super();
}
}
@XSlf4j(access = AccessLevel.PROTECTED) class LoggerXslf4jAccessProtected {
protected static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessProtected.class);
<clinit>() {
}
LoggerXslf4jAccessProtected() {
super();
}
}
@XSlf4j(access = AccessLevel.PACKAGE) class LoggerXslf4jAccessPackage {
static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessPackage.class);
<clinit>() {
}
LoggerXslf4jAccessPackage() {
super();
}
}
@XSlf4j(access = AccessLevel.PRIVATE) class LoggerXslf4jAccessPrivate {
private static final @java.lang.SuppressWarnings("all") @lombok.Generated org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXslf4jAccessPrivate.class);
<clinit>() {
}
LoggerXslf4jAccessPrivate() {
super();
}
}
@XSlf4j(access = AccessLevel.NONE) class LoggerXslf4jAccessNone {
LoggerXslf4jAccessNone() {
super();
}
}
@@ -4,6 +4,8 @@ import lombok.experimental.ExtensionMethod;
@ExtensionMethod(value = ExtensionMethodInLambda.Extensions.class)
public class ExtensionMethodInLambda {
private static final Function<String, String> testStatic = s -> s.reverse();
public void testSimple() {
String test = "test";
test = test.map(s -> s.reverse());
@@ -0,0 +1,9 @@
@lombok.extern.jackson.Jacksonized
@lombok.experimental.Accessors(fluent = true)
@lombok.Getter
@lombok.Setter
public class JacksonizedAccessorsTransient {
private transient int intValue;
@com.fasterxml.jackson.annotation.JsonIgnore private transient long longValue;
@com.fasterxml.jackson.annotation.JsonIgnore private double doubleValue;
}
@@ -5,10 +5,6 @@ import lombok.extern.apachecommons.CommonsLog;
class LoggerCommonsAccessPublic {
}
@CommonsLog(access = AccessLevel.MODULE)
class LoggerCommonsAccessModule {
}
@CommonsLog(access = AccessLevel.PROTECTED)
class LoggerCommonsAccessProtected {
}
@@ -6,10 +6,6 @@ import lombok.CustomLog;
class LoggerCustomAccessPublic {
}
@CustomLog(access = AccessLevel.MODULE)
class LoggerCustomAccessModule {
}
@CustomLog(access = AccessLevel.PROTECTED)
class LoggerCustomAccessProtected {
}
@@ -5,10 +5,6 @@ import lombok.extern.flogger.Flogger;
class LoggerFloggerAccessPublic {
}
@Flogger(access = AccessLevel.MODULE)
class LoggerFloggerAccessModule {
}
@Flogger(access = AccessLevel.PROTECTED)
class LoggerFloggerAccessProtected {
}
@@ -5,10 +5,6 @@ import lombok.extern.jbosslog.JBossLog;
class LoggerJBossLogAccessPublic {
}
@JBossLog(access = AccessLevel.MODULE)
class LoggerJBossLogAccessModule {
}
@JBossLog(access = AccessLevel.PROTECTED)
class LoggerJBossLogAccessProtected {
}
@@ -5,10 +5,6 @@ import lombok.extern.java.Log;
class LoggerJulAccessPublic {
}
@Log(access = AccessLevel.MODULE)
class LoggerJulAccessModule {
}
@Log(access = AccessLevel.PROTECTED)
class LoggerJulAccessProtected {
}
@@ -1,4 +1,4 @@
//version 8:
//version 8: Our Log4j2 version doesn't support Java 6
import lombok.extern.log4j.Log4j2;
@lombok.extern.log4j.Log4j2
@@ -1,3 +1,4 @@
// version 8: Our Log4j2 version doesn't support Java 6
import lombok.AccessLevel;
import lombok.extern.log4j.Log4j2;
@@ -5,10 +6,6 @@ import lombok.extern.log4j.Log4j2;
class LoggerLog4j2AccessPublic {
}
@Log4j2(access = AccessLevel.MODULE)
class LoggerLog4j2AccessModule {
}
@Log4j2(access = AccessLevel.PROTECTED)
class LoggerLog4j2AccessProtected {
}
@@ -5,10 +5,6 @@ import lombok.extern.log4j.Log4j;
class LoggerLog4jAccessPublic {
}
@Log4j(access = AccessLevel.MODULE)
class LoggerLog4jAccessModule {
}
@Log4j(access = AccessLevel.PROTECTED)
class LoggerLog4jAccessProtected {
}
@@ -5,10 +5,6 @@ import lombok.extern.slf4j.Slf4j;
class LoggerSlf4jAccessPublic {
}
@Slf4j(access = AccessLevel.MODULE)
class LoggerSlf4jAccessModule {
}
@Slf4j(access = AccessLevel.PROTECTED)
class LoggerSlf4jAccessProtected {
}
@@ -2,25 +2,21 @@ import lombok.AccessLevel;
import lombok.extern.slf4j.XSlf4j;
@XSlf4j(access = AccessLevel.PUBLIC)
class LoggerXslf4jAccessPublic {
}
@XSlf4j(access = AccessLevel.MODULE)
class LoggerXslf4jAccessModule {
class LoggerXSlf4jAccessPublic {
}
@XSlf4j(access = AccessLevel.PROTECTED)
class LoggerXslf4jAccessProtected {
class LoggerXSlf4jAccessProtected {
}
@XSlf4j(access = AccessLevel.PACKAGE)
class LoggerXslf4jAccessPackage {
class LoggerXSlf4jAccessPackage {
}
@XSlf4j(access = AccessLevel.PRIVATE)
class LoggerXslf4jAccessPrivate {
class LoggerXSlf4jAccessPrivate {
}
@XSlf4j(access = AccessLevel.NONE)
class LoggerXslf4jAccessNone {
class LoggerXSlf4jAccessNone {
}
@@ -1 +1 @@
19 cannot find symbol symbol: method invalid((s)->s.reverse()) location: variable test of type java.lang.String
21 cannot find symbol symbol: method invalid((s)->s.reverse()) location: variable test of type java.lang.String
@@ -1 +1,7 @@
6 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
7 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
8 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
9 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
10 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
11 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
12 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
@@ -1 +1 @@
19 The method invalid((<no type> s) -> {}) is undefined for the type String
21 The method invalid((<no type> s) -> {}) is undefined for the type String
@@ -1 +1 @@
17 cannot find symbol symbol: method invalid((s)->s.reverse()) location: variable test of type java.lang.String
19 cannot find symbol symbol: method invalid((s)->s.reverse()) location: variable test of type java.lang.String