From fa1d765445d5f883af3a53cd86878cc4b2f51910 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Thu, 19 Dec 2013 23:21:48 +0100 Subject: Added flag PARAMETER to the generated parameters. --- src/core/lombok/javac/handlers/HandleSetter.java | 2 +- src/core/lombok/javac/handlers/HandleWither.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lombok/javac/handlers/HandleSetter.java b/src/core/lombok/javac/handlers/HandleSetter.java index 444c2be9..bd11b06c 100644 --- a/src/core/lombok/javac/handlers/HandleSetter.java +++ b/src/core/lombok/javac/handlers/HandleSetter.java @@ -211,7 +211,7 @@ public class HandleSetter extends JavacAnnotationHandler { Name methodName = field.toName(setterName); List annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables); - long flags = JavacHandlerUtil.addFinalIfNeeded(0L, field.getContext()); + long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, field.getContext()); JCVariableDecl param = treeMaker.VarDef(treeMaker.Modifiers(flags, annsOnParam), fieldDecl.name, fieldDecl.vartype, null); if (nonNulls.isEmpty()) { diff --git a/src/core/lombok/javac/handlers/HandleWither.java b/src/core/lombok/javac/handlers/HandleWither.java index 85ac3e37..aff84c8e 100644 --- a/src/core/lombok/javac/handlers/HandleWither.java +++ b/src/core/lombok/javac/handlers/HandleWither.java @@ -214,7 +214,7 @@ public class HandleWither extends JavacAnnotationHandler { Name methodName = field.toName(witherName); List annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables); - long flags = JavacHandlerUtil.addFinalIfNeeded(0L, field.getContext()); + long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, field.getContext()); JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, annsOnParam), fieldDecl.name, fieldDecl.vartype, null); JCExpression selfType = cloneSelfType(field); -- cgit From 9760b35197969465736c004c6c4e4a283b1b8d3b Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Thu, 2 Jan 2014 23:43:52 +0100 Subject: 591: setting positions for parameters even when running in NB editor, to avoid problems in javac's Flow. --- src/core/lombok/javac/handlers/JavacHandlerUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index ef2a936a..03c2dcff 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -149,7 +149,7 @@ public class JavacHandlerUtil { if (source == null) generatedNodes.remove(node); else generatedNodes.put(node, new WeakReference(source)); } - if (source != null && !inNetbeansEditor(context)) node.pos = source.pos; + if (source != null && (!inNetbeansEditor(context) || (node instanceof JCVariableDecl && (((JCVariableDecl) node).mods.flags & Flags.PARAMETER) != 0))) node.pos = source.pos; return node; } -- cgit From 685ddfd52ebba4ca85ff93e08de14f38ecd8714b Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Thu, 9 Jan 2014 04:46:59 +0100 Subject: Added code to NOT add @SuppressWarnings to things if a @SuppressWarnings is already there. Lombok itself can't ever do that anyway (we don't add @SW except to things we just generated fresh), but some lombok extension builders do, and this helps them. --- src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 13 +++++++++++++ src/core/lombok/javac/handlers/JavacHandlerUtil.java | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 5e322c90..467ae0c3 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -1388,6 +1388,19 @@ public class EclipseHandlerUtil { private static final char[] ALL = "all".toCharArray(); public static Annotation[] createSuppressWarningsAll(ASTNode source, Annotation[] originalAnnotationArray) { + if (originalAnnotationArray != null) for (Annotation ann : originalAnnotationArray) { + char[] lastToken = null; + + if (ann.type instanceof QualifiedTypeReference) { + char[][] t = ((QualifiedTypeReference) ann.type).tokens; + lastToken = t[t.length - 1]; + } else if (ann.type instanceof SingleTypeReference) { + lastToken = ((SingleTypeReference) ann.type).token; + } + + if (lastToken != null && new String(lastToken).equals("SuppressWarnings")) return originalAnnotationArray; + } + int pS = source.sourceStart, pE = source.sourceEnd; long p = (long)pS << 32 | pE; long[] poss = new long[3]; diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 03c2dcff..d6d47b6c 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -918,6 +918,14 @@ public class JavacHandlerUtil { private static void addSuppressWarningsAll(JCModifiers mods, JavacNode node, int pos, JCTree source, Context context) { if (!LombokOptionsFactory.getDelombokOptions(context).getFormatPreferences().generateSuppressWarnings()) return; + for (JCAnnotation ann : mods.annotations) { + JCTree annType = ann.getAnnotationType(); + Name lastPart = null; + if (annType instanceof JCIdent) lastPart = ((JCIdent) annType).name; + else if (annType instanceof JCFieldAccess) lastPart = ((JCFieldAccess) annType).name; + + if (lastPart != null && lastPart.contentEquals("SuppressWarnings")) return; + } JavacTreeMaker maker = node.getTreeMaker(); JCExpression suppressWarningsType = genJavaLangTypeRef(node, "SuppressWarnings"); JCLiteral allLiteral = maker.Literal("all"); -- cgit From a40a86ad532881acd311200a665b5f55790c55cc Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Thu, 9 Jan 2014 21:00:44 +0100 Subject: [#625] Instead of '31' as a prime number for hashCode(), use something else. 31, probably owing to its inclusion in Effective Java, is overused, as proven by Maaartinus in issue 625. Switching to 277 instead. Also, 1231/1237 pair used for booleans has been replaced by 2591/2609. --- src/core/lombok/core/handlers/HandlerUtil.java | 6 +++++- .../eclipse/handlers/HandleEqualsAndHashCode.java | 17 +++++++++-------- .../lombok/javac/handlers/HandleEqualsAndHashCode.java | 10 ++++++---- test/transform/resource/after-delombok/Accessors.java | 2 +- .../transform/resource/after-delombok/DataExtended.java | 2 +- test/transform/resource/after-delombok/DataIgnore.java | 2 +- .../resource/after-delombok/DataOnLocalClass.java | 6 +++--- test/transform/resource/after-delombok/DataPlain.java | 8 ++++---- .../resource/after-delombok/DataWithGetter.java | 2 +- .../resource/after-delombok/DataWithGetterNone.java | 2 +- .../resource/after-delombok/EqualsAndHashCode.java | 6 +++--- .../EqualsAndHashCodeWithSomeExistingMethods.java | 2 +- .../resource/after-delombok/GetterLazyBoolean.java | 4 ++-- .../resource/after-delombok/GetterLazyEahcToString.java | 2 +- .../resource/after-delombok/GetterSetterJavadoc.java | 2 +- test/transform/resource/after-delombok/ValuePlain.java | 6 +++--- test/transform/resource/after-ecj/Accessors.java | 2 +- test/transform/resource/after-ecj/DataExtended.java | 2 +- test/transform/resource/after-ecj/DataIgnore.java | 2 +- test/transform/resource/after-ecj/DataOnLocalClass.java | 6 +++--- test/transform/resource/after-ecj/DataPlain.java | 8 ++++---- test/transform/resource/after-ecj/DataWithGetter.java | 2 +- .../resource/after-ecj/DataWithGetterNone.java | 2 +- .../transform/resource/after-ecj/EqualsAndHashCode.java | 6 +++--- .../EqualsAndHashCodeWithSomeExistingMethods.java | 2 +- .../transform/resource/after-ecj/GetterLazyBoolean.java | 4 ++-- .../resource/after-ecj/GetterLazyEahcToString.java | 2 +- .../resource/after-ecj/GetterSetterJavadoc.java | 2 +- test/transform/resource/after-ecj/ValuePlain.java | 6 +++--- usage_examples/DataExample_post.jpage | 4 ++-- usage_examples/EqualsAndHashCodeExample_post.jpage | 4 ++-- usage_examples/ValueExample_post.jpage | 4 ++-- 32 files changed, 72 insertions(+), 65 deletions(-) diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java index 3d386054..c8076ab6 100644 --- a/src/core/lombok/core/handlers/HandlerUtil.java +++ b/src/core/lombok/core/handlers/HandlerUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 The Project Lombok Authors. + * Copyright (C) 2013-2014 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,6 +27,10 @@ import lombok.core.LombokNode; public class HandlerUtil { private HandlerUtil() {} + public static final int PRIME_FOR_HASHCODE = 277; + public static final int PRIME_FOR_TRUE = 2591; + public static final int PRIME_FOR_FALSE = 2609; + /** Checks if the given name is a valid identifier. * * If it is, this returns {@code true} and does nothing else. diff --git a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java index 3c8a7039..0b054159 100644 --- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java +++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java @@ -35,6 +35,7 @@ import java.util.Set; import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.core.AST.Kind; +import lombok.core.handlers.HandlerUtil; import lombok.core.AnnotationValues; import lombok.eclipse.Eclipse; import lombok.eclipse.EclipseAnnotationHandler; @@ -271,7 +272,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler Date: Thu, 9 Jan 2014 21:26:48 +0100 Subject: [#625] Changelog entry for this issue --- doc/changelog.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog.markdown b/doc/changelog.markdown index de6abef4..e681056a 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -5,6 +5,7 @@ Lombok Changelog * BUGFIX: v1.12.2's delombok turns all operator+assignments into just assignment. Fixed. [Issue #598](https://code.google.com/p/projectlombok/issues/detail?id=598) * BUGFIX: {Netbeans} v1.12.2 doesn't well with netbeans. [Issue #591](https://code.google.com/p/projectlombok/issues/detail?id=591) * ENHANCEMENT: Delombok now supports varied options for how it formats the resulting source files. This includes scanning the source for things like the preferred indent. Use option `--format-help` for more information. [Issue #608](http://code.google.com/p/projectlombok/issues/detail?id=608) +* DETAIL: The primes lombok generates for use in generated hashCode() methods used to be direct copies from Effective Java. It turns out these particular primes are used so much, they tend to be a bit more collision-prone, so we switched them. Now, '277' is used instead of '31'. The primes for booleans have also been changed. [Issue #625](https://code.google.com/p/projectlombok/issues/detail?id=625) ### v1.12.2 (October 10th, 2013) * PLATFORM: Initial JDK8 support, without affecting existing support for JDK6 and 7. [Issue #451](https://code.google.com/p/projectlombok/issues/detail?id=451). While lombok will now work on JDK8 / javac8, and netbeans 7.4 and up, lombok does not (yet) support new language features introduced with java8, such as lambda expressions. Support for these features will be added in a future version. -- cgit From ae4864ebc3974b17a512849e7018556c4a3d1935 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 14 Jan 2014 22:52:29 +0100 Subject: [#626] introduction of formatting options triggered a longer standing bug about wonky timing on replacing Options with LombokOptions, causing javac to complain about not recognizing i.e. a Getter annotation when using it more than once in a file. --- src/core/lombok/javac/LombokOptions.java | 15 ++++++++++----- src/delombok/lombok/delombok/Delombok.java | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/core/lombok/javac/LombokOptions.java b/src/core/lombok/javac/LombokOptions.java index 60d0ce5e..034cbafd 100644 --- a/src/core/lombok/javac/LombokOptions.java +++ b/src/core/lombok/javac/LombokOptions.java @@ -25,13 +25,14 @@ import java.util.HashSet; import java.util.Set; import lombok.delombok.FormatPreferences; +import lombok.delombok.LombokOptionsFactory; import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Options; public abstract class LombokOptions extends Options { - private boolean deleteLombokAnnotations = true; + private boolean deleteLombokAnnotations = false; private final Set changed = new HashSet(); private FormatPreferences formatPreferences = new FormatPreferences(null); @@ -48,13 +49,13 @@ public abstract class LombokOptions extends Options { } public static void markChanged(Context context, JCCompilationUnit ast) { - Options options = context.get(Options.optionsKey); - if (options instanceof LombokOptions) ((LombokOptions) options).changed.add(ast); + LombokOptions options = LombokOptionsFactory.getDelombokOptions(context); + options.changed.add(ast); } public static boolean shouldDeleteLombokAnnotations(Context context) { - Options options = context.get(Options.optionsKey); - return (options instanceof LombokOptions) && ((LombokOptions) options).deleteLombokAnnotations; + LombokOptions options = LombokOptionsFactory.getDelombokOptions(context); + return options.deleteLombokAnnotations; } protected LombokOptions(Context context) { @@ -62,4 +63,8 @@ public abstract class LombokOptions extends Options { } public abstract void putJavacOption(String optionName, String value); + + public void deleteLombokAnnotations() { + this.deleteLombokAnnotations = true; + } } diff --git a/src/delombok/lombok/delombok/Delombok.java b/src/delombok/lombok/delombok/Delombok.java index 9cb78a82..f64e36a1 100644 --- a/src/delombok/lombok/delombok/Delombok.java +++ b/src/delombok/lombok/delombok/Delombok.java @@ -467,6 +467,7 @@ public class Delombok { public boolean delombok() throws IOException { LombokOptions options = LombokOptionsFactory.getDelombokOptions(context); + options.deleteLombokAnnotations(); options.putJavacOption("ENCODING", charset.name()); if (classpath != null) options.putJavacOption("CLASSPATH", classpath); if (sourcepath != null) options.putJavacOption("SOURCEPATH", sourcepath); -- cgit From ed82259e5276810ce7c8a8e2da5d1bc1dd35d7f8 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 14 Jan 2014 22:52:44 +0100 Subject: [trivial] fixed typos in test files. --- test/transform/resource/after-delombok/GetterLazyBoolean.java | 2 +- test/transform/resource/after-ecj/GetterLazyBoolean.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/transform/resource/after-delombok/GetterLazyBoolean.java b/test/transform/resource/after-delombok/GetterLazyBoolean.java index 21b153c9..ba26e7b7 100644 --- a/test/transform/resource/after-delombok/GetterLazyBoolean.java +++ b/test/transform/resource/after-delombok/GetterLazyBoolean.java @@ -23,7 +23,7 @@ class GetterLazyBoolean { public int hashCode() { final int PRIME = 277; int result = 1; - result = result * PRIME + (this.isBooleanValue() ? 2591 : 2609); + result = result * PRIME + (this.isBooleanValue() ? 2609 : 2591); return result; } @java.lang.Override diff --git a/test/transform/resource/after-ecj/GetterLazyBoolean.java b/test/transform/resource/after-ecj/GetterLazyBoolean.java index 5b64c3b0..d3b257a7 100644 --- a/test/transform/resource/after-ecj/GetterLazyBoolean.java +++ b/test/transform/resource/after-ecj/GetterLazyBoolean.java @@ -59,7 +59,7 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 277; int result = 1; - result = ((result * PRIME) + (this.isBooleanValue() ? 2591 : 2609)); + result = ((result * PRIME) + (this.isBooleanValue() ? 2609 : 2591)); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { -- cgit From 71a22340ae70f9512fab48244b8ecaf5c73bf32a Mon Sep 17 00:00:00 2001 From: Tumi Date: Wed, 15 Jan 2014 00:12:35 +0100 Subject: #627: Fix for refactoring when @Getter(lazy=true) When if in NB Editor, just make the getter available (lazy stuff will be created when compiling). The inNetbeansEditor test is made after all the validations are made to the annotated field, and generates a regular getter for validations, Naviagator and autocompletion. --- src/core/lombok/javac/handlers/HandleGetter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java index ac0336ad..24121021 100644 --- a/src/core/lombok/javac/handlers/HandleGetter.java +++ b/src/core/lombok/javac/handlers/HandleGetter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 The Project Lombok Authors. + * Copyright (C) 2009-2014 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 @@ -225,7 +225,7 @@ public class HandleGetter extends JavacAnnotationHandler { List statements; JCTree toClearOfMarkers = null; - if (lazy) { + if (lazy && !inNetbeansEditor(field)) { toClearOfMarkers = fieldNode.init; statements = createLazyGetterBody(treeMaker, field, source); } else { -- cgit From 09ea02e4f5752e615be2ff5177be1fb328702a5b Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 15 Jan 2014 21:43:39 +0100 Subject: added package-infos to lots of packages, updated the javadoc in these, and made lots of private/package private methods 'public' in packages that aren't actually public API. Tumi asked for this, and I can imagine this is useful for others who are hacking add-ons to lombok. The package-info files clarify that we aren't committing to long-term stability of anything except the stuff directly in the lombok package, lombok.experimental, and lombok.extern. --- src/core/lombok/bytecode/package-info.java | 30 +++++++++++++++++++ src/core/lombok/core/debug/DebugSnapshot.java | 22 ++++++++++++++ src/core/lombok/core/debug/DebugSnapshotStore.java | 22 ++++++++++++++ src/core/lombok/core/debug/package-info.java | 31 ++++++++++++++++++++ src/core/lombok/core/handlers/package-info.java | 30 +++++++++++++++++++ src/core/lombok/core/package-info.java | 3 ++ .../core/runtimeDependencies/package-info.java | 34 ++++++++++++++++++++++ .../eclipse/handlers/EclipseHandlerUtil.java | 8 ++--- .../lombok/eclipse/handlers/HandleBuilder.java | 14 ++++----- .../lombok/eclipse/handlers/HandleCleanup.java | 6 ++-- .../lombok/eclipse/handlers/HandleConstructor.java | 10 +++---- .../eclipse/handlers/HandleEqualsAndHashCode.java | 26 ++++++++--------- src/core/lombok/eclipse/handlers/HandleGetter.java | 16 +++++----- src/core/lombok/eclipse/handlers/HandleLog.java | 8 ++--- .../lombok/eclipse/handlers/HandleNonNull.java | 6 ++-- src/core/lombok/eclipse/handlers/HandleSetter.java | 6 ++-- .../eclipse/handlers/HandleSneakyThrows.java | 6 ++-- .../eclipse/handlers/HandleSynchronized.java | 4 +-- .../lombok/eclipse/handlers/HandleToString.java | 12 ++++---- src/core/lombok/eclipse/handlers/HandleWither.java | 6 ++-- .../eclipse/handlers/SetGeneratedByVisitor.java | 21 +++++++++++++ src/core/lombok/eclipse/handlers/package-info.java | 5 +++- src/core/lombok/eclipse/package-info.java | 5 +++- src/core/lombok/experimental/package-info.java | 33 +++++++++++++++++++++ src/core/lombok/javac/apt/package-info.java | 3 ++ src/core/lombok/javac/handlers/HandleBuilder.java | 14 ++++----- src/core/lombok/javac/handlers/HandleCleanup.java | 8 ++--- .../lombok/javac/handlers/HandleConstructor.java | 16 +++++----- src/core/lombok/javac/handlers/HandleDelegate.java | 22 +++++++------- .../javac/handlers/HandleEqualsAndHashCode.java | 20 ++++++------- .../javac/handlers/HandleExtensionMethod.java | 8 ++--- src/core/lombok/javac/handlers/HandleGetter.java | 20 ++++++------- src/core/lombok/javac/handlers/HandleLog.java | 6 ++-- src/core/lombok/javac/handlers/HandleNonNull.java | 6 ++-- src/core/lombok/javac/handlers/HandleSetter.java | 10 +++---- .../lombok/javac/handlers/HandleSneakyThrows.java | 10 +++---- src/core/lombok/javac/handlers/HandleToString.java | 6 ++-- src/core/lombok/javac/handlers/HandleWither.java | 8 ++--- .../lombok/javac/handlers/JavacHandlerUtil.java | 12 ++++---- src/core/lombok/javac/handlers/package-info.java | 5 +++- src/core/lombok/javac/package-info.java | 7 +++-- src/core/lombok/package-info.java | 11 +++++-- 42 files changed, 402 insertions(+), 154 deletions(-) create mode 100644 src/core/lombok/bytecode/package-info.java create mode 100644 src/core/lombok/core/debug/package-info.java create mode 100644 src/core/lombok/core/handlers/package-info.java create mode 100644 src/core/lombok/core/runtimeDependencies/package-info.java create mode 100644 src/core/lombok/experimental/package-info.java diff --git a/src/core/lombok/bytecode/package-info.java b/src/core/lombok/bytecode/package-info.java new file mode 100644 index 00000000..9187c940 --- /dev/null +++ b/src/core/lombok/bytecode/package-info.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009-2014 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * This package contains utilities and handlers for the 'post-process class files' aspect of + * lombok. Lombok's class file post processing capabilities are based on Objectweb's ASM library. + * + * NB: This package is not public API in the sense that contents of this package, + * even public classes / methods / etc, may change in point releases. + */ +package lombok.bytecode; diff --git a/src/core/lombok/core/debug/DebugSnapshot.java b/src/core/lombok/core/debug/DebugSnapshot.java index 42bb62fe..3f554335 100644 --- a/src/core/lombok/core/debug/DebugSnapshot.java +++ b/src/core/lombok/core/debug/DebugSnapshot.java @@ -1,3 +1,25 @@ +/* + * Copyright (C) 2012-2014 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package lombok.core.debug; import java.lang.ref.WeakReference; diff --git a/src/core/lombok/core/debug/DebugSnapshotStore.java b/src/core/lombok/core/debug/DebugSnapshotStore.java index 11192bd3..19f4d5b1 100644 --- a/src/core/lombok/core/debug/DebugSnapshotStore.java +++ b/src/core/lombok/core/debug/DebugSnapshotStore.java @@ -1,3 +1,25 @@ +/* + * Copyright (C) 2012-2014 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package lombok.core.debug; import java.io.File; diff --git a/src/core/lombok/core/debug/package-info.java b/src/core/lombok/core/debug/package-info.java new file mode 100644 index 00000000..10d09c0d --- /dev/null +++ b/src/core/lombok/core/debug/package-info.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2012-2014 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * This package contains tooling used only to debug issues that cannot be found with research but + * which require releasing a production or edge release with extra introspective facilities in + * an attempt to add clarity to the exceptions or other messages that result when the bug occurs. + * + * NB: This package is not public API in the sense that contents of this package, + * even public classes / methods / etc, may change in point releases. + */ +package lombok.core.debug; \ No newline at end of file diff --git a/src/core/lombok/core/handlers/package-info.java b/src/core/lombok/core/handlers/package-info.java new file mode 100644 index 00000000..6496bdb4 --- /dev/null +++ b/src/core/lombok/core/handlers/package-info.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009-2014 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * This package contains utility methods and classes shared between javac-specific feature implementations + * and eclipse-specific feature implementations. + * + * NB: This package is not public API in the sense that contents of this package, + * even public classes / methods / etc, may change in point releases. + */ +package lombok.core.handlers; diff --git a/src/core/lombok/core/package-info.java b/src/core/lombok/core/package-info.java index 153d5ff3..97b5156e 100644 --- a/src/core/lombok/core/package-info.java +++ b/src/core/lombok/core/package-info.java @@ -26,5 +26,8 @@ * an implementation of SPI service loader (to avoid being dependent on a v1.6 JVM), * lombok's version, and annotations and support classes for your normal java code * that's primarily useful for developing and debugging lombok. + * + * NB: This package is not public API in the sense that contents of this package, + * even public classes / methods / etc, may change in point releases. */ package lombok.core; diff --git a/src/core/lombok/core/runtimeDependencies/package-info.java b/src/core/lombok/core/runtimeDependencies/package-info.java new file mode 100644 index 00000000..daceeb11 --- /dev/null +++ b/src/core/lombok/core/runtimeDependencies/package-info.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2009-2014 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * This package is the basis for lombok's (the jar, run as an application) ability to spin off + * a clone of itself that only contains files required as a runtime dependency. + * + * This feature was used for a short while to support {@code @SneakyThrows}, but this is no longer + * necessary. Currently no lombok features have any such dependencies though at some point we may + * reintroduce the concept, for example to support properties. + * + * It is possible we'll use a different mechanism at that point; use the infrastructure in this package + * with knowledge that it may be eliminated at any time. + */ +package lombok.core.runtimeDependencies; diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 467ae0c3..a40cb0c8 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 The Project Lombok Authors. + * Copyright (C) 2009-2014 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 @@ -1320,7 +1320,7 @@ public class EclipseHandlerUtil { return type.add(field, Kind.FIELD); } - private static boolean isEnumConstant(final FieldDeclaration field) { + public static boolean isEnumConstant(final FieldDeclaration field) { return ((field.initialization instanceof AllocationExpression) && (((AllocationExpression) field.initialization).enumConstant == field)); } @@ -1612,7 +1612,7 @@ public class EclipseHandlerUtil { return true; } - static List unboxAndRemoveAnnotationParameter(Annotation annotation, String annotationName, String errorName, EclipseNode errorNode) { + public static List unboxAndRemoveAnnotationParameter(Annotation annotation, String annotationName, String errorName, EclipseNode errorNode) { if ("value".equals(annotationName)) { // We can't unbox this, because SingleMemberAnnotation REQUIRES a value, and this method // is supposed to remove the value. That means we need to replace the SMA with either @@ -1704,7 +1704,7 @@ public class EclipseHandlerUtil { return Collections.emptyList(); } - static NameReference createNameReference(String name, Annotation source) { + public static NameReference createNameReference(String name, Annotation source) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long)pS << 32 | pE; diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index 981d77dc..ea282b3b 100644 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 The Project Lombok Authors. + * Copyright (C) 2013-2014 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 @@ -228,7 +228,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { } } - private MethodDeclaration generateBuilderMethod(String builderMethodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, ASTNode source) { + public MethodDeclaration generateBuilderMethod(String builderMethodName,