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, String builderClassName, EclipseNode type, TypeParameter[] typeParams, ASTNode source) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long) pS << 32 | pE; @@ -247,7 +247,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { return out; } - private MethodDeclaration generateBuildMethod(String name, char[] staticName, TypeReference returnType, List fieldNames, EclipseNode type, ASTNode source, TypeReference[] thrownExceptions) { + public MethodDeclaration generateBuildMethod(String name, char[] staticName, TypeReference returnType, List fieldNames, EclipseNode type, ASTNode source, TypeReference[] thrownExceptions) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long) pS << 32 | pE; @@ -300,7 +300,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { return out; } - private List addFieldsToBuilder(EclipseNode builderType, List namesOfParameters, List typesOfParameters, ASTNode source) { + public List addFieldsToBuilder(EclipseNode builderType, List namesOfParameters, List typesOfParameters, ASTNode source) { int len = namesOfParameters.size(); TypeDeclaration td = (TypeDeclaration) builderType.get(); FieldDeclaration[] existing = td.fields; @@ -332,7 +332,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { private static final AbstractMethodDeclaration[] EMPTY = {}; - private MethodDeclaration makeSetterMethodForBuilder(EclipseNode builderType, EclipseNode fieldNode, ASTNode source, boolean fluent, boolean chain) { + public MethodDeclaration makeSetterMethodForBuilder(EclipseNode builderType, EclipseNode fieldNode, ASTNode source, boolean fluent, boolean chain) { TypeDeclaration td = (TypeDeclaration) builderType.get(); AbstractMethodDeclaration[] existing = td.methods; if (existing == null) existing = EMPTY; @@ -353,7 +353,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { source, Collections.emptyList(), Collections.emptyList()); } - private EclipseNode findInnerClass(EclipseNode parent, String name) { + public EclipseNode findInnerClass(EclipseNode parent, String name) { char[] c = name.toCharArray(); for (EclipseNode child : parent.down()) { if (child.getKind() != Kind.TYPE) continue; @@ -363,7 +363,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { return null; } - private EclipseNode makeBuilderClass(EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, ASTNode source) { + public EclipseNode makeBuilderClass(EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, ASTNode source) { TypeDeclaration parent = (TypeDeclaration) tdParent.get(); TypeDeclaration builder = new TypeDeclaration(parent.compilationResult); builder.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG; diff --git a/src/core/lombok/eclipse/handlers/HandleCleanup.java b/src/core/lombok/eclipse/handlers/HandleCleanup.java index cbf84e8b..b8ea1669 100644 --- a/src/core/lombok/eclipse/handlers/HandleCleanup.java +++ b/src/core/lombok/eclipse/handlers/HandleCleanup.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011 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 HandleCleanup extends EclipseAnnotationHandler { ancestor.rebuild(); } - private MessageSend preventNullAnalysis(Annotation ast, Expression expr) { + public MessageSend preventNullAnalysis(Annotation ast, Expression expr) { MessageSend singletonList = new MessageSend(); setGeneratedBy(singletonList, ast); @@ -254,7 +254,7 @@ public class HandleCleanup extends EclipseAnnotationHandler { return preventNullAnalysis; } - private void doAssignmentCheck(EclipseNode node, Statement[] tryBlock, char[] varName) { + public void doAssignmentCheck(EclipseNode node, Statement[] tryBlock, char[] varName) { for (Statement statement : tryBlock) doAssignmentCheck0(node, statement, varName); } diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java index 22285b2d..d86aadee 100644 --- a/src/core/lombok/eclipse/handlers/HandleConstructor.java +++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 The Project Lombok Authors. + * Copyright (C) 2010-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 @@ -211,7 +211,7 @@ public class HandleConstructor { } private static final char[][] JAVA_BEANS_CONSTRUCTORPROPERTIES = new char[][] { "java".toCharArray(), "beans".toCharArray(), "ConstructorProperties".toCharArray() }; - private static Annotation[] createConstructorProperties(ASTNode source, Collection fields) { + public static Annotation[] createConstructorProperties(ASTNode source, Collection fields) { if (fields.isEmpty()) return null; int pS = source.sourceStart, pE = source.sourceEnd; @@ -242,7 +242,7 @@ public class HandleConstructor { return new Annotation[] { ann }; } - static ConstructorDeclaration createConstructor( + public static ConstructorDeclaration createConstructor( AccessLevel level, EclipseNode type, Collection fields, boolean suppressConstructorProperties, ASTNode source, List onConstructor) { @@ -316,14 +316,14 @@ public class HandleConstructor { return constructor; } - private static boolean isLocalType(EclipseNode type) { + public static boolean isLocalType(EclipseNode type) { Kind kind = type.up().getKind(); if (kind == Kind.COMPILATION_UNIT) return false; if (kind == Kind.TYPE) return isLocalType(type.up()); return true; } - private MethodDeclaration createStaticConstructor(AccessLevel level, String name, EclipseNode type, Collection fields, ASTNode source) { + public MethodDeclaration createStaticConstructor(AccessLevel level, String name, EclipseNode type, Collection fields, ASTNode source) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long)pS << 32 | pE; diff --git a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java index 0b054159..8d95ca64 100644 --- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java +++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.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 @@ -92,10 +92,10 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler BUILT_IN_TYPES = Collections.unmodifiableSet(new HashSet(Arrays.asList( + public static final Set BUILT_IN_TYPES = Collections.unmodifiableSet(new HashSet(Arrays.asList( "byte", "short", "int", "long", "char", "boolean", "double", "float"))); - private void checkForBogusFieldNames(EclipseNode type, AnnotationValues annotation) { + public void checkForBogusFieldNames(EclipseNode type, AnnotationValues annotation) { if (annotation.isExplicit("exclude")) { for (int i : createListOfNonExistentFields(Arrays.asList(annotation.getInstance().exclude()), type, true, true)) { annotation.setWarning("exclude", "This field does not exist, or would have been excluded anyway.", i); @@ -248,7 +248,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler fields, boolean callSuper, ASTNode source, FieldAccess fieldAccess) { + public MethodDeclaration createHashCode(EclipseNode type, Collection fields, boolean callSuper, ASTNode source, FieldAccess fieldAccess) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long)pS << 32 | pE; @@ -403,7 +403,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler list = new ArrayList(); list.add(type.getName()); EclipseNode tNode = type.up(); @@ -458,7 +458,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler fields, boolean callSuper, ASTNode source, FieldAccess fieldAccess, boolean needsCanEqual) { + public MethodDeclaration createEquals(EclipseNode type, Collection fields, boolean callSuper, ASTNode source, FieldAccess fieldAccess, boolean needsCanEqual) { int pS = source.sourceStart; int pE = source.sourceEnd; long p = (long)pS << 32 | pE; TypeDeclaration typeDecl = (TypeDeclaration)type.get(); @@ -718,7 +718,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler>> 32 ^ ref) */ IntLiteral int32 = makeIntLiteral("32".toCharArray(), source); @@ -804,7 +804,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler { } } - private void createGetterForFields(AccessLevel level, Collection fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, boolean lazy, List onMethod) { + public void createGetterForFields(AccessLevel level, Collection fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, boolean lazy, List onMethod) { for (EclipseNode fieldNode : fieldNodes) { createGetterForField(level, fieldNode, errorNode, source, whineIfExists, lazy, onMethod); } } - private void createGetterForField(AccessLevel level, + public void createGetterForField(AccessLevel level, EclipseNode fieldNode, EclipseNode errorNode, ASTNode source, boolean whineIfExists, boolean lazy, List onMethod) { if (fieldNode.getKind() != Kind.FIELD) { errorNode.addError("@Getter is only supported on a class or a field."); @@ -220,7 +220,7 @@ public class HandleGetter extends EclipseAnnotationHandler { injectMethod(fieldNode.up(), method); } - private static Annotation[] findDelegatesAndMarkAsHandled(EclipseNode fieldNode) { + public static Annotation[] findDelegatesAndMarkAsHandled(EclipseNode fieldNode) { List delegates = new ArrayList(); for (EclipseNode child : fieldNode.down()) { if (annotationTypeMatches(Delegate.class, child)) { @@ -232,7 +232,7 @@ public class HandleGetter extends EclipseAnnotationHandler { return delegates.toArray(EMPTY_ANNOTATIONS_ARRAY); } - private MethodDeclaration createGetter(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, ASTNode source, boolean lazy, List onMethod) { + public MethodDeclaration createGetter(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, ASTNode source, boolean lazy, List onMethod) { FieldDeclaration field = (FieldDeclaration) fieldNode.get(); // Remember the type; lazy will change it; @@ -281,7 +281,7 @@ public class HandleGetter extends EclipseAnnotationHandler { return method; } - private Statement[] createSimpleGetterBody(ASTNode source, EclipseNode fieldNode) { + public Statement[] createSimpleGetterBody(ASTNode source, EclipseNode fieldNode) { FieldDeclaration field = (FieldDeclaration) fieldNode.get(); Expression fieldRef = createFieldAccessor(fieldNode, FieldAccess.ALWAYS_FIELD, source); Statement returnStatement = new ReturnStatement(fieldRef, field.sourceStart, field.sourceEnd); @@ -290,7 +290,7 @@ public class HandleGetter extends EclipseAnnotationHandler { private static final char[][] AR = fromQualifiedName("java.util.concurrent.atomic.AtomicReference"); - private static final java.util.Map TYPE_MAP; + public static final java.util.Map TYPE_MAP; static { Map m = new HashMap(); m.put("int", fromQualifiedName("java.lang.Integer")); @@ -309,7 +309,7 @@ public class HandleGetter extends EclipseAnnotationHandler { private static final int PARENTHESIZED = (1 << ASTNode.ParenthesizedSHIFT) & ASTNode.ParenthesizedMASK; - private Statement[] createLazyGetterBody(ASTNode source, EclipseNode fieldNode) { + public Statement[] createLazyGetterBody(ASTNode source, EclipseNode fieldNode) { /* java.lang.Object value = this.fieldName.get(); if (value == null) { diff --git a/src/core/lombok/eclipse/handlers/HandleLog.java b/src/core/lombok/eclipse/handlers/HandleLog.java index dd2c7ea8..6b1e94be 100644 --- a/src/core/lombok/eclipse/handlers/HandleLog.java +++ b/src/core/lombok/eclipse/handlers/HandleLog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 The Project Lombok Authors. + * Copyright (C) 2010-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 @@ -83,7 +83,7 @@ public class HandleLog { } } - private static ClassLiteralAccess selfType(EclipseNode type, Annotation source) { + public static ClassLiteralAccess selfType(EclipseNode type, Annotation source) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long)pS << 32 | pE; @@ -97,7 +97,7 @@ public class HandleLog { return result; } - private static FieldDeclaration createField(LoggingFramework framework, Annotation source, ClassLiteralAccess loggingType) { + public static FieldDeclaration createField(LoggingFramework framework, Annotation source, ClassLiteralAccess loggingType) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long)pS << 32 | pE; @@ -128,7 +128,7 @@ public class HandleLog { return fieldDecl; } - private static TypeReference createTypeReference(String typeName, Annotation source) { + public static TypeReference createTypeReference(String typeName, Annotation source) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long)pS << 32 | pE; diff --git a/src/core/lombok/eclipse/handlers/HandleNonNull.java b/src/core/lombok/eclipse/handlers/HandleNonNull.java index 634cb2d9..7fd12ca3 100644 --- a/src/core/lombok/eclipse/handlers/HandleNonNull.java +++ b/src/core/lombok/eclipse/handlers/HandleNonNull.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 @@ -142,11 +142,11 @@ public class HandleNonNull extends EclipseAnnotationHandler { annotationNode.up().up().rebuild(); } - private boolean isNullCheck(Statement stat) { + public boolean isNullCheck(Statement stat) { return returnVarNameIfNullCheck(stat) != null; } - private char[] returnVarNameIfNullCheck(Statement stat) { + public char[] returnVarNameIfNullCheck(Statement stat) { if (!(stat instanceof IfStatement)) return null; /* Check that the if's statement is a throw statement, possibly in a block. */ { diff --git a/src/core/lombok/eclipse/handlers/HandleSetter.java b/src/core/lombok/eclipse/handlers/HandleSetter.java index 3bfcc51c..caa5329a 100644 --- a/src/core/lombok/eclipse/handlers/HandleSetter.java +++ b/src/core/lombok/eclipse/handlers/HandleSetter.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 @@ -141,13 +141,13 @@ public class HandleSetter extends EclipseAnnotationHandler { } } - private void createSetterForFields(AccessLevel level, Collection fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List onMethod, List onParam) { + public void createSetterForFields(AccessLevel level, Collection fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List onMethod, List onParam) { for (EclipseNode fieldNode : fieldNodes) { createSetterForField(level, fieldNode, errorNode, source, whineIfExists, onMethod, onParam); } } - private void createSetterForField( + public void createSetterForField( AccessLevel level, EclipseNode fieldNode, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List onMethod, List onParam) { diff --git a/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java b/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java index d3a95db8..d8261326 100644 --- a/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java +++ b/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2012 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 @@ -145,7 +145,7 @@ public class HandleSneakyThrows extends EclipseAnnotationHandler { // return true; // } - private void handleMethod(EclipseNode annotation, AbstractMethodDeclaration method, List exceptions) { + public void handleMethod(EclipseNode annotation, AbstractMethodDeclaration method, List exceptions) { if (method.isAbstract()) { annotation.addError("@SneakyThrows can only be used on concrete methods."); return; @@ -177,7 +177,7 @@ public class HandleSneakyThrows extends EclipseAnnotationHandler { annotation.up().rebuild(); } - private Statement buildTryCatchBlock(Statement[] contents, DeclaredException exception, ASTNode source, AbstractMethodDeclaration method) { + public Statement buildTryCatchBlock(Statement[] contents, DeclaredException exception, ASTNode source, AbstractMethodDeclaration method) { int methodStart = method.bodyStart; int methodEnd = method.bodyEnd; long methodPosEnd = ((long) methodEnd) << 32 | (methodEnd & 0xFFFFFFFFL); diff --git a/src/core/lombok/eclipse/handlers/HandleSynchronized.java b/src/core/lombok/eclipse/handlers/HandleSynchronized.java index f76f06ed..b3e51da0 100644 --- a/src/core/lombok/eclipse/handlers/HandleSynchronized.java +++ b/src/core/lombok/eclipse/handlers/HandleSynchronized.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2012 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 @@ -67,7 +67,7 @@ public class HandleSynchronized extends EclipseAnnotationHandler { createLockField(annotation, annotationNode, method.isStatic(), false); } - private char[] createLockField(AnnotationValues annotation, EclipseNode annotationNode, boolean isStatic, boolean reportErrors) { + public char[] createLockField(AnnotationValues annotation, EclipseNode annotationNode, boolean isStatic, boolean reportErrors) { char[] lockName = annotation.getInstance().value().toCharArray(); Annotation source = (Annotation) annotationNode.get(); boolean autoMake = false; diff --git a/src/core/lombok/eclipse/handlers/HandleToString.java b/src/core/lombok/eclipse/handlers/HandleToString.java index 1193af31..31ff3021 100644 --- a/src/core/lombok/eclipse/handlers/HandleToString.java +++ b/src/core/lombok/eclipse/handlers/HandleToString.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2012 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 @@ -67,7 +67,7 @@ import org.mangosdk.spi.ProviderFor; */ @ProviderFor(EclipseAnnotationHandler.class) public class HandleToString extends EclipseAnnotationHandler { - private void checkForBogusFieldNames(EclipseNode type, AnnotationValues annotation) { + public void checkForBogusFieldNames(EclipseNode type, AnnotationValues annotation) { if (annotation.isExplicit("exclude")) { for (int i : createListOfNonExistentFields(Arrays.asList(annotation.getInstance().exclude()), type, true, false)) { annotation.setWarning("exclude", "This field does not exist, or would have been excluded anyway.", i); @@ -170,7 +170,7 @@ public class HandleToString extends EclipseAnnotationHandler { } } - static MethodDeclaration createToString(EclipseNode type, Collection fields, + public static MethodDeclaration createToString(EclipseNode type, Collection fields, boolean includeFieldNames, boolean callSuper, ASTNode source, FieldAccess fieldAccess) { String typeName = getTypeName(type); char[] suffix = ")".toCharArray(); @@ -282,7 +282,7 @@ public class HandleToString extends EclipseAnnotationHandler { return method; } - private static String getTypeName(EclipseNode type) { + public static String getTypeName(EclipseNode type) { String typeName = getSingleTypeName(type); EclipseNode upType = type.up(); while (upType.getKind() == Kind.TYPE) { @@ -292,7 +292,7 @@ public class HandleToString extends EclipseAnnotationHandler { return typeName; } - private static String getSingleTypeName(EclipseNode type) { + public static String getSingleTypeName(EclipseNode type) { TypeDeclaration typeDeclaration = (TypeDeclaration)type.get(); char[] rawTypeName = typeDeclaration.name; return rawTypeName == null ? "" : new String(rawTypeName); @@ -301,7 +301,7 @@ public class HandleToString extends EclipseAnnotationHandler { private static final Set BUILT_IN_TYPES = Collections.unmodifiableSet(new HashSet(Arrays.asList( "byte", "short", "int", "long", "char", "boolean", "double", "float"))); - private static NameReference generateQualifiedNameRef(ASTNode source, char[]... varNames) { + public static NameReference generateQualifiedNameRef(ASTNode source, char[]... varNames) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long)pS << 32 | pE; NameReference ref; diff --git a/src/core/lombok/eclipse/handlers/HandleWither.java b/src/core/lombok/eclipse/handlers/HandleWither.java index 27fbc635..305e0a16 100644 --- a/src/core/lombok/eclipse/handlers/HandleWither.java +++ b/src/core/lombok/eclipse/handlers/HandleWither.java @@ -143,13 +143,13 @@ public class HandleWither extends EclipseAnnotationHandler { } } - private void createWitherForFields(AccessLevel level, Collection fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List onMethod, List onParam) { + public void createWitherForFields(AccessLevel level, Collection fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List onMethod, List onParam) { for (EclipseNode fieldNode : fieldNodes) { createWitherForField(level, fieldNode, errorNode, source, whineIfExists, onMethod, onParam); } } - private void createWitherForField( + public void createWitherForField( AccessLevel level, EclipseNode fieldNode, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List onMethod, List onParam) { @@ -207,7 +207,7 @@ public class HandleWither extends EclipseAnnotationHandler { injectMethod(fieldNode.up(), method); } - private MethodDeclaration createWither(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, ASTNode source, List onMethod, List onParam) { + public MethodDeclaration createWither(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, ASTNode source, List onMethod, List onParam) { if (name == null) return null; FieldDeclaration field = (FieldDeclaration) fieldNode.get(); int pS = source.sourceStart, pE = source.sourceEnd; diff --git a/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java b/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java index 954c948c..7217a396 100644 --- a/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java +++ b/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2011-2013 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.eclipse.handlers; import static lombok.eclipse.handlers.EclipseHandlerUtil.*; diff --git a/src/core/lombok/eclipse/handlers/package-info.java b/src/core/lombok/eclipse/handlers/package-info.java index 6372d62a..abca4665 100644 --- a/src/core/lombok/eclipse/handlers/package-info.java +++ b/src/core/lombok/eclipse/handlers/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 The Project Lombok Authors. + * Copyright (C) 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 @@ -22,5 +22,8 @@ /** * Contains the classes that implement the transformations for all of lombok's various features on the eclipse platform. + * + * 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.eclipse.handlers; diff --git a/src/core/lombok/eclipse/package-info.java b/src/core/lombok/eclipse/package-info.java index c7bc6a78..7b5172e1 100644 --- a/src/core/lombok/eclipse/package-info.java +++ b/src/core/lombok/eclipse/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 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 @@ -22,5 +22,8 @@ /** * Includes the eclipse-specific implementations of the lombok AST and annotation introspection support. + * + * 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.eclipse; diff --git a/src/core/lombok/experimental/package-info.java b/src/core/lombok/experimental/package-info.java new file mode 100644 index 00000000..776f2c27 --- /dev/null +++ b/src/core/lombok/experimental/package-info.java @@ -0,0 +1,33 @@ +/* + * 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 the annotations and support classes you need as a user of lombok, for + * all features which aren't (yet) supported as a first class feature. Features that involve the + * annotations and support classes in this package may change or may be removed entirely in future versions, + * and bugs may not be solved as expediently. For the status and likely future of any feature, refer + * to the official feature documentation. + * + * @see lombok + * @see Lombok features (experimental) + */ +package lombok.experimental; diff --git a/src/core/lombok/javac/apt/package-info.java b/src/core/lombok/javac/apt/package-info.java index 63be9638..aa9e7aac 100644 --- a/src/core/lombok/javac/apt/package-info.java +++ b/src/core/lombok/javac/apt/package-info.java @@ -22,5 +22,8 @@ /** * Contains the mechanism that instruments javac as an annotation processor. + * + * 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.javac.apt; diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java index e6e49337..1fc2941e 100644 --- a/src/core/lombok/javac/handlers/HandleBuilder.java +++ b/src/core/lombok/javac/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 @@ -218,7 +218,7 @@ public class HandleBuilder extends JavacAnnotationHandler { } } - private JCMethodDecl generateBuildMethod(String name, Name staticName, JCExpression returnType, java.util.List fieldNames, JavacNode type, List thrownExceptions) { + public JCMethodDecl generateBuildMethod(String name, Name staticName, JCExpression returnType, java.util.List fieldNames, JavacNode type, List thrownExceptions) { JavacTreeMaker maker = type.getTreeMaker(); JCExpression call; @@ -252,7 +252,7 @@ public class HandleBuilder extends JavacAnnotationHandler { return maker.MethodDef(maker.Modifiers(Flags.PUBLIC), type.toName(name), returnType, List.nil(), List.nil(), thrownExceptions, body, null); } - private JCMethodDecl generateBuilderMethod(String builderMethodName, String builderClassName, JavacNode type, List typeParams) { + public JCMethodDecl generateBuilderMethod(String builderMethodName, String builderClassName, JavacNode type, List typeParams) { JavacTreeMaker maker = type.getTreeMaker(); ListBuffer typeArgs = new ListBuffer(); @@ -267,7 +267,7 @@ public class HandleBuilder extends JavacAnnotationHandler { return maker.MethodDef(maker.Modifiers(Flags.STATIC | Flags.PUBLIC), type.toName(builderMethodName), namePlusTypeParamsToTypeReference(maker, type.toName(builderClassName), typeParams), copyTypeParams(maker, typeParams), List.nil(), List.nil(), body, null); } - private java.util.List addFieldsToBuilder(JavacNode builderType, java.util.List namesOfParameters, java.util.List typesOfParameters, JCTree source) { + public java.util.List addFieldsToBuilder(JavacNode builderType, java.util.List namesOfParameters, java.util.List typesOfParameters, JCTree source) { int len = namesOfParameters.size(); java.util.List existing = new ArrayList(); for (JavacNode child : builderType.down()) { @@ -297,7 +297,7 @@ public class HandleBuilder extends JavacAnnotationHandler { } - private JCMethodDecl makeSetterMethodForBuilder(JavacNode builderType, JavacNode fieldNode, JCTree source, boolean fluent, boolean chain) { + public JCMethodDecl makeSetterMethodForBuilder(JavacNode builderType, JavacNode fieldNode, JCTree source, boolean fluent, boolean chain) { Name fieldName = ((JCVariableDecl) fieldNode.get()).name; for (JavacNode child : builderType.down()) { @@ -313,7 +313,7 @@ public class HandleBuilder extends JavacAnnotationHandler { return HandleSetter.createSetter(Flags.PUBLIC, fieldNode, maker, setterName, chain, source, List.nil(), List.nil()); } - private JavacNode findInnerClass(JavacNode parent, String name) { + public JavacNode findInnerClass(JavacNode parent, String name) { for (JavacNode child : parent.down()) { if (child.getKind() != Kind.TYPE) continue; JCClassDecl td = (JCClassDecl) child.get(); @@ -322,7 +322,7 @@ public class HandleBuilder extends JavacAnnotationHandler { return null; } - private JavacNode makeBuilderClass(JavacNode tdParent, String builderClassName, List typeParams, JCAnnotation ast) { + public JavacNode makeBuilderClass(JavacNode tdParent, String builderClassName, List typeParams, JCAnnotation ast) { JavacTreeMaker maker = tdParent.getTreeMaker(); JCModifiers mods = maker.Modifiers(Flags.PUBLIC | Flags.STATIC); JCClassDecl builder = maker.ClassDef(mods, tdParent.toName(builderClassName), copyTypeParams(maker, typeParams), null, List.nil(), List.nil()); diff --git a/src/core/lombok/javac/handlers/HandleCleanup.java b/src/core/lombok/javac/handlers/HandleCleanup.java index 7aae6303..12e7227d 100644 --- a/src/core/lombok/javac/handlers/HandleCleanup.java +++ b/src/core/lombok/javac/handlers/HandleCleanup.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2012 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 @@ -141,7 +141,7 @@ public class HandleCleanup extends JavacAnnotationHandler { ancestor.rebuild(); } - private JCExpression preventNullAnalysis(JavacTreeMaker maker, JavacNode node, JCExpression expression) { + public JCExpression preventNullAnalysis(JavacTreeMaker maker, JavacNode node, JCExpression expression) { if (LombokOptionsFactory.getDelombokOptions(node.getContext()).getFormatPreferences().danceAroundIdeChecks()) { JCMethodInvocation singletonList = maker.Apply(List.nil(), chainDotsString(node, "java.util.Collections.singletonList"), List.of(expression)); JCMethodInvocation cleanedExpr = maker.Apply(List.nil(), maker.Select(singletonList, node.toName("get")) , List.of(maker.Literal(CTC_INT, 0))); @@ -151,11 +151,11 @@ public class HandleCleanup extends JavacAnnotationHandler { } } - private void doAssignmentCheck(JavacNode node, List statements, Name name) { + public void doAssignmentCheck(JavacNode node, List statements, Name name) { for (JCStatement statement : statements) doAssignmentCheck0(node, statement, name); } - private void doAssignmentCheck0(JavacNode node, JCTree statement, Name name) { + public void doAssignmentCheck0(JavacNode node, JCTree statement, Name name) { if (statement instanceof JCAssign) doAssignmentCheck0(node, ((JCAssign)statement).rhs, name); if (statement instanceof JCExpressionStatement) doAssignmentCheck0(node, ((JCExpressionStatement)statement).expr, name); diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java index adde3093..b8762ed8 100644 --- a/src/core/lombok/javac/handlers/HandleConstructor.java +++ b/src/core/lombok/javac/handlers/HandleConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 The Project Lombok Authors. + * Copyright (C) 2010-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 @@ -91,7 +91,7 @@ public class HandleConstructor { } } - private static List findRequiredFields(JavacNode typeNode) { + public static List findRequiredFields(JavacNode typeNode) { ListBuffer fields = new ListBuffer(); for (JavacNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; @@ -126,7 +126,7 @@ public class HandleConstructor { } } - static List findAllFields(JavacNode typeNode) { + public static List findAllFields(JavacNode typeNode) { ListBuffer fields = new ListBuffer(); for (JavacNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; @@ -143,7 +143,7 @@ public class HandleConstructor { return fields.toList(); } - static boolean checkLegality(JavacNode typeNode, JavacNode errorNode, String name) { + public static boolean checkLegality(JavacNode typeNode, JavacNode errorNode, String name) { JCClassDecl typeDecl = null; if (typeNode.get() instanceof JCClassDecl) typeDecl = (JCClassDecl) typeNode.get(); long modifiers = typeDecl == null ? 0 : typeDecl.mods.flags; @@ -206,7 +206,7 @@ public class HandleConstructor { } } - private static void addConstructorProperties(JCModifiers mods, JavacNode node, List fields) { + public static void addConstructorProperties(JCModifiers mods, JavacNode node, List fields) { if (fields.isEmpty()) return; JavacTreeMaker maker = node.getTreeMaker(); JCExpression constructorPropertiesType = chainDots(node, "java", "beans", "ConstructorProperties"); @@ -220,7 +220,7 @@ public class HandleConstructor { mods.annotations = mods.annotations.append(annotation); } - static JCMethodDecl createConstructor(AccessLevel level, List onConstructor, JavacNode typeNode, List fields, boolean suppressConstructorProperties, JCTree source) { + public static JCMethodDecl createConstructor(AccessLevel level, List onConstructor, JavacNode typeNode, List fields, boolean suppressConstructorProperties, JCTree source) { JavacTreeMaker maker = typeNode.getTreeMaker(); boolean isEnum = (((JCClassDecl) typeNode.get()).mods.flags & Flags.ENUM) != 0; @@ -259,14 +259,14 @@ public class HandleConstructor { null, List.nil(), params.toList(), List.nil(), maker.Block(0L, nullChecks.appendList(assigns).toList()), null), source, typeNode.getContext()); } - private static boolean isLocalType(JavacNode type) { + public static boolean isLocalType(JavacNode type) { Kind kind = type.up().getKind(); if (kind == Kind.COMPILATION_UNIT) return false; if (kind == Kind.TYPE) return isLocalType(type.up()); return true; } - private JCMethodDecl createStaticConstructor(String name, AccessLevel level, JavacNode typeNode, List fields, JCTree source) { + public JCMethodDecl createStaticConstructor(String name, AccessLevel level, JavacNode typeNode, List fields, JCTree source) { JavacTreeMaker maker = typeNode.getTreeMaker(); JCClassDecl type = (JCClassDecl) typeNode.get(); diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java index 89ab97e4..c9da4738 100644 --- a/src/core/lombok/javac/handlers/HandleDelegate.java +++ b/src/core/lombok/javac/handlers/HandleDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2012 The Project Lombok Authors. + * Copyright (C) 2010-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 @@ -190,7 +190,7 @@ public class HandleDelegate extends JavacAnnotationHandler { for (MethodSig sig : signaturesToDelegate) generateAndAdd(sig, annotationNode, delegateName, delegateReceiver); } - private void generateAndAdd(MethodSig sig, JavacNode annotation, Name delegateName, DelegateReceiver delegateReceiver) { + public void generateAndAdd(MethodSig sig, JavacNode annotation, Name delegateName, DelegateReceiver delegateReceiver) { List toAdd = new ArrayList(); try { toAdd.add(createDelegateMethod(sig, annotation, delegateName, delegateReceiver)); @@ -207,7 +207,7 @@ public class HandleDelegate extends JavacAnnotationHandler { } } - private static class CantMakeDelegates extends Exception { + public static class CantMakeDelegates extends Exception { Set conflicted; } @@ -218,7 +218,7 @@ public class HandleDelegate extends JavacAnnotationHandler { * * @throws CantMakeDelegates If there's a conflict. Conflict list is in ex.conflicted. */ - private void checkConflictOfTypeVarNames(MethodSig sig, JavacNode annotation) throws CantMakeDelegates { + public void checkConflictOfTypeVarNames(MethodSig sig, JavacNode annotation) throws CantMakeDelegates { // As first step, we check if there's a conflict between the delegate method's type vars and our own class. if (sig.elem.getTypeParameters().isEmpty()) return; @@ -258,7 +258,7 @@ public