mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-18 08:14:57 +00:00
javax.annotation.Generated will no longer be applied by default (Oracle broke it with JDK9).
This commit is contained in:
1 parent
af8c2bf8e5
commit
72561d7428
4 files changed
+13
-6
No files matched your search
@@ -6,6 +6,7 @@ Lombok Changelog
|
||||
* PLATFORM: Possible support for jdk9 in the new IntelliJ, Netbeans and for Gradle.
|
||||
* DEVELOPMENT: Compiling lombok on JDK1.9 is now possible.
|
||||
* BUGFIX: The generated hashCode would break the contract if `callSuper=true,of={}`. [Issue #1505](https://github.com/rzwitserloot/lombok/issues/1505)
|
||||
* BREAKING CHANGE: _lombok config_ key `lombok.addJavaxGeneratedAnnotation` now defaults to `false` instead of true. Oracle broke this annotation with the release of JDK9, neccessitating this breaking change.
|
||||
|
||||
### v1.16.18 (July 3rd, 2017)
|
||||
* PLATFORM: JDK9 support much improved since v1.16.6; [Issue #985](https://github.com/rzwitserloot/lombok/issues/985)
|
||||
|
||||
@@ -41,19 +41,23 @@ public class ConfigurationKeys {
|
||||
/**
|
||||
* lombok configuration: {@code lombok.addGeneratedAnnotation} = {@code true} | {@code false}.
|
||||
*
|
||||
* If unset or {@code true}, lombok generates {@code @javax.annotation.Generated("lombok")} on all fields, methods, and types that are generated, unless {@code lombok.addJavaxGeneratedAnnotation} is set.
|
||||
* If {@code true}, lombok generates {@code @javax.annotation.Generated("lombok")} on all fields, methods, and types that are generated, unless {@code lombok.addJavaxGeneratedAnnotation} is set.
|
||||
* <br />
|
||||
* <em>BREAKING CHANGE</em>: Starting with lombok v2.0.0, defaults to {@code false} instead of {@code true}, as this annotation is broken in JDK9.
|
||||
*
|
||||
* @see ConfigurationKeys#ADD_JAVAX_GENERATED_ANNOTATIONS
|
||||
* @see ConfigurationKeys#ADD_LOMBOK_GENERATED_ANNOTATIONS
|
||||
* @deprecated Since version 1.16.14, use {@link #ADD_JAVAX_GENERATED_ANNOTATIONS} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ConfigurationKey<Boolean> ADD_GENERATED_ANNOTATIONS = new ConfigurationKey<Boolean>("lombok.addGeneratedAnnotation", "Generate @javax.annotation.Generated on all generated code (default: true). Deprecated, use 'lombok.addJavaxGeneratedAnnotation' instead.") {};
|
||||
public static final ConfigurationKey<Boolean> ADD_GENERATED_ANNOTATIONS = new ConfigurationKey<Boolean>("lombok.addGeneratedAnnotation", "Generate @javax.annotation.Generated on all generated code (default: false). Deprecated, use 'lombok.addJavaxGeneratedAnnotation' instead.") {};
|
||||
|
||||
/**
|
||||
* lombok configuration: {@code lombok.addJavaxGeneratedAnnotation} = {@code true} | {@code false}.
|
||||
*
|
||||
* If unset or {@code true}, lombok generates {@code @javax.annotation.Generated("lombok")} on all fields, methods, and types that are generated, unless {@code lombok.addGeneratedAnnotation} is set to {@code false}.
|
||||
* If {@code true}, lombok generates {@code @javax.annotation.Generated("lombok")} on all fields, methods, and types that are generated.
|
||||
* <br />
|
||||
* <em>BREAKING CHANGE</em>: Starting with lombok v2.0.0, defaults to {@code false} instead of {@code true}, as this annotation is broken in JDK9.
|
||||
*/
|
||||
public static final ConfigurationKey<Boolean> ADD_JAVAX_GENERATED_ANNOTATIONS = new ConfigurationKey<Boolean>("lombok.addJavaxGeneratedAnnotation", "Generate @javax.annotation.Generated on all generated code (default: follow lombok.addGeneratedAnnotation).") {};
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public class HandlerUtil {
|
||||
public static boolean shouldAddGenerated(LombokNode<?, ?, ?> node) {
|
||||
Boolean add = node.getAst().readConfiguration(ConfigurationKeys.ADD_JAVAX_GENERATED_ANNOTATIONS);
|
||||
if (add != null) return add;
|
||||
return !Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_GENERATED_ANNOTATIONS));
|
||||
return Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_GENERATED_ANNOTATIONS));
|
||||
}
|
||||
|
||||
public static void handleExperimentalFlagUsage(LombokNode<?, ?, ?> node, ConfigurationKey<FlagUsageType> key, String featureName) {
|
||||
|
||||
@@ -79,10 +79,12 @@
|
||||
</div>
|
||||
can be included. We suggest you put this in the root of your workspace directory.
|
||||
</p><p>
|
||||
Lombok normally adds <code>@javax.annotation.Generated</code> annotations to all generated nodes where possible. You can stop this with:
|
||||
Lombok can add <code>@javax.annotation.Generated</code> annotations to all generated nodes where possible. You can enable this with:
|
||||
<div class="snippet example">
|
||||
<code>lombok.addJavaxGeneratedAnnotation = false</code>
|
||||
<code>lombok.addJavaxGeneratedAnnotation = true</code>
|
||||
</div>
|
||||
We advise against this; JDK9 breaks this annotation, and it's unlikely to ever get fixed.<br />
|
||||
<em>NB:</em> Until Lombok v2.0.0, this setting defaulted to <code>true</code>.
|
||||
</p><p>
|
||||
Lombok can be configured to add <code>@lombok.Generated</code> annotations to all generated nodes where possible; useful for JaCoCo (which has built in support),
|
||||
or other style checkers and code coverage tools:
|
||||
|
||||
Reference in new issue
Block a user