mirror of
https://github.com/tiennm99/lombok.git
synced 2026-09-14 08:18:43 +00:00
[i3667] change default behaviour: lombok.Generated now generated by default
This commit is contained in:
@@ -87,7 +87,7 @@ public class ConfigurationKeys {
|
||||
*
|
||||
* If {@code true}, lombok generates {@code @lombok.Generated} on all fields, methods, and types that are generated.
|
||||
*/
|
||||
public static final ConfigurationKey<Boolean> ADD_LOMBOK_GENERATED_ANNOTATIONS = new ConfigurationKey<Boolean>("lombok.addLombokGeneratedAnnotation", "Generate @lombok.Generated on all generated code (default: false).") {};
|
||||
public static final ConfigurationKey<Boolean> ADD_LOMBOK_GENERATED_ANNOTATIONS = new ConfigurationKey<Boolean>("lombok.addLombokGeneratedAnnotation", "Generate @lombok.Generated on all generated code (default: true).") {};
|
||||
|
||||
/**
|
||||
* lombok configuration: {@code lombok.extern.findbugs.addSuppressFBWarnings} = {@code true} | {@code false}.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015-2016 The Project Lombok Authors.
|
||||
* Copyright (C) 2015-2024 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
|
||||
@@ -27,14 +27,14 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Lombok will eventually automatically add this annotation to all generated constructors, methods, fields, and types.
|
||||
* Lombok automatically adds this annotation to all generated constructors, methods, fields, and types.
|
||||
*
|
||||
* You can mark the presence of this annotation as 'ignore it' for all code style and bug finding tools.
|
||||
* <p>
|
||||
* NB: As of v1.16.2 which introduces this annotation, lombok doesn't actually add this annotation; we're setting
|
||||
* it up so that lombok jars in widespread use start having this, which will make it easier to actually apply it
|
||||
* later on. By adding {@code lombok.addLombokGeneratedAnnotation = true} to {@code lombok.config} you can already
|
||||
* get this behavior.
|
||||
* NB: As of v1.18.34, lombok adds this annotation by default; before then you had to add a lombok config key.
|
||||
* <p>
|
||||
* If you want to opt out (not recommended), you can add {@code lombok.addLombokGeneratedAnnotation = false} to
|
||||
* {@code lombok.config}.
|
||||
*/
|
||||
@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
|
||||
@@ -2098,7 +2098,7 @@ public class EclipseHandlerUtil {
|
||||
if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_JAKARTA_GENERATED_ANNOTATIONS))) {
|
||||
result = addAnnotation(source, result, JAKARTA_ANNOTATION_GENERATED, new StringLiteral(LOMBOK, 0, 0, 0));
|
||||
}
|
||||
if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_LOMBOK_GENERATED_ANNOTATIONS))) {
|
||||
if (!Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_LOMBOK_GENERATED_ANNOTATIONS))) {
|
||||
result = addAnnotation(source, result, LOMBOK_GENERATED);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -1542,7 +1542,7 @@ public class JavacHandlerUtil {
|
||||
if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_JAKARTA_GENERATED_ANNOTATIONS))) {
|
||||
addAnnotation(mods, node, source, "jakarta.annotation.Generated", node.getTreeMaker().Literal("lombok"));
|
||||
}
|
||||
if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_LOMBOK_GENERATED_ANNOTATIONS))) {
|
||||
if (!Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_LOMBOK_GENERATED_ANNOTATIONS))) {
|
||||
addAnnotation(mods, node, source, "lombok.Generated", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//CONF: lombok.addJavaxGeneratedAnnotation = true
|
||||
//CONF: lombok.addLombokGeneratedAnnotation = true
|
||||
class GeneratedJavaxOnLombokOn {
|
||||
@lombok.Getter
|
||||
int x;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//CONF: lombok.addGeneratedAnnotation = false
|
||||
//CONF: lombok.addLombokGeneratedAnnotation = true
|
||||
class GeneratedOffLombokOn {
|
||||
@lombok.Getter
|
||||
int x;
|
||||
|
||||
Reference in New Issue
Block a user