aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2021-03-19 03:05:25 +0100
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2021-03-19 03:17:39 +0100
commit937a4dfca209d30e567a4c4fcbc9fe868221680a (patch)
treeb11cc26d2bb74f8ca59750cc904e344e5f5fa8f5
parent5241235b99286243d02463adc7f8b0fd3d9ab5b4 (diff)
downloadlombok-937a4dfca209d30e567a4c4fcbc9fe868221680a.tar.gz
lombok-937a4dfca209d30e567a4c4fcbc9fe868221680a.tar.bz2
lombok-937a4dfca209d30e567a4c4fcbc9fe868221680a.zip
[jdk16] fix delombok (and the test suite, which depends on it) for jdk16.
-rw-r--r--src/ant/lombok/ant/SimpleTestFormatter.java (renamed from src/support/lombok/ant/SimpleTestFormatter.java)0
-rw-r--r--src/core/lombok/javac/apt/LombokProcessor.java2
-rwxr-xr-xsrc/delombok/lombok/delombok/Delombok.java2
-rw-r--r--src/delombok/lombok/delombok/DelombokApp.java2
-rw-r--r--src/delombok/lombok/delombok/ant/DelombokTaskImpl.java5
-rw-r--r--test/core/src/lombok/RunTestsViaDelombok.java5
6 files changed, 15 insertions, 1 deletions
diff --git a/src/support/lombok/ant/SimpleTestFormatter.java b/src/ant/lombok/ant/SimpleTestFormatter.java
index a2a38420..a2a38420 100644
--- a/src/support/lombok/ant/SimpleTestFormatter.java
+++ b/src/ant/lombok/ant/SimpleTestFormatter.java
diff --git a/src/core/lombok/javac/apt/LombokProcessor.java b/src/core/lombok/javac/apt/LombokProcessor.java
index e9837cc9..6552f15b 100644
--- a/src/core/lombok/javac/apt/LombokProcessor.java
+++ b/src/core/lombok/javac/apt/LombokProcessor.java
@@ -480,7 +480,7 @@ public class LombokProcessor extends AbstractProcessor {
}
/** Useful from jdk9 and up; required from jdk16 and up. This code is supposed to gracefully do nothing on jdk8 and below, as this operation isn't needed there. */
- private static void addOpensForLombok() {
+ public static void addOpensForLombok() {
Class<?> cModule;
try {
cModule = Class.forName("java.lang.Module");
diff --git a/src/delombok/lombok/delombok/Delombok.java b/src/delombok/lombok/delombok/Delombok.java
index 6ab4d3e5..b210bab9 100755
--- a/src/delombok/lombok/delombok/Delombok.java
+++ b/src/delombok/lombok/delombok/Delombok.java
@@ -61,6 +61,7 @@ import lombok.Lombok;
import lombok.javac.CommentCatcher;
import lombok.javac.Javac;
import lombok.javac.LombokOptions;
+import lombok.javac.apt.LombokProcessor;
import lombok.permit.Permit;
import com.sun.tools.javac.code.Symtab;
@@ -314,6 +315,7 @@ public class Delombok {
}
}
+ LombokProcessor.addOpensForLombok();
delombok.delombok();
} catch (Exception e) {
if (!args.quiet) {
diff --git a/src/delombok/lombok/delombok/DelombokApp.java b/src/delombok/lombok/delombok/DelombokApp.java
index f5a5fc81..ef3bbd50 100644
--- a/src/delombok/lombok/delombok/DelombokApp.java
+++ b/src/delombok/lombok/delombok/DelombokApp.java
@@ -36,6 +36,7 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import lombok.core.LombokApp;
+import lombok.javac.apt.LombokProcessor;
import lombok.permit.Permit;
import lombok.spi.Provides;
@@ -173,6 +174,7 @@ public class DelombokApp extends LombokApp {
}
private void runDirectly(List<String> args) {
+ LombokProcessor.addOpensForLombok();
Delombok.main(args.toArray(new String[0]));
}
diff --git a/src/delombok/lombok/delombok/ant/DelombokTaskImpl.java b/src/delombok/lombok/delombok/ant/DelombokTaskImpl.java
index bd2f93e7..f2cd80e1 100644
--- a/src/delombok/lombok/delombok/ant/DelombokTaskImpl.java
+++ b/src/delombok/lombok/delombok/ant/DelombokTaskImpl.java
@@ -30,6 +30,7 @@ import java.util.List;
import lombok.delombok.Delombok;
import lombok.delombok.Delombok.InvalidFormatOptionException;
+import lombok.javac.apt.LombokProcessor;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Location;
@@ -46,6 +47,10 @@ public class DelombokTaskImpl {
private Path path;
private List<String> formatOptions = new ArrayList<String>();
+ static {
+ LombokProcessor.addOpensForLombok();
+ }
+
public void execute(Location location) throws BuildException {
if (fromDir == null && path == null) throw new BuildException("Either 'from' attribute, or nested <fileset> tags are required.");
if (fromDir != null && path != null) throw new BuildException("You can't specify both 'from' attribute and nested filesets. You need one or the other.");
diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java
index 13acdf55..08e3283f 100644
--- a/test/core/src/lombok/RunTestsViaDelombok.java
+++ b/test/core/src/lombok/RunTestsViaDelombok.java
@@ -62,10 +62,15 @@ import lombok.delombok.Delombok;
import lombok.javac.CapturingDiagnosticListener;
import lombok.javac.Javac;
import lombok.javac.CapturingDiagnosticListener.CompilerMessage;
+import lombok.javac.apt.LombokProcessor;
public class RunTestsViaDelombok extends AbstractRunTests {
private Delombok delombok = new Delombok();
+ static {
+ LombokProcessor.addOpensForLombok();
+ }
+
@Override
public boolean transformCode(Collection<CompilerMessage> messages, StringWriter result, final File file, String encoding, Map<String, String> formatPreferences, int version, boolean checkPositions) throws Throwable {
delombok.setVerbose(true);