aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/core/PostCompiler.java10
-rw-r--r--src/core/lombok/javac/JavacAST.java9
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java2
-rw-r--r--src/core9/module-info.java2
-rw-r--r--src/utils/lombok/permit/Permit.java23
5 files changed, 36 insertions, 10 deletions
diff --git a/src/core/lombok/core/PostCompiler.java b/src/core/lombok/core/PostCompiler.java
index 72f4b3a2..122bb268 100644
--- a/src/core/lombok/core/PostCompiler.java
+++ b/src/core/lombok/core/PostCompiler.java
@@ -28,6 +28,7 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
public final class PostCompiler {
private PostCompiler() {/* prevent instantiation*/};
@@ -67,8 +68,17 @@ public final class PostCompiler {
public static OutputStream wrapOutputStream(final OutputStream originalStream, final String fileName, final DiagnosticsReceiver diagnostics) throws IOException {
if (System.getProperty("lombok.disablePostCompiler", null) != null) return originalStream;
+
+ // close() can be called more than once and should be idempotent, therefore, ensure we never transform more than once.
+ final AtomicBoolean closed = new AtomicBoolean();
+
return new ByteArrayOutputStream() {
@Override public void close() throws IOException {
+ if (closed.getAndSet(true)) {
+ originalStream.close();
+ return;
+ }
+
// no need to call super
byte[] original = toByteArray();
byte[] copy = null;
diff --git a/src/core/lombok/javac/JavacAST.java b/src/core/lombok/javac/JavacAST.java
index b3e8930e..f58de60f 100644
--- a/src/core/lombok/javac/JavacAST.java
+++ b/src/core/lombok/javac/JavacAST.java
@@ -174,7 +174,14 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
if (sbtMappedVirtualFileRootsField == null) return null;
String encodedPath = (String) sbtMappedVirtualFilePathField.get(mappedVirtualFile);
- if (!encodedPath.startsWith("${")) return null;
+ if (!encodedPath.startsWith("${")) {
+ File maybeAbsoluteFile = new File(encodedPath);
+ if (maybeAbsoluteFile.exists()) {
+ return maybeAbsoluteFile.toURI();
+ } else {
+ return null;
+ }
+ }
int idx = encodedPath.indexOf('}');
if (idx == -1) return null;
String base = encodedPath.substring(2, idx);
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java
index 1c74ce37..40b59183 100644
--- a/src/core/lombok/javac/handlers/HandleBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleBuilder.java
@@ -371,7 +371,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
}
List<JCTypeParameter> tpOnMethod = jmd.typarams;
- List<JCTypeParameter> tpOnType = ((JCClassDecl) job.builderType.get()).typarams;
+ List<JCTypeParameter> tpOnType = ((JCClassDecl) job.parentType.get()).typarams;
typeArgsForToBuilder = new ArrayList<Name>();
for (JCTypeParameter tp : tpOnMethod) {
diff --git a/src/core9/module-info.java b/src/core9/module-info.java
index b1ee2b9d..8e8bd891 100644
--- a/src/core9/module-info.java
+++ b/src/core9/module-info.java
@@ -27,12 +27,12 @@ module lombok {
exports lombok;
exports lombok.experimental;
exports lombok.extern.apachecommons;
+ exports lombok.extern.flogger;
exports lombok.extern.jackson;
exports lombok.extern.java;
exports lombok.extern.jbosslog;
exports lombok.extern.log4j;
exports lombok.extern.slf4j;
- exports lombok.extern.flogger;
exports lombok.launch to lombok.mapstruct;
diff --git a/src/utils/lombok/permit/Permit.java b/src/utils/lombok/permit/Permit.java
index c0006559..5101e7b0 100644
--- a/src/utils/lombok/permit/Permit.java
+++ b/src/utils/lombok/permit/Permit.java
@@ -38,8 +38,6 @@ import com.sun.tools.javac.main.JavaCompiler;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.util.List;
-import lombok.Lombok;
-
// sunapi suppresses javac's warning about using Unsafe; 'all' suppresses eclipse's warning about the unspecified 'sunapi' key. Leave them both.
// Yes, javac's definition of the word 'all' is quite contrary to what the dictionary says it means. 'all' does NOT include 'sunapi' according to javac.
@SuppressWarnings({"sunapi", "all"})
@@ -223,9 +221,9 @@ public class Permit {
return null;
} catch (IllegalAccessException e) {
handleReflectionDebug(e, initError);
- throw Lombok.sneakyThrow(e);
+ throw sneakyThrow(e);
} catch (InvocationTargetException e) {
- throw Lombok.sneakyThrow(e.getCause());
+ throw sneakyThrow(e.getCause());
} catch (RuntimeException e) {
handleReflectionDebug(e, initError);
throw e;
@@ -276,12 +274,12 @@ public class Permit {
return null;
} catch (IllegalAccessException e) {
handleReflectionDebug(e, initError);
- throw Lombok.sneakyThrow(e);
+ throw sneakyThrow(e);
} catch (InstantiationException e) {
handleReflectionDebug(e, initError);
- throw Lombok.sneakyThrow(e);
+ throw sneakyThrow(e);
} catch (InvocationTargetException e) {
- throw Lombok.sneakyThrow(e.getCause());
+ throw sneakyThrow(e.getCause());
} catch (RuntimeException e) {
handleReflectionDebug(e, initError);
throw e;
@@ -329,4 +327,15 @@ public class Permit {
initError.printStackTrace(System.err);
}
}
+
+ public static RuntimeException sneakyThrow(Throwable t) {
+ if (t == null) throw new NullPointerException("t");
+ return Permit.<RuntimeException>sneakyThrow0(t);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T extends Throwable> T sneakyThrow0(Throwable t) throws T {
+ throw (T)t;
+ }
+
}