mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 08:15:48 +00:00
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.
This commit is contained in:
1 parent
69d82faa74
commit
09ea02e4f5
42 files changed
+402
-154
No files matched your search
@@ -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.
|
||||
*
|
||||
* <strong>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.</strong>
|
||||
*/
|
||||
package lombok.bytecode;
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
* <strong>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.</strong>
|
||||
*/
|
||||
package lombok.core.debug;
|
||||
@@ -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.
|
||||
*
|
||||
* <strong>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.</strong>
|
||||
*/
|
||||
package lombok.core.handlers;
|
||||
@@ -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.
|
||||
*
|
||||
* <strong>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.</strong>
|
||||
*/
|
||||
package lombok.core;
|
||||
@@ -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;
|
||||
@@ -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<Annotation> unboxAndRemoveAnnotationParameter(Annotation annotation, String annotationName, String errorName, EclipseNode errorNode) {
|
||||
public static List<Annotation> 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;
|
||||
|
||||
|
||||
@@ -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<Builder> {
|
||||
}
|
||||
}
|
||||
|
||||
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<Builder> {
|
||||
return out;
|
||||
}
|
||||
|
||||
private MethodDeclaration generateBuildMethod(String name, char[] staticName, TypeReference returnType, List<char[]> fieldNames, EclipseNode type, ASTNode source, TypeReference[] thrownExceptions) {
|
||||
public MethodDeclaration generateBuildMethod(String name, char[] staticName, TypeReference returnType, List<char[]> 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<Builder> {
|
||||
return out;
|
||||
}
|
||||
|
||||
private List<EclipseNode> addFieldsToBuilder(EclipseNode builderType, List<char[]> namesOfParameters, List<TypeReference> typesOfParameters, ASTNode source) {
|
||||
public List<EclipseNode> addFieldsToBuilder(EclipseNode builderType, List<char[]> namesOfParameters, List<TypeReference> 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<Builder> {
|
||||
|
||||
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<Builder> {
|
||||
source, Collections.<Annotation>emptyList(), Collections.<Annotation>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<Builder> {
|
||||
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;
|
||||
|
||||
@@ -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<Cleanup> {
|
||||
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<Cleanup> {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<EclipseNode> fields) {
|
||||
public static Annotation[] createConstructorProperties(ASTNode source, Collection<EclipseNode> 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<EclipseNode> fields,
|
||||
boolean suppressConstructorProperties, ASTNode source, List<Annotation> 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<EclipseNode> fields, ASTNode source) {
|
||||
public MethodDeclaration createStaticConstructor(AccessLevel level, String name, EclipseNode type, Collection<EclipseNode> fields, ASTNode source) {
|
||||
int pS = source.sourceStart, pE = source.sourceEnd;
|
||||
long p = (long)pS << 32 | pE;
|
||||
|
||||
|
||||
@@ -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<EqualsAndH
|
||||
private final char[] PRIME = "PRIME".toCharArray();
|
||||
private final char[] RESULT = "result".toCharArray();
|
||||
|
||||
private static final Set<String> BUILT_IN_TYPES = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
|
||||
public static final Set<String> BUILT_IN_TYPES = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
|
||||
"byte", "short", "int", "long", "char", "boolean", "double", "float")));
|
||||
|
||||
private void checkForBogusFieldNames(EclipseNode type, AnnotationValues<EqualsAndHashCode> annotation) {
|
||||
public void checkForBogusFieldNames(EclipseNode type, AnnotationValues<EqualsAndHashCode> 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<EqualsAndH
|
||||
injectMethod(typeNode, hashCodeMethod);
|
||||
}
|
||||
|
||||
private MethodDeclaration createHashCode(EclipseNode type, Collection<EclipseNode> fields, boolean callSuper, ASTNode source, FieldAccess fieldAccess) {
|
||||
public MethodDeclaration createHashCode(EclipseNode type, Collection<EclipseNode> 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<EqualsAndH
|
||||
return method;
|
||||
}
|
||||
|
||||
private LocalDeclaration createLocalDeclaration(ASTNode source, char[] dollarFieldName, TypeReference type, Expression initializer) {
|
||||
public LocalDeclaration createLocalDeclaration(ASTNode source, char[] dollarFieldName, TypeReference type, Expression initializer) {
|
||||
int pS = source.sourceStart, pE = source.sourceEnd;
|
||||
LocalDeclaration tempVar = new LocalDeclaration(dollarFieldName, pS, pE);
|
||||
setGeneratedBy(tempVar, source);
|
||||
@@ -415,7 +415,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
|
||||
return tempVar;
|
||||
}
|
||||
|
||||
private Expression createResultCalculation(ASTNode source, Expression ex) {
|
||||
public Expression createResultCalculation(ASTNode source, Expression ex) {
|
||||
/* result = result * PRIME + (ex); */
|
||||
int pS = source.sourceStart, pE = source.sourceEnd;
|
||||
long p = (long)pS << 32 | pE;
|
||||
@@ -437,7 +437,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
|
||||
return assignment;
|
||||
}
|
||||
|
||||
private TypeReference createTypeReference(EclipseNode type, long p) {
|
||||
public TypeReference createTypeReference(EclipseNode type, long p) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(type.getName());
|
||||
EclipseNode tNode = type.up();
|
||||
@@ -458,7 +458,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
|
||||
return new QualifiedTypeReference(tokens, ps);
|
||||
}
|
||||
|
||||
private MethodDeclaration createEquals(EclipseNode type, Collection<EclipseNode> fields, boolean callSuper, ASTNode source, FieldAccess fieldAccess, boolean needsCanEqual) {
|
||||
public MethodDeclaration createEquals(EclipseNode type, Collection<EclipseNode> 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<EqualsAndH
|
||||
}
|
||||
|
||||
|
||||
private MethodDeclaration createCanEqual(EclipseNode type, ASTNode source) {
|
||||
public MethodDeclaration createCanEqual(EclipseNode type, ASTNode source) {
|
||||
/* public boolean canEqual(final java.lang.Object other) {
|
||||
* return other instanceof Outer.Inner.MyType;
|
||||
* }
|
||||
@@ -765,7 +765,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
|
||||
}
|
||||
|
||||
|
||||
private IfStatement generateCompareFloatOrDouble(Expression thisRef, Expression otherRef, char[] floatOrDouble, ASTNode source) {
|
||||
public IfStatement generateCompareFloatOrDouble(Expression thisRef, Expression otherRef, char[] floatOrDouble, ASTNode source) {
|
||||
int pS = source.sourceStart, pE = source.sourceEnd;
|
||||
/* if (Float.compare(fieldName, other.fieldName) != 0) return false */
|
||||
MessageSend floatCompare = new MessageSend();
|
||||
@@ -788,7 +788,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
|
||||
}
|
||||
|
||||
/** Give 2 clones! */
|
||||
private Expression longToIntForHashCode(Expression ref1, Expression ref2, ASTNode source) {
|
||||
public Expression longToIntForHashCode(Expression ref1, Expression ref2, ASTNode source) {
|
||||
int pS = source.sourceStart, pE = source.sourceEnd;
|
||||
/* (int)(ref >>> 32 ^ ref) */
|
||||
IntLiteral int32 = makeIntLiteral("32".toCharArray(), source);
|
||||
@@ -804,7 +804,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
|
||||
return expr;
|
||||
}
|
||||
|
||||
private NameReference generateQualifiedNameRef(ASTNode source, char[]... varNames) {
|
||||
public NameReference generateQualifiedNameRef(ASTNode source, char[]... varNames) {
|
||||
int pS = source.sourceStart, pE = source.sourceEnd;
|
||||
long p = (long)pS << 32 | pE;
|
||||
|
||||
@@ -816,7 +816,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
|
||||
return ref;
|
||||
}
|
||||
|
||||
private TypeReference generateQualifiedTypeRef(ASTNode source, char[]... varNames) {
|
||||
public TypeReference generateQualifiedTypeRef(ASTNode source, char[]... varNames) {
|
||||
int pS = source.sourceStart, pE = source.sourceEnd;
|
||||
long p = (long)pS << 32 | pE;
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -161,13 +161,13 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
|
||||
}
|
||||
}
|
||||
|
||||
private void createGetterForFields(AccessLevel level, Collection<EclipseNode> fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, boolean lazy, List<Annotation> onMethod) {
|
||||
public void createGetterForFields(AccessLevel level, Collection<EclipseNode> fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, boolean lazy, List<Annotation> 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<Annotation> 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<Getter> {
|
||||
injectMethod(fieldNode.up(), method);
|
||||
}
|
||||
|
||||
private static Annotation[] findDelegatesAndMarkAsHandled(EclipseNode fieldNode) {
|
||||
public static Annotation[] findDelegatesAndMarkAsHandled(EclipseNode fieldNode) {
|
||||
List<Annotation> delegates = new ArrayList<Annotation>();
|
||||
for (EclipseNode child : fieldNode.down()) {
|
||||
if (annotationTypeMatches(Delegate.class, child)) {
|
||||
@@ -232,7 +232,7 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
|
||||
return delegates.toArray(EMPTY_ANNOTATIONS_ARRAY);
|
||||
}
|
||||
|
||||
private MethodDeclaration createGetter(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, ASTNode source, boolean lazy, List<Annotation> onMethod) {
|
||||
public MethodDeclaration createGetter(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, ASTNode source, boolean lazy, List<Annotation> onMethod) {
|
||||
FieldDeclaration field = (FieldDeclaration) fieldNode.get();
|
||||
|
||||
// Remember the type; lazy will change it;
|
||||
@@ -281,7 +281,7 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
|
||||
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<Getter> {
|
||||
|
||||
private static final char[][] AR = fromQualifiedName("java.util.concurrent.atomic.AtomicReference");
|
||||
|
||||
private static final java.util.Map<String, char[][]> TYPE_MAP;
|
||||
public static final java.util.Map<String, char[][]> TYPE_MAP;
|
||||
static {
|
||||
Map<String, char[][]> m = new HashMap<String, char[][]>();
|
||||
m.put("int", fromQualifiedName("java.lang.Integer"));
|
||||
@@ -309,7 +309,7 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
|
||||
|
||||
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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<NonNull> {
|
||||
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. */ {
|
||||
|
||||
@@ -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<Setter> {
|
||||
}
|
||||
}
|
||||
|
||||
private void createSetterForFields(AccessLevel level, Collection<EclipseNode> fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List<Annotation> onMethod, List<Annotation> onParam) {
|
||||
public void createSetterForFields(AccessLevel level, Collection<EclipseNode> fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List<Annotation> onMethod, List<Annotation> 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<Annotation> onMethod,
|
||||
List<Annotation> onParam) {
|
||||
|
||||
@@ -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<SneakyThrows> {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
private void handleMethod(EclipseNode annotation, AbstractMethodDeclaration method, List<DeclaredException> exceptions) {
|
||||
public void handleMethod(EclipseNode annotation, AbstractMethodDeclaration method, List<DeclaredException> exceptions) {
|
||||
if (method.isAbstract()) {
|
||||
annotation.addError("@SneakyThrows can only be used on concrete methods.");
|
||||
return;
|
||||
@@ -177,7 +177,7 @@ public class HandleSneakyThrows extends EclipseAnnotationHandler<SneakyThrows> {
|
||||
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);
|
||||
|
||||
@@ -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<Synchronized> {
|
||||
createLockField(annotation, annotationNode, method.isStatic(), false);
|
||||
}
|
||||
|
||||
private char[] createLockField(AnnotationValues<Synchronized> annotation, EclipseNode annotationNode, boolean isStatic, boolean reportErrors) {
|
||||
public char[] createLockField(AnnotationValues<Synchronized> annotation, EclipseNode annotationNode, boolean isStatic, boolean reportErrors) {
|
||||
char[] lockName = annotation.getInstance().value().toCharArray();
|
||||
Annotation source = (Annotation) annotationNode.get();
|
||||
boolean autoMake = false;
|
||||
|
||||
@@ -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<ToString> {
|
||||
private void checkForBogusFieldNames(EclipseNode type, AnnotationValues<ToString> annotation) {
|
||||
public void checkForBogusFieldNames(EclipseNode type, AnnotationValues<ToString> 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<ToString> {
|
||||
}
|
||||
}
|
||||
|
||||
static MethodDeclaration createToString(EclipseNode type, Collection<EclipseNode> fields,
|
||||
public static MethodDeclaration createToString(EclipseNode type, Collection<EclipseNode> 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<ToString> {
|
||||
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<ToString> {
|
||||
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<ToString> {
|
||||
private static final Set<String> BUILT_IN_TYPES = Collections.unmodifiableSet(new HashSet<String>(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;
|
||||
|
||||
@@ -143,13 +143,13 @@ public class HandleWither extends EclipseAnnotationHandler<Wither> {
|
||||
}
|
||||
}
|
||||
|
||||
private void createWitherForFields(AccessLevel level, Collection<EclipseNode> fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List<Annotation> onMethod, List<Annotation> onParam) {
|
||||
public void createWitherForFields(AccessLevel level, Collection<EclipseNode> fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists, List<Annotation> onMethod, List<Annotation> 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<Annotation> onMethod,
|
||||
List<Annotation> onParam) {
|
||||
@@ -207,7 +207,7 @@ public class HandleWither extends EclipseAnnotationHandler<Wither> {
|
||||
injectMethod(fieldNode.up(), method);
|
||||
}
|
||||
|
||||
private MethodDeclaration createWither(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, ASTNode source, List<Annotation> onMethod, List<Annotation> onParam) {
|
||||
public MethodDeclaration createWither(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, ASTNode source, List<Annotation> onMethod, List<Annotation> onParam) {
|
||||
if (name == null) return null;
|
||||
FieldDeclaration field = (FieldDeclaration) fieldNode.get();
|
||||
int pS = source.sourceStart, pE = source.sourceEnd;
|
||||
|
||||
@@ -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.*;
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
* <strong>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.</strong>
|
||||
*/
|
||||
package lombok.eclipse.handlers;
|
||||
@@ -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.
|
||||
*
|
||||
* <strong>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.</strong>
|
||||
*/
|
||||
package lombok.eclipse;
|
||||
@@ -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 <a href="http://projectlombok.org/features/experimental/index.html">Lombok features (experimental)</a>
|
||||
*/
|
||||
package lombok.experimental;
|
||||
@@ -22,5 +22,8 @@
|
||||
|
||||
/**
|
||||
* Contains the mechanism that instruments javac as an annotation processor.
|
||||
*
|
||||
* <strong>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.</strong>
|
||||
*/
|
||||
package lombok.javac.apt;
|
||||
@@ -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<Builder> {
|
||||
}
|
||||
}
|
||||
|
||||
private JCMethodDecl generateBuildMethod(String name, Name staticName, JCExpression returnType, java.util.List<Name> fieldNames, JavacNode type, List<JCExpression> thrownExceptions) {
|
||||
public JCMethodDecl generateBuildMethod(String name, Name staticName, JCExpression returnType, java.util.List<Name> fieldNames, JavacNode type, List<JCExpression> thrownExceptions) {
|
||||
JavacTreeMaker maker = type.getTreeMaker();
|
||||
|
||||
JCExpression call;
|
||||
@@ -252,7 +252,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
|
||||
return maker.MethodDef(maker.Modifiers(Flags.PUBLIC), type.toName(name), returnType, List.<JCTypeParameter>nil(), List.<JCVariableDecl>nil(), thrownExceptions, body, null);
|
||||
}
|
||||
|
||||
private JCMethodDecl generateBuilderMethod(String builderMethodName, String builderClassName, JavacNode type, List<JCTypeParameter> typeParams) {
|
||||
public JCMethodDecl generateBuilderMethod(String builderMethodName, String builderClassName, JavacNode type, List<JCTypeParameter> typeParams) {
|
||||
JavacTreeMaker maker = type.getTreeMaker();
|
||||
|
||||
ListBuffer<JCExpression> typeArgs = new ListBuffer<JCExpression>();
|
||||
@@ -267,7 +267,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
|
||||
return maker.MethodDef(maker.Modifiers(Flags.STATIC | Flags.PUBLIC), type.toName(builderMethodName), namePlusTypeParamsToTypeReference(maker, type.toName(builderClassName), typeParams), copyTypeParams(maker, typeParams), List.<JCVariableDecl>nil(), List.<JCExpression>nil(), body, null);
|
||||
}
|
||||
|
||||
private java.util.List<JavacNode> addFieldsToBuilder(JavacNode builderType, java.util.List<Name> namesOfParameters, java.util.List<JCExpression> typesOfParameters, JCTree source) {
|
||||
public java.util.List<JavacNode> addFieldsToBuilder(JavacNode builderType, java.util.List<Name> namesOfParameters, java.util.List<JCExpression> typesOfParameters, JCTree source) {
|
||||
int len = namesOfParameters.size();
|
||||
java.util.List<JavacNode> existing = new ArrayList<JavacNode>();
|
||||
for (JavacNode child : builderType.down()) {
|
||||
@@ -297,7 +297,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
|
||||
}
|
||||
|
||||
|
||||
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<Builder> {
|
||||
return HandleSetter.createSetter(Flags.PUBLIC, fieldNode, maker, setterName, chain, source, List.<JCAnnotation>nil(), List.<JCAnnotation>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<Builder> {
|
||||
return null;
|
||||
}
|
||||
|
||||
private JavacNode makeBuilderClass(JavacNode tdParent, String builderClassName, List<JCTypeParameter> typeParams, JCAnnotation ast) {
|
||||
public JavacNode makeBuilderClass(JavacNode tdParent, String builderClassName, List<JCTypeParameter> 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.<JCExpression>nil(), List.<JCTree>nil());
|
||||
|
||||
@@ -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<Cleanup> {
|
||||
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.<JCExpression>nil(), chainDotsString(node, "java.util.Collections.singletonList"), List.of(expression));
|
||||
JCMethodInvocation cleanedExpr = maker.Apply(List.<JCExpression>nil(), maker.Select(singletonList, node.toName("get")) , List.<JCExpression>of(maker.Literal(CTC_INT, 0)));
|
||||
@@ -151,11 +151,11 @@ public class HandleCleanup extends JavacAnnotationHandler<Cleanup> {
|
||||
}
|
||||
}
|
||||
|
||||
private void doAssignmentCheck(JavacNode node, List<JCStatement> statements, Name name) {
|
||||
public void doAssignmentCheck(JavacNode node, List<JCStatement> 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);
|
||||
|
||||
@@ -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<JavacNode> findRequiredFields(JavacNode typeNode) {
|
||||
public static List<JavacNode> findRequiredFields(JavacNode typeNode) {
|
||||
ListBuffer<JavacNode> fields = new ListBuffer<JavacNode>();
|
||||
for (JavacNode child : typeNode.down()) {
|
||||
if (child.getKind() != Kind.FIELD) continue;
|
||||
@@ -126,7 +126,7 @@ public class HandleConstructor {
|
||||
}
|
||||
}
|
||||
|
||||
static List<JavacNode> findAllFields(JavacNode typeNode) {
|
||||
public static List<JavacNode> findAllFields(JavacNode typeNode) {
|
||||
ListBuffer<JavacNode> fields = new ListBuffer<JavacNode>();
|
||||
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<JavacNode> fields) {
|
||||
public static void addConstructorProperties(JCModifiers mods, JavacNode node, List<JavacNode> 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<JCAnnotation> onConstructor, JavacNode typeNode, List<JavacNode> fields, boolean suppressConstructorProperties, JCTree source) {
|
||||
public static JCMethodDecl createConstructor(AccessLevel level, List<JCAnnotation> onConstructor, JavacNode typeNode, List<JavacNode> 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.<JCTypeParameter>nil(), params.toList(), List.<JCExpression>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<JavacNode> fields, JCTree source) {
|
||||
public JCMethodDecl createStaticConstructor(String name, AccessLevel level, JavacNode typeNode, List<JavacNode> fields, JCTree source) {
|
||||
JavacTreeMaker maker = typeNode.getTreeMaker();
|
||||
JCClassDecl type = (JCClassDecl) typeNode.get();
|
||||
|
||||
|
||||
@@ -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<Delegate> {
|
||||
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<JCMethodDecl> toAdd = new ArrayList<JCMethodDecl>();
|
||||
try {
|
||||
toAdd.add(createDelegateMethod(sig, annotation, delegateName, delegateReceiver));
|
||||
@@ -207,7 +207,7 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
|
||||
}
|
||||
}
|
||||
|
||||
private static class CantMakeDelegates extends Exception {
|
||||
public static class CantMakeDelegates extends Exception {
|
||||
Set<String> conflicted;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
|
||||
*
|
||||
* @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 class HandleDelegate extends JavacAnnotationHandler<Delegate> {
|
||||
}
|
||||
}
|
||||
|
||||
private JCMethodDecl createDelegateMethod(MethodSig sig, JavacNode annotation, Name delegateName, DelegateReceiver delegateReceiver) throws TypeNotConvertibleException, CantMakeDelegates {
|
||||
public JCMethodDecl createDelegateMethod(MethodSig sig, JavacNode annotation, Name delegateName, DelegateReceiver delegateReceiver) throws TypeNotConvertibleException, CantMakeDelegates {
|
||||
/* public <T, U, ...> ReturnType methodName(ParamType1 name1, ParamType2 name2, ...) throws T1, T2, ... {
|
||||
* (return) delegate.<T, U>methodName(name1, name2);
|
||||
* }
|
||||
@@ -320,11 +320,11 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
|
||||
return recursiveSetGeneratedBy(maker.MethodDef(mods, sig.name, returnType, toList(typeParams), toList(params), toList(thrown), bodyBlock, null), annotation.get(), annotation.getContext());
|
||||
}
|
||||
|
||||
private static <T> com.sun.tools.javac.util.List<T> toList(ListBuffer<T> collection) {
|
||||
public static <T> com.sun.tools.javac.util.List<T> toList(ListBuffer<T> collection) {
|
||||
return collection == null ? com.sun.tools.javac.util.List.<T>nil() : collection.toList();
|
||||
}
|
||||
|
||||
private void addMethodBindings(List<MethodSig> signatures, ClassType ct, JavacTypes types, Set<String> banList) {
|
||||
public void addMethodBindings(List<MethodSig> signatures, ClassType ct, JavacTypes types, Set<String> banList) {
|
||||
TypeSymbol tsym = ct.asElement();
|
||||
if (tsym == null) return;
|
||||
|
||||
@@ -347,7 +347,7 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
|
||||
}
|
||||
}
|
||||
|
||||
private static class MethodSig {
|
||||
public static class MethodSig {
|
||||
final Name name;
|
||||
final ExecutableType type;
|
||||
final boolean isDeprecated;
|
||||
@@ -374,7 +374,7 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
|
||||
}
|
||||
}
|
||||
|
||||
private static String printSig(ExecutableType method, Name name, JavacTypes types) {
|
||||
public static String printSig(ExecutableType method, Name name, JavacTypes types) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(name.toString()).append("(");
|
||||
boolean first = true;
|
||||
@@ -386,12 +386,12 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
|
||||
return sb.append(")").toString();
|
||||
}
|
||||
|
||||
private static String typeBindingToSignature(TypeMirror binding, JavacTypes types) {
|
||||
public static String typeBindingToSignature(TypeMirror binding, JavacTypes types) {
|
||||
binding = types.erasure(binding);
|
||||
return binding.toString();
|
||||
}
|
||||
|
||||
private enum DelegateReceiver {
|
||||
public enum DelegateReceiver {
|
||||
METHOD {
|
||||
public JCExpression get(final JavacNode node, final Name name) {
|
||||
com.sun.tools.javac.util.List<JCExpression> nilExprs = com.sun.tools.javac.util.List.nil();
|
||||
|
||||
@@ -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
|
||||
@@ -71,7 +71,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
|
||||
private static final String RESULT_NAME = "result";
|
||||
private static final String PRIME_NAME = "PRIME";
|
||||
|
||||
private void checkForBogusFieldNames(JavacNode type, AnnotationValues<EqualsAndHashCode> annotation) {
|
||||
public void checkForBogusFieldNames(JavacNode type, AnnotationValues<EqualsAndHashCode> annotation) {
|
||||
if (annotation.isExplicit("exclude")) {
|
||||
for (int i : createListOfNonExistentFields(List.from(annotation.getInstance().exclude()), type, true, true)) {
|
||||
annotation.setWarning("exclude", "This field does not exist, or would have been excluded anyway.", i);
|
||||
@@ -219,7 +219,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
|
||||
injectMethod(typeNode, hashCodeMethod);
|
||||
}
|
||||
|
||||
private JCMethodDecl createHashCode(JavacNode typeNode, List<JavacNode> fields, boolean callSuper, FieldAccess fieldAccess, JCTree source) {
|
||||
public JCMethodDecl createHashCode(JavacNode typeNode, List<JavacNode> fields, boolean callSuper, FieldAccess fieldAccess, JCTree source) {
|
||||
JavacTreeMaker maker = typeNode.getTreeMaker();
|
||||
|
||||
JCAnnotation overrideAnnotation = maker.Annotation(genJavaLangTypeRef(typeNode, "Override"), List.<JCExpression>nil());
|
||||
@@ -323,7 +323,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
|
||||
List.<JCTypeParameter>nil(), List.<JCVariableDecl>nil(), List.<JCExpression>nil(), body, null), source, typeNode.getContext());
|
||||
}
|
||||
|
||||
private JCExpressionStatement createResultCalculation(JavacNode typeNode, JCExpression expr) {
|
||||
public JCExpressionStatement createResultCalculation(JavacNode typeNode, JCExpression expr) {
|
||||
/* result = result * PRIME + (expr); */
|
||||
JavacTreeMaker maker = typeNode.getTreeMaker();
|
||||
Name resultName = typeNode.toName(RESULT_NAME);
|
||||
@@ -333,14 +333,14 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
|
||||
}
|
||||
|
||||
/** The 2 references must be clones of each other. */
|
||||
private JCExpression longToIntForHashCode(JavacTreeMaker maker, JCExpression ref1, JCExpression ref2) {
|
||||
public JCExpression longToIntForHashCode(JavacTreeMaker maker, JCExpression ref1, JCExpression ref2) {
|
||||
/* (int)(ref >>> 32 ^ ref) */
|
||||
JCExpression shift = maker.Binary(CTC_UNSIGNED_SHIFT_RIGHT, ref1, maker.Literal(32));
|
||||
JCExpression xorBits = maker.Binary(CTC_BITXOR, shift, ref2);
|
||||
return maker.TypeCast(maker.TypeIdent(CTC_INT), xorBits);
|
||||
}
|
||||
|
||||
private JCExpression createTypeReference(JavacNode type) {
|
||||
public JCExpression createTypeReference(JavacNode type) {
|
||||
java.util.List<String> list = new ArrayList<String>();
|
||||
list.add(type.getName());
|
||||
JavacNode tNode = type.up();
|
||||
@@ -360,7 +360,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
|
||||
return chain;
|
||||
}
|
||||
|
||||
private JCMethodDecl createEquals(JavacNode typeNode, List<JavacNode> fields, boolean callSuper, FieldAccess fieldAccess, boolean needsCanEqual, JCTree source) {
|
||||
public JCMethodDecl createEquals(JavacNode typeNode, List<JavacNode> fields, boolean callSuper, FieldAccess fieldAccess, boolean needsCanEqual, JCTree source) {
|
||||
JavacTreeMaker maker = typeNode.getTreeMaker();
|
||||
JCClassDecl type = (JCClassDecl) typeNode.get();
|
||||
|
||||
@@ -494,7 +494,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
|
||||
return recursiveSetGeneratedBy(maker.MethodDef(mods, typeNode.toName("equals"), returnType, List.<JCTypeParameter>nil(), params, List.<JCExpression>nil(), body, null), source, typeNode.getContext());
|
||||
}
|
||||
|
||||
private JCMethodDecl createCanEqual(JavacNode typeNode, JCTree source) {
|
||||
public JCMethodDecl createCanEqual(JavacNode typeNode, JCTree source) {
|
||||
/* public boolean canEqual(final java.lang.Object other) {
|
||||
* return other instanceof Outer.Inner.MyType;
|
||||
* }
|
||||
@@ -515,7 +515,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
|
||||
return recursiveSetGeneratedBy(maker.MethodDef(mods, canEqualName, returnType, List.<JCTypeParameter>nil(), params, List.<JCExpression>nil(), body, null), source, typeNode.getContext());
|
||||
}
|
||||
|
||||
private JCStatement generateCompareFloatOrDouble(JCExpression thisDotField, JCExpression otherDotField,
|
||||
public JCStatement generateCompareFloatOrDouble(JCExpression thisDotField, JCExpression otherDotField,
|
||||
JavacTreeMaker maker, JavacNode node, boolean isDouble) {
|
||||
/* if (Float.compare(fieldName, other.fieldName) != 0) return false; */
|
||||
JCExpression clazz = genJavaLangTypeRef(node, isDouble ? "Double" : "Float");
|
||||
@@ -525,7 +525,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
|
||||
return maker.If(compareCallEquals0, returnBool(maker, false), null);
|
||||
}
|
||||
|
||||
private JCStatement returnBool(JavacTreeMaker maker, boolean bool) {
|
||||
public JCStatement returnBool(JavacTreeMaker maker, boolean bool) {
|
||||
return maker.Return(maker.Literal(CTC_BOOLEAN, bool ? 1 : 0));
|
||||
}
|
||||
}
|
||||
@@ -87,9 +87,9 @@ public class HandleExtensionMethod extends JavacAnnotationHandler<ExtensionMetho
|
||||
|
||||
annotationNode.rebuild();
|
||||
}
|
||||
|
||||
|
||||
private List<Extension> getExtensions(final JavacNode typeNode, final List<Object> extensionProviders) {
|
||||
|
||||
|
||||
public List<Extension> getExtensions(final JavacNode typeNode, final List<Object> extensionProviders) {
|
||||
List<Extension> extensions = new ArrayList<Extension>();
|
||||
for (Object extensionProvider : extensionProviders) {
|
||||
if (!(extensionProvider instanceof JCFieldAccess)) continue;
|
||||
@@ -104,7 +104,7 @@ public class HandleExtensionMethod extends JavacAnnotationHandler<ExtensionMetho
|
||||
return extensions;
|
||||
}
|
||||
|
||||
private Extension getExtension(final JavacNode typeNode, final ClassType extensionMethodProviderType) {
|
||||
public Extension getExtension(final JavacNode typeNode, final ClassType extensionMethodProviderType) {
|
||||
List<MethodSymbol> extensionMethods = new ArrayList<MethodSymbol>();
|
||||
TypeSymbol tsym = extensionMethodProviderType.asElement();
|
||||
if (tsym != null) for (Symbol member : tsym.getEnclosedElements()) {
|
||||
|
||||
@@ -159,13 +159,13 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
|
||||
}
|
||||
}
|
||||
|
||||
private void createGetterForFields(AccessLevel level, Collection<JavacNode> fieldNodes, JavacNode errorNode, boolean whineIfExists, boolean lazy, List<JCAnnotation> onMethod) {
|
||||
public void createGetterForFields(AccessLevel level, Collection<JavacNode> fieldNodes, JavacNode errorNode, boolean whineIfExists, boolean lazy, List<JCAnnotation> onMethod) {
|
||||
for (JavacNode fieldNode : fieldNodes) {
|
||||
createGetterForField(level, fieldNode, errorNode, whineIfExists, lazy, onMethod);
|
||||
}
|
||||
}
|
||||
|
||||
private void createGetterForField(AccessLevel level,
|
||||
public void createGetterForField(AccessLevel level,
|
||||
JavacNode fieldNode, JavacNode source, boolean whineIfExists, boolean lazy, List<JCAnnotation> onMethod) {
|
||||
if (fieldNode.getKind() != Kind.FIELD) {
|
||||
source.addError("@Getter is only supported on a class or a field.");
|
||||
@@ -215,7 +215,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
|
||||
injectMethod(fieldNode.up(), createGetter(access, fieldNode, fieldNode.getTreeMaker(), source.get(), lazy, onMethod));
|
||||
}
|
||||
|
||||
private JCMethodDecl createGetter(long access, JavacNode field, JavacTreeMaker treeMaker, JCTree source, boolean lazy, List<JCAnnotation> onMethod) {
|
||||
public JCMethodDecl createGetter(long access, JavacNode field, JavacTreeMaker treeMaker, JCTree source, boolean lazy, List<JCAnnotation> onMethod) {
|
||||
JCVariableDecl fieldNode = (JCVariableDecl) field.get();
|
||||
|
||||
// Remember the type; lazy will change it
|
||||
@@ -259,7 +259,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
|
||||
return decl;
|
||||
}
|
||||
|
||||
private static List<JCAnnotation> findDelegatesAndRemoveFromField(JavacNode field) {
|
||||
public static List<JCAnnotation> findDelegatesAndRemoveFromField(JavacNode field) {
|
||||
JCVariableDecl fieldNode = (JCVariableDecl) field.get();
|
||||
|
||||
List<JCAnnotation> delegates = List.nil();
|
||||
@@ -282,14 +282,14 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
|
||||
return delegates;
|
||||
}
|
||||
|
||||
private List<JCStatement> createSimpleGetterBody(JavacTreeMaker treeMaker, JavacNode field) {
|
||||
public List<JCStatement> createSimpleGetterBody(JavacTreeMaker treeMaker, JavacNode field) {
|
||||
return List.<JCStatement>of(treeMaker.Return(createFieldAccessor(treeMaker, field, FieldAccess.ALWAYS_FIELD)));
|
||||
}
|
||||
|
||||
private static final String AR = "java.util.concurrent.atomic.AtomicReference";
|
||||
private static final List<JCExpression> NIL_EXPRESSION = List.nil();
|
||||
|
||||
private static final java.util.Map<TypeTag, String> TYPE_MAP;
|
||||
public static final java.util.Map<TypeTag, String> TYPE_MAP;
|
||||
static {
|
||||
Map<TypeTag, String> m = new HashMap<TypeTag, String>();
|
||||
m.put(CTC_INT, "Integer");
|
||||
@@ -303,7 +303,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
|
||||
TYPE_MAP = Collections.unmodifiableMap(m);
|
||||
}
|
||||
|
||||
private List<JCStatement> createLazyGetterBody(JavacTreeMaker maker, JavacNode fieldNode, JCTree source) {
|
||||
public List<JCStatement> createLazyGetterBody(JavacTreeMaker maker, JavacNode fieldNode, JCTree source) {
|
||||
/*
|
||||
java.lang.Object value = this.fieldName.get();
|
||||
if (value == null) {
|
||||
@@ -423,17 +423,17 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
|
||||
return statements.toList();
|
||||
}
|
||||
|
||||
private JCMethodInvocation callGet(JavacNode source, JCExpression receiver) {
|
||||
public JCMethodInvocation callGet(JavacNode source, JCExpression receiver) {
|
||||
JavacTreeMaker maker = source.getTreeMaker();
|
||||
return maker.Apply(NIL_EXPRESSION, maker.Select(receiver, source.toName("get")), NIL_EXPRESSION);
|
||||
}
|
||||
|
||||
private JCStatement callSet(JavacNode source, JCExpression receiver, JCExpression value) {
|
||||
public JCStatement callSet(JavacNode source, JCExpression receiver, JCExpression value) {
|
||||
JavacTreeMaker maker = source.getTreeMaker();
|
||||
return maker.Exec(maker.Apply(NIL_EXPRESSION, maker.Select(receiver, source.toName("set")), List.<JCExpression>of(value)));
|
||||
}
|
||||
|
||||
private JCExpression copyType(JavacTreeMaker treeMaker, JCVariableDecl fieldNode) {
|
||||
public JCExpression copyType(JavacTreeMaker treeMaker, JCVariableDecl fieldNode) {
|
||||
return fieldNode.type != null ? treeMaker.Type(fieldNode.type) : fieldNode.vartype;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -73,13 +73,13 @@ public class HandleLog {
|
||||
}
|
||||
}
|
||||
|
||||
private static JCFieldAccess selfType(JavacNode typeNode) {
|
||||
public static JCFieldAccess selfType(JavacNode typeNode) {
|
||||
JavacTreeMaker maker = typeNode.getTreeMaker();
|
||||
Name name = ((JCClassDecl) typeNode.get()).name;
|
||||
return maker.Select(maker.Ident(name), typeNode.toName("class"));
|
||||
}
|
||||
|
||||
private static boolean createField(LoggingFramework framework, JavacNode typeNode, JCFieldAccess loggingType, JCTree source) {
|
||||
public static boolean createField(LoggingFramework framework, JavacNode typeNode, JCFieldAccess loggingType, JCTree source) {
|
||||
JavacTreeMaker maker = typeNode.getTreeMaker();
|
||||
|
||||
// private static final <loggerType> log = <factoryMethod>(<parameter>);
|
||||
|
||||
@@ -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
|
||||
@@ -141,7 +141,7 @@ public class HandleNonNull extends JavacAnnotationHandler<NonNull> {
|
||||
declaration.body.stats = newList;
|
||||
}
|
||||
|
||||
private boolean isNullCheck(JCStatement stat) {
|
||||
public boolean isNullCheck(JCStatement stat) {
|
||||
return returnVarNameIfNullCheck(stat) != null;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class HandleNonNull extends JavacAnnotationHandler<NonNull> {
|
||||
* where the block braces are optional. If it is of this form, returns "x".
|
||||
* If it is not of this form, returns null.
|
||||
*/
|
||||
private String returnVarNameIfNullCheck(JCStatement stat) {
|
||||
public String returnVarNameIfNullCheck(JCStatement stat) {
|
||||
if (!(stat instanceof JCIf)) return null;
|
||||
|
||||
/* Check that the if's statement is a throw statement, possibly in a block. */ {
|
||||
|
||||
@@ -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 JavacAnnotationHandler<Setter> {
|
||||
}
|
||||
}
|
||||
|
||||
private void createSetterForFields(AccessLevel level, Collection<JavacNode> fieldNodes, JavacNode errorNode, boolean whineIfExists, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
public void createSetterForFields(AccessLevel level, Collection<JavacNode> fieldNodes, JavacNode errorNode, boolean whineIfExists, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
for (JavacNode fieldNode : fieldNodes) {
|
||||
createSetterForField(level, fieldNode, errorNode, whineIfExists, onMethod, onParam);
|
||||
}
|
||||
}
|
||||
|
||||
private void createSetterForField(AccessLevel level, JavacNode fieldNode, JavacNode source, boolean whineIfExists, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
public void createSetterForField(AccessLevel level, JavacNode fieldNode, JavacNode source, boolean whineIfExists, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
if (fieldNode.getKind() != Kind.FIELD) {
|
||||
fieldNode.addError("@Setter is only supported on a class or a field.");
|
||||
return;
|
||||
@@ -190,13 +190,13 @@ public class HandleSetter extends JavacAnnotationHandler<Setter> {
|
||||
injectMethod(fieldNode.up(), createdSetter);
|
||||
}
|
||||
|
||||
static JCMethodDecl createSetter(long access, JavacNode field, JavacTreeMaker treeMaker, JCTree source, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
public static JCMethodDecl createSetter(long access, JavacNode field, JavacTreeMaker treeMaker, JCTree source, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
String setterName = toSetterName(field);
|
||||
boolean returnThis = shouldReturnThis(field);
|
||||
return createSetter(access, field, treeMaker, setterName, returnThis, source, onMethod, onParam);
|
||||
}
|
||||
|
||||
static JCMethodDecl createSetter(long access, JavacNode field, JavacTreeMaker treeMaker, String setterName, boolean shouldReturnThis, JCTree source, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
public static JCMethodDecl createSetter(long access, JavacNode field, JavacTreeMaker treeMaker, String setterName, boolean shouldReturnThis, JCTree source, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
if (setterName == null) return null;
|
||||
|
||||
JCVariableDecl fieldDecl = (JCVariableDecl) field.get();
|
||||
|
||||
@@ -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
|
||||
@@ -77,7 +77,7 @@ public class HandleSneakyThrows extends JavacAnnotationHandler<SneakyThrows> {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleMethod(JavacNode annotation, JCMethodDecl method, Collection<String> exceptions) {
|
||||
public void handleMethod(JavacNode annotation, JCMethodDecl method, Collection<String> exceptions) {
|
||||
JavacNode methodNode = annotation.up();
|
||||
|
||||
if ( (method.mods.flags & Flags.ABSTRACT) != 0) {
|
||||
@@ -107,15 +107,15 @@ public class HandleSneakyThrows extends JavacAnnotationHandler<SneakyThrows> {
|
||||
methodNode.rebuild();
|
||||
}
|
||||
|
||||
private void generateEmptyBlockWarning(JavacNode methodNode, JavacNode annotation, boolean hasConstructorCall) {
|
||||
public void generateEmptyBlockWarning(JavacNode methodNode, JavacNode annotation, boolean hasConstructorCall) {
|
||||
if (hasConstructorCall) {
|
||||
annotation.addWarning("Calls to sibling / super constructors are always excluded from @SneakyThrows; @SneakyThrows has been ignored because there is no other code in this constructor.");
|
||||
} else {
|
||||
annotation.addWarning("This method or constructor is empty; @SneakyThrows has been ignored.");
|
||||
}
|
||||
}
|
||||
|
||||
private JCStatement buildTryCatchBlock(JavacNode node, List<JCStatement> contents, String exception, JCTree source) {
|
||||
|
||||
public JCStatement buildTryCatchBlock(JavacNode node, List<JCStatement> contents, String exception, JCTree source) {
|
||||
JavacTreeMaker maker = node.getTreeMaker();
|
||||
|
||||
Context context = node.getContext();
|
||||
|
||||
@@ -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
|
||||
@@ -57,7 +57,7 @@ import com.sun.tools.javac.util.ListBuffer;
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleToString extends JavacAnnotationHandler<ToString> {
|
||||
private void checkForBogusFieldNames(JavacNode type, AnnotationValues<ToString> annotation) {
|
||||
public void checkForBogusFieldNames(JavacNode type, AnnotationValues<ToString> annotation) {
|
||||
if (annotation.isExplicit("exclude")) {
|
||||
for (int i : createListOfNonExistentFields(List.from(annotation.getInstance().exclude()), type, true, false)) {
|
||||
annotation.setWarning("exclude", "This field does not exist, or would have been excluded anyway.", i);
|
||||
@@ -243,7 +243,7 @@ public class HandleToString extends JavacAnnotationHandler<ToString> {
|
||||
List.<JCTypeParameter>nil(), List.<JCVariableDecl>nil(), List.<JCExpression>nil(), body, null), source, typeNode.getContext());
|
||||
}
|
||||
|
||||
private static String getTypeName(JavacNode typeNode) {
|
||||
public static String getTypeName(JavacNode typeNode) {
|
||||
String typeName = ((JCClassDecl) typeNode.get()).name.toString();
|
||||
JavacNode upType = typeNode.up();
|
||||
while (upType.getKind() == Kind.TYPE) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2013 The Project Lombok Authors.
|
||||
* 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
|
||||
@@ -142,13 +142,13 @@ public class HandleWither extends JavacAnnotationHandler<Wither> {
|
||||
}
|
||||
}
|
||||
|
||||
private void createWitherForFields(AccessLevel level, Collection<JavacNode> fieldNodes, JavacNode errorNode, boolean whineIfExists, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
public void createWitherForFields(AccessLevel level, Collection<JavacNode> fieldNodes, JavacNode errorNode, boolean whineIfExists, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
for (JavacNode fieldNode : fieldNodes) {
|
||||
createWitherForField(level, fieldNode, errorNode, whineIfExists, onMethod, onParam);
|
||||
}
|
||||
}
|
||||
|
||||
private void createWitherForField(AccessLevel level, JavacNode fieldNode, JavacNode source, boolean whineIfExists, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
public void createWitherForField(AccessLevel level, JavacNode fieldNode, JavacNode source, boolean whineIfExists, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
if (fieldNode.getKind() != Kind.FIELD) {
|
||||
fieldNode.addError("@Wither is only supported on a class or a field.");
|
||||
return;
|
||||
@@ -201,7 +201,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> {
|
||||
injectMethod(fieldNode.up(), createdWither);
|
||||
}
|
||||
|
||||
private JCMethodDecl createWither(long access, JavacNode field, JavacTreeMaker maker, JCTree source, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
public JCMethodDecl createWither(long access, JavacNode field, JavacTreeMaker maker, JCTree source, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
|
||||
String witherName = toWitherName(field);
|
||||
if (witherName == null) return null;
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -841,7 +841,7 @@ public class JavacHandlerUtil {
|
||||
return typeNode.add(field, Kind.FIELD);
|
||||
}
|
||||
|
||||
private static boolean isEnumConstant(final JCVariableDecl field) {
|
||||
public static boolean isEnumConstant(final JCVariableDecl field) {
|
||||
return (field.mods.flags & Flags.ENUM) != 0;
|
||||
}
|
||||
|
||||
@@ -916,7 +916,7 @@ public class JavacHandlerUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addSuppressWarningsAll(JCModifiers mods, JavacNode node, int pos, JCTree source, Context context) {
|
||||
public 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();
|
||||
@@ -1203,7 +1203,7 @@ public class JavacHandlerUtil {
|
||||
return isClassAndDoesNotHaveFlags(typeNode, Flags.INTERFACE | Flags.ANNOTATION);
|
||||
}
|
||||
|
||||
private static boolean isClassAndDoesNotHaveFlags(JavacNode typeNode, int flags) {
|
||||
public static boolean isClassAndDoesNotHaveFlags(JavacNode typeNode, int flags) {
|
||||
JCClassDecl typeDecl = null;
|
||||
if (typeNode.get() instanceof JCClassDecl) typeDecl = (JCClassDecl)typeNode.get();
|
||||
else return false;
|
||||
@@ -1288,13 +1288,13 @@ public class JavacHandlerUtil {
|
||||
|
||||
private static final Pattern SECTION_FINDER = Pattern.compile("^\\s*\\**\\s*[-*][-*]+\\s*([GS]ETTER|WITHER)\\s*[-*][-*]+\\s*\\**\\s*$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
||||
|
||||
private static String stripLinesWithTagFromJavadoc(String javadoc, String regexpFragment) {
|
||||
public static String stripLinesWithTagFromJavadoc(String javadoc, String regexpFragment) {
|
||||
Pattern p = Pattern.compile("^\\s*\\**\\s*" + regexpFragment + "\\s*\\**\\s*$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
||||
Matcher m = p.matcher(javadoc);
|
||||
return m.replaceAll("");
|
||||
}
|
||||
|
||||
private static String[] splitJavadocOnSectionIfPresent(String javadoc, String sectionName) {
|
||||
public static String[] splitJavadocOnSectionIfPresent(String javadoc, String sectionName) {
|
||||
Matcher m = SECTION_FINDER.matcher(javadoc);
|
||||
int getterSectionHeaderStart = -1;
|
||||
int getterSectionStart = -1;
|
||||
|
||||
@@ -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 @@
|
||||
|
||||
/**
|
||||
* Contains the classes that implement the transformations for all of lombok's various features on the javac v1.6 platform.
|
||||
*
|
||||
* <strong>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.</strong>
|
||||
*/
|
||||
package lombok.javac.handlers;
|
||||
@@ -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
|
||||
@@ -21,6 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Includes the javac v1.6-specific implementations of the lombok AST and annotation introspection support.
|
||||
* Includes the javac specific implementations of the lombok AST and annotation introspection support.
|
||||
*
|
||||
* <strong>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.</strong>
|
||||
*/
|
||||
package lombok.javac;
|
||||
@@ -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,6 +22,13 @@
|
||||
|
||||
/**
|
||||
* This package contains all the annotations and support classes you need as a user of lombok.
|
||||
* All other packages are only relevant to those who are extending lombok for their own uses.
|
||||
* All other packages are only relevant to those who are extending lombok for their own uses, except:
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code lombok.extern.*} – These packages contains lombok annotations that solve boilerplate issues for libraries not part of the JRE itself.
|
||||
* <li>{@code lombok.experimental} – This package contains lombok features that are new or likely to change before committing to long-term support.
|
||||
* </ul>
|
||||
*
|
||||
* @see <a href="http://projectlombok.org/features/index.html">Lombok features</a>
|
||||
*/
|
||||
package lombok;
|
||||
Reference in new issue
Block a user