aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-03-04 23:16:49 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-03-04 23:16:49 +0100
commitf956ba1e337699206052a016da65f4f02ac6825b (patch)
tree53b0c638275ebfa8a3d1133c1d389ef700460572 /src/core
parente5574133363c8b718329e07a73bf161416485da5 (diff)
parentfbab1ca77cb8306843e26c5bad91186b34563282 (diff)
downloadlombok-f956ba1e337699206052a016da65f4f02ac6825b.tar.gz
lombok-f956ba1e337699206052a016da65f4f02ac6825b.tar.bz2
lombok-f956ba1e337699206052a016da65f4f02ac6825b.zip
[configuration] Merge branch 'master' as we work on configuration.
* Conflict due to adding topic() feature to logger in master, and 'field name' feature in config branch. * master has since updated to shiny new eclipse dep versions and the 'ant eclipseForDebugging' feature, but this branch added deps. Addressed that. * Renamed 'loggerCategory' to 'loggerTopic'. I know, that wasn't exactly right to do in a merge, but, there you have it. * Test infrastructure changed in configuration branch, and tests had been added in master branch. Conflicts: build.xml buildScripts/ivy.xml src/core/lombok/eclipse/handlers/HandleLog.java src/core/lombok/extern/apachecommons/CommonsLog.java src/core/lombok/extern/java/Log.java src/core/lombok/extern/log4j/Log4j.java src/core/lombok/extern/log4j/Log4j2.java src/core/lombok/javac/handlers/HandleLog.java test/transform/resource/after-ecj/ValInTryWithResources.java
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/bytecode/package-info.java30
-rw-r--r--src/core/lombok/core/AnnotationProcessor.java4
-rw-r--r--src/core/lombok/core/PublicApiCreatorApp.java5
-rw-r--r--src/core/lombok/core/Version.java2
-rw-r--r--src/core/lombok/core/debug/DebugSnapshot.java22
-rw-r--r--src/core/lombok/core/debug/DebugSnapshotStore.java22
-rw-r--r--src/core/lombok/core/debug/package-info.java31
-rw-r--r--src/core/lombok/core/handlers/HandlerUtil.java12
-rw-r--r--src/core/lombok/core/handlers/package-info.java30
-rw-r--r--src/core/lombok/core/package-info.java3
-rw-r--r--src/core/lombok/core/runtimeDependencies/package-info.java34
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java35
-rw-r--r--src/core/lombok/eclipse/handlers/HandleBuilder.java12
-rw-r--r--src/core/lombok/eclipse/handlers/HandleCleanup.java4
-rw-r--r--src/core/lombok/eclipse/handlers/HandleConstructor.java8
-rw-r--r--src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java41
-rw-r--r--src/core/lombok/eclipse/handlers/HandleGetter.java14
-rw-r--r--src/core/lombok/eclipse/handlers/HandleLog.java36
-rw-r--r--src/core/lombok/eclipse/handlers/HandleNonNull.java6
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSetter.java4
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSneakyThrows.java4
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSynchronized.java2
-rw-r--r--src/core/lombok/eclipse/handlers/HandleToString.java10
-rw-r--r--src/core/lombok/eclipse/handlers/HandleVal.java4
-rw-r--r--src/core/lombok/eclipse/handlers/HandleWither.java6
-rw-r--r--src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java21
-rw-r--r--src/core/lombok/eclipse/handlers/package-info.java5
-rw-r--r--src/core/lombok/eclipse/package-info.java5
-rw-r--r--src/core/lombok/experimental/package-info.java33
-rw-r--r--src/core/lombok/extern/apachecommons/CommonsLog.java4
-rw-r--r--src/core/lombok/extern/java/Log.java4
-rw-r--r--src/core/lombok/extern/log4j/Log4j.java4
-rw-r--r--src/core/lombok/extern/log4j/Log4j2.java4
-rw-r--r--src/core/lombok/extern/slf4j/Slf4j.java7
-rw-r--r--src/core/lombok/extern/slf4j/XSlf4j.java4
-rw-r--r--src/core/lombok/javac/LombokOptions.java15
-rw-r--r--src/core/lombok/javac/apt/package-info.java3
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java12
-rw-r--r--src/core/lombok/javac/handlers/HandleCleanup.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleConstructor.java14
-rw-r--r--src/core/lombok/javac/handlers/HandleDelegate.java42
-rw-r--r--src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java28
-rw-r--r--src/core/lombok/javac/handlers/HandleExtensionMethod.java8
-rw-r--r--src/core/lombok/javac/handlers/HandleGetter.java22
-rw-r--r--src/core/lombok/javac/handlers/HandleLog.java47
-rw-r--r--src/core/lombok/javac/handlers/HandleNonNull.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleSetter.java10
-rw-r--r--src/core/lombok/javac/handlers/HandleSneakyThrows.java29
-rw-r--r--src/core/lombok/javac/handlers/HandleToString.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleWither.java8
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java38
-rw-r--r--src/core/lombok/javac/handlers/package-info.java5
-rw-r--r--src/core/lombok/javac/package-info.java7
-rw-r--r--src/core/lombok/package-info.java11
54 files changed, 569 insertions, 218 deletions
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.
+ *
+ * <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;
diff --git a/src/core/lombok/core/AnnotationProcessor.java b/src/core/lombok/core/AnnotationProcessor.java
index e9cf3891..734150cd 100644
--- a/src/core/lombok/core/AnnotationProcessor.java
+++ b/src/core/lombok/core/AnnotationProcessor.java
@@ -43,7 +43,7 @@ import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic.Kind;
-import lombok.patcher.inject.LiveInjector;
+import lombok.patcher.ClassRootFinder;
@SupportedAnnotationTypes("*")
public class AnnotationProcessor extends AbstractProcessor {
@@ -102,7 +102,7 @@ public class AnnotationProcessor extends AbstractProcessor {
if (environmentClassLoader != null && environmentClassLoader.getClass().getCanonicalName().equals("org.codehaus.plexus.compiler.javac.IsolatedClassLoader")) {
if (lombokAlreadyAddedTo.put(environmentClassLoader, true) == null) {
Method m = environmentClassLoader.getClass().getDeclaredMethod("addURL", URL.class);
- URL selfUrl = new File(LiveInjector.findPathJar(AnnotationProcessor.class)).toURI().toURL();
+ URL selfUrl = new File(ClassRootFinder.findClassRootOfClass(AnnotationProcessor.class)).toURI().toURL();
m.invoke(environmentClassLoader, selfUrl);
}
return environmentClassLoader;
diff --git a/src/core/lombok/core/PublicApiCreatorApp.java b/src/core/lombok/core/PublicApiCreatorApp.java
index 24bcf83d..178a45e8 100644
--- a/src/core/lombok/core/PublicApiCreatorApp.java
+++ b/src/core/lombok/core/PublicApiCreatorApp.java
@@ -35,8 +35,7 @@ import java.util.jar.JarOutputStream;
import java.util.zip.ZipEntry;
import lombok.Lombok;
-import lombok.installer.IdeFinder;
-import lombok.patcher.inject.LiveInjector;
+import lombok.patcher.ClassRootFinder;
import org.mangosdk.spi.ProviderFor;
@@ -80,7 +79,7 @@ public class PublicApiCreatorApp extends LombokApp {
* a jar that wasn't accessed via the file-system, or if its started via e.g. unpacking the jar.
*/
private static File findOurJar() {
- return new File(LiveInjector.findPathJar(IdeFinder.class));
+ return new File(ClassRootFinder.findClassRootOfClass(PublicApiCreatorApp.class));
}
private int writeApiJar(File outFile) throws Exception {
diff --git a/src/core/lombok/core/Version.java b/src/core/lombok/core/Version.java
index bf2e199b..6e68f035 100644
--- a/src/core/lombok/core/Version.java
+++ b/src/core/lombok/core/Version.java
@@ -28,7 +28,7 @@ public class Version {
// ** CAREFUL ** - this class must always compile with 0 dependencies (it must not refer to any other sources or libraries).
// Note: In 'X.Y.Z', if Z is odd, its a snapshot build built from the repository, so many different 0.10.3 versions can exist, for example.
// Official builds always end in an even number. (Since 0.10.2).
- private static final String VERSION = "1.12.3";
+ private static final String VERSION = "1.12.5";
private static final String RELEASE_NAME = "Edgy Guinea Pig";
// private static final String RELEASE_NAME = "Angry Butterfly";
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.
+ *
+ * <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; \ No newline at end of file
diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java
index ae651de1..fe2f3406 100644
--- a/src/core/lombok/core/handlers/HandlerUtil.java
+++ b/src/core/lombok/core/handlers/HandlerUtil.java
@@ -56,6 +56,18 @@ import lombok.experimental.Wither;
public class HandlerUtil {
private HandlerUtil() {}
+ public static int primeForHashcode() {
+ return 59;
+ }
+
+ public static int primeForTrue() {
+ return 79;
+ }
+
+ public static int primeForFalse() {
+ return 97;
+ }
+
/** Checks if the given name is a valid identifier.
*
* If it is, this returns {@code true} and does nothing else.
diff --git a/src/core/lombok/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.
+ *
+ * <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;
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.
+ *
+ * <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;
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 80c90b65..94fdffad 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
@@ -198,7 +198,7 @@ public class EclipseHandlerUtil {
private void msg(int msgType, String message, String bundleName, Throwable error) {
Bundle bundle = Platform.getBundle(bundleName);
if (bundle == null) {
- System.err.printf("Can't find bundle %s while trying to report error:\n%s\n", bundleName, message);
+ System.err.printf("Can't find bundle %s while trying to report error:\n%s\n%s\n", bundleName, message, error);
return;
}
@@ -436,21 +436,21 @@ public class EclipseHandlerUtil {
}
}
}
- TypeReference typeRef = new ParameterizedQualifiedTypeReference(iRef.tokens, args, iRef.dimensions(), iRef.sourcePositions);
+ TypeReference typeRef = new ParameterizedQualifiedTypeReference(iRef.tokens, args, iRef.dimensions(), copy(iRef.sourcePositions));
setGeneratedBy(typeRef, source);
return typeRef;
}
if (ref instanceof ArrayQualifiedTypeReference) {
ArrayQualifiedTypeReference iRef = (ArrayQualifiedTypeReference) ref;
- TypeReference typeRef = new ArrayQualifiedTypeReference(iRef.tokens, iRef.dimensions(), iRef.sourcePositions);
+ TypeReference typeRef = new ArrayQualifiedTypeReference(iRef.tokens, iRef.dimensions(), copy(iRef.sourcePositions));
setGeneratedBy(typeRef, source);
return typeRef;
}
if (ref instanceof QualifiedTypeReference) {
QualifiedTypeReference iRef = (QualifiedTypeReference) ref;
- TypeReference typeRef = new QualifiedTypeReference(iRef.tokens, iRef.sourcePositions);
+ TypeReference typeRef = new QualifiedTypeReference(iRef.tokens, copy(iRef.sourcePositions));
setGeneratedBy(typeRef, source);
return typeRef;
}
@@ -1322,7 +1322,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));
}
@@ -1390,6 +1390,19 @@ public class EclipseHandlerUtil {
private static final char[] ALL = "all".toCharArray();
public static Annotation[] createSuppressWarningsAll(ASTNode source, Annotation[] originalAnnotationArray) {
+ if (originalAnnotationArray != null) for (Annotation ann : originalAnnotationArray) {
+ char[] lastToken = null;
+
+ if (ann.type instanceof QualifiedTypeReference) {
+ char[][] t = ((QualifiedTypeReference) ann.type).tokens;
+ lastToken = t[t.length - 1];
+ } else if (ann.type instanceof SingleTypeReference) {
+ lastToken = ((SingleTypeReference) ann.type).token;
+ }
+
+ if (lastToken != null && new String(lastToken).equals("SuppressWarnings")) return originalAnnotationArray;
+ }
+
int pS = source.sourceStart, pE = source.sourceEnd;
long p = (long)pS << 32 | pE;
long[] poss = new long[3];
@@ -1508,7 +1521,7 @@ public class EclipseHandlerUtil {
} else if (castTo.getClass() == QualifiedTypeReference.class) {
QualifiedTypeReference qtr = (QualifiedTypeReference) castTo;
//Same here, but for the more complex types, they stay types.
- castToConverted = new QualifiedNameReference(qtr.tokens, qtr.sourcePositions, qtr.sourceStart, qtr.sourceEnd);
+ castToConverted = new QualifiedNameReference(qtr.tokens, copy(qtr.sourcePositions), qtr.sourceStart, qtr.sourceEnd);
castToConverted.bits = (castToConverted.bits & ~Binding.VARIABLE) | Binding.TYPE;
setGeneratedBy(castToConverted, source);
}
@@ -1601,7 +1614,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
@@ -1693,7 +1706,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;
@@ -1707,4 +1720,8 @@ public class EclipseHandlerUtil {
setGeneratedBy(nameReference, source);
return nameReference;
}
+
+ private static long[] copy(long[] array) {
+ return array == null ? null : array.clone();
+ }
}
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index fd7923b1..12b16934 100644
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -230,7 +230,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;
@@ -249,7 +249,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder&