diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-01-30 15:43:41 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-01-30 15:43:41 +0100 |
commit | a7bd812893ecb1fa603229d81c924823426ea973 (patch) | |
tree | 93ff3584b63d89752c7bf7bc4ed97e0ab567c5d1 /src/delombok | |
parent | 7efbecfe49af452f117e6a16c969a4b2071e80cd (diff) | |
download | lombok-a7bd812893ecb1fa603229d81c924823426ea973.tar.gz lombok-a7bd812893ecb1fa603229d81c924823426ea973.tar.bz2 lombok-a7bd812893ecb1fa603229d81c924823426ea973.zip |
[i623] added eclipse code for generating @javax.annotation.Generated, and refactored java impl to reduce DRY violations. -f pretty now includes skipping generation of this annotation, and updated ALL the test cases.
Diffstat (limited to 'src/delombok')
-rw-r--r-- | src/delombok/lombok/delombok/Delombok.java | 5 | ||||
-rw-r--r-- | src/delombok/lombok/delombok/FormatPreferences.java | 16 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/delombok/lombok/delombok/Delombok.java b/src/delombok/lombok/delombok/Delombok.java index 059bb004..514fc2ec 100644 --- a/src/delombok/lombok/delombok/Delombok.java +++ b/src/delombok/lombok/delombok/Delombok.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 The Project Lombok Authors. + * Copyright (C) 2009-2015 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 @@ -204,7 +204,7 @@ public class Delombok { System.out.println(indentAndWordbreak(e.getValue(), 4, 70)); } System.out.println("Example: -f indent:4 -f emptyLines:indent"); - System.out.println("The '-f pretty' option is shorthand for '-f suppressWarnings:skip -f danceAroundIdeChecks:skip -f generateDelombokComment:skip -f javaLangAsFQN:skip'"); + System.out.println("The '-f pretty' option is shorthand for '-f suppressWarnings:skip -f generated:skip -f danceAroundIdeChecks:skip -f generateDelombokComment:skip -f javaLangAsFQN:skip'"); System.exit(0); return; } @@ -301,6 +301,7 @@ public class Delombok { if (prettyEnabled) { if (!formatPrefs.containsKey("suppresswarnings")) formatPrefs.put("suppresswarnings", "skip"); + if (!formatPrefs.containsKey("generated")) formatPrefs.put("generated", "skip"); if (!formatPrefs.containsKey("dancearoundidechecks")) formatPrefs.put("dancearoundidechecks", "skip"); if (!formatPrefs.containsKey("generatedelombokcomment")) formatPrefs.put("generatedelombokcomment", "skip"); if (!formatPrefs.containsKey("javalangasfqn")) formatPrefs.put("javalangasfqn", "skip"); diff --git a/src/delombok/lombok/delombok/FormatPreferences.java b/src/delombok/lombok/delombok/FormatPreferences.java index caacc246..1479a740 100644 --- a/src/delombok/lombok/delombok/FormatPreferences.java +++ b/src/delombok/lombok/delombok/FormatPreferences.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 The Project Lombok Authors. + * Copyright (C) 2013-2015 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,11 +43,11 @@ public final class FormatPreferences { keys.put("emptyLines", "Either 'indent' or 'blank'. indent means: Indent an empty line to the right level. Default: 'blank'"); keys.put("finalParams", "Either 'generate' or 'skip'. generate means: All lombok-generated methods set all parameters to final. Default: 'generate'"); keys.put("constructorProperties", "Either 'generate' or 'skip'. generate means: All lombok-generated constructors with 1 or more arguments get an @ConstructorProperties annotation. Default: 'generate'"); - keys.put("suppressWarnings", "Either 'generate' or 'skip'. generate means: All lombok-generated methods get a @SuppressWarnings annotation. Default: 'generate'"); + keys.put("suppressWarnings", "Either 'generate' or 'skip'. generate means: All lombok-generated methods, types, and fields get a @SuppressWarnings annotation. Default: 'generate'"); + keys.put("generated", "Either 'generate' or 'skip'. generate means: All lombok-generated methods, types, and fields get a @Generated(\"lombok\") annotation. Default: 'generate'"); keys.put("danceAroundIdeChecks", "Either 'generate' or 'skip'. generate means: Lombok will intentionally obfuscate some generated code to avoid IDE warnings. Default: 'generate'"); keys.put("generateDelombokComment", "Either 'generate' or 'skip'. generate means: Any file modified by delombok will have a comment stating this at the top. Default: 'generate'"); keys.put("javaLangAsFQN", "Either 'generate' or 'skip'. generate means: Any generated reference to java.lang classes are prefixed with `java.lang.`. Default: 'generate'"); - keys.put("generated", "Either 'generate' or 'skip'. generate means: All lombok-generated methods get a @Generated(\"lombok\") annotation. Default: 'generate'"); KEYS = Collections.unmodifiableMap(keys); } @@ -84,10 +84,10 @@ public final class FormatPreferences { this.generateFinalParams = unrollBoolean(preferences, "finalParams", "generate", "skip", true); this.generateConstructorProperties = unrollBoolean(preferences, "constructorProperties", "generate", "skip", true); this.generateSuppressWarnings = unrollBoolean(preferences, "suppressWarnings", "generate", "skip", true); + this.generateGenerated = unrollBoolean(preferences, "generated", "generate", "skip", true); this.danceAroundIdeChecks = unrollBoolean(preferences, "danceAroundIdeChecks", "generate", "skip", true); this.generateDelombokComment = unrollBoolean(preferences, "generateDelombokComment", "generate", "skip", true); this.javaLangAsFqn = unrollBoolean(preferences, "javaLangAsFQN", "generate", "skip", true); - this.generateGenerated = unrollBoolean(preferences, "generated", "generate", "skip", true); } private static boolean unrollBoolean(Map<String, String> preferences, String name, String trueStr, String falseStr, boolean defaultVal) { @@ -115,6 +115,10 @@ public final class FormatPreferences { return generateSuppressWarnings; } + public boolean generateGenerated() { + return generateGenerated; + } + public boolean generateFinalParams() { return generateFinalParams; } @@ -134,8 +138,4 @@ public final class FormatPreferences { public boolean generateConstructorProperties() { return generateConstructorProperties; } - - public boolean generateGenerated() { - return generateGenerated; - } } |