From 7eee00a0b45106ee920572e9c3266bedc7112925 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Tue, 2 Sep 2025 11:20:10 +0200 Subject: [PATCH] [fixes #3931] Proper output for config tool addNullAnnotations --- .../configuration/NullAnnotationLibrary.java | 6 ++- .../features/annotations/lombok.config | 3 ++ .../resource/configurationRoot/out.txt | 41 +++++++++++++++++++ .../core/configuration/TestConfiguration.java | 6 +-- 4 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 test/configuration/resource/configurationRoot/features/annotations/lombok.config diff --git a/src/core/lombok/core/configuration/NullAnnotationLibrary.java b/src/core/lombok/core/configuration/NullAnnotationLibrary.java index 1187685f..52858e95 100644 --- a/src/core/lombok/core/configuration/NullAnnotationLibrary.java +++ b/src/core/lombok/core/configuration/NullAnnotationLibrary.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 The Project Lombok Authors. + * Copyright (C) 2020-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 @@ -156,4 +156,8 @@ public final class NullAnnotationLibrary implements ConfigurationValueType { if (atStart) throw new IllegalArgumentException(MSG + fqn); return fqn; } + + @Override public String toString() { + return key; + } } diff --git a/test/configuration/resource/configurationRoot/features/annotations/lombok.config b/test/configuration/resource/configurationRoot/features/annotations/lombok.config new file mode 100644 index 00000000..61794944 --- /dev/null +++ b/test/configuration/resource/configurationRoot/features/annotations/lombok.config @@ -0,0 +1,3 @@ +config.stopBubbling=true + +lombok.addNullAnnotations = jspecify \ No newline at end of file diff --git a/test/configuration/resource/configurationRoot/out.txt b/test/configuration/resource/configurationRoot/out.txt index b870d9bf..f6415862 100644 --- a/test/configuration/resource/configurationRoot/out.txt +++ b/test/configuration/resource/configurationRoot/out.txt @@ -32,6 +32,9 @@ lombok.copyableAnnotations += copy1 # BASE/d1/d11/lombok.config (stopped bubbling): # 7: lombok.copyableAnnotations += copy1 +# Generate some style of null annotation for generated code where this is relevant. (default: none). +clear lombok.addNullAnnotations + Configuration for: - BASE/d1/d11/d111 @@ -101,6 +104,9 @@ lombok.copyableAnnotations += copy2 # BASE/d1/d11/d111/lombok.config: # 5: lombok.copyableAnnotations += copy2 +# Generate some style of null annotation for generated code where this is relevant. (default: none). +clear lombok.addNullAnnotations + Configuration for 'BASE/d1/d12'. @@ -129,3 +135,38 @@ clear lombok.log.fieldName # Copy these annotations to getters, setters, with methods, builder-setters, etc. clear lombok.copyableAnnotations + +# Generate some style of null annotation for generated code where this is relevant. (default: none). +clear lombok.addNullAnnotations + + +Configuration for 'BASE/features/annotations'. + +# Emit a warning or error if @Accessors is used. +clear lombok.accessors.flagUsage + +# Generate setters that return 'this' instead of 'void' (default: false). +clear lombok.accessors.chain + +# Strip this field prefix, like 'f' or 'm_', from the names of generated getters, setters, and with-ers. +clear lombok.accessors.prefix + +# Generate @javax.annotation.Generated on all generated code (default: false). Deprecated, use 'lombok.addJavaxGeneratedAnnotation' instead. +clear lombok.addGeneratedAnnotation + +# Generate @javax.annotation.Generated on all generated code (default: follow lombok.addGeneratedAnnotation). +clear lombok.addJavaxGeneratedAnnotation + +# Generate @ConstructorProperties for generated constructors (default: false). +clear lombok.anyConstructor.addConstructorProperties + +# Use this name for the generated logger fields (default: 'log'). +clear lombok.log.fieldName + +# Copy these annotations to getters, setters, with methods, builder-setters, etc. +clear lombok.copyableAnnotations + +# Generate some style of null annotation for generated code where this is relevant. (default: none). +lombok.addNullAnnotations = jspecify +# BASE/features/annotations/lombok.config (stopped bubbling): +# 3: lombok.addNullAnnotations = jspecify diff --git a/test/configuration/src/lombok/core/configuration/TestConfiguration.java b/test/configuration/src/lombok/core/configuration/TestConfiguration.java index 0cde4534..d7d25a97 100644 --- a/test/configuration/src/lombok/core/configuration/TestConfiguration.java +++ b/test/configuration/src/lombok/core/configuration/TestConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2020 The Project Lombok Authors. + * Copyright (C) 2014-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 @@ -40,12 +40,12 @@ public class TestConfiguration { public void testDisplayVerbose() throws Exception { @SuppressWarnings(value = {"all", "unchecked", "deprecation"}) - Collection> keys = Arrays.asList(ACCESSORS_FLAG_USAGE, ACCESSORS_CHAIN, ACCESSORS_PREFIX, ADD_GENERATED_ANNOTATIONS, ADD_JAVAX_GENERATED_ANNOTATIONS, ANY_CONSTRUCTOR_ADD_CONSTRUCTOR_PROPERTIES, LOG_ANY_FIELD_NAME, COPYABLE_ANNOTATIONS); + Collection> keys = Arrays.asList(ACCESSORS_FLAG_USAGE, ACCESSORS_CHAIN, ACCESSORS_PREFIX, ADD_GENERATED_ANNOTATIONS, ADD_JAVAX_GENERATED_ANNOTATIONS, ANY_CONSTRUCTOR_ADD_CONSTRUCTOR_PROPERTIES, LOG_ANY_FIELD_NAME, COPYABLE_ANNOTATIONS, ADD_NULL_ANNOTATIONS); String baseName = "test/configuration/resource/configurationRoot/"; File directory = new File(baseName); String normalizedName = new File(directory.getAbsoluteFile().toURI().normalize()).toString().replace('\\', '/') + "/"; - Collection paths = Arrays.asList(normalizedName + "d1/d11", normalizedName + "d1/d12", normalizedName + "d1/d11/d111", normalizedName + "d1/d11/d111/f1.txt"); + Collection paths = Arrays.asList(normalizedName + "d1/d11", normalizedName + "d1/d12", normalizedName + "d1/d11/d111", normalizedName + "d1/d11/d111/f1.txt", normalizedName + "features/annotations"); ByteArrayOutputStream rawOut = new ByteArrayOutputStream(); ByteArrayOutputStream rawErr = new ByteArrayOutputStream();