aboutsummaryrefslogtreecommitdiff
path: root/src/delombok/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-11-01 15:01:33 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-11-01 15:01:33 +0100
commit21878e253e331f6ea340ae44bf824890185e1938 (patch)
tree856a9b0cffd243e0ac3c576262122b3d3b29d2d3 /src/delombok/lombok
parent6e7924f865e47973595458c6df0447975bbd0770 (diff)
downloadlombok-21878e253e331f6ea340ae44bf824890185e1938.tar.gz
lombok-21878e253e331f6ea340ae44bf824890185e1938.tar.bz2
lombok-21878e253e331f6ea340ae44bf824890185e1938.zip
[fixes #1932] We broke the delombok ant task.
Diffstat (limited to 'src/delombok/lombok')
-rw-r--r--src/delombok/lombok/delombok/ant/DelombokTask.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/delombok/lombok/delombok/ant/DelombokTask.java b/src/delombok/lombok/delombok/ant/DelombokTask.java
index 3828a5db..e09b8ed2 100644
--- a/src/delombok/lombok/delombok/ant/DelombokTask.java
+++ b/src/delombok/lombok/delombok/ant/DelombokTask.java
@@ -29,9 +29,6 @@ import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
-import lombok.Lombok;
-import lombok.permit.Permit;
-
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Location;
import org.apache.tools.ant.Task;
@@ -177,14 +174,16 @@ class Tasks {
} catch (ClassNotFoundException e) {
// If we get here, it isn't, and we should use the shadowloader.
Class<?> launcherMain = Class.forName("lombok.launch.Main");
- Method m = Permit.getMethod(launcherMain, "createShadowClassLoader");
+ Method m = launcherMain.getDeclaredMethod("getShadowClassLoader");
+ m.setAccessible(true);
shadowLoader = (ClassLoader) m.invoke(null);
}
}
return Class.forName(name, true, shadowLoader);
} catch (Exception e) {
- throw Lombok.sneakyThrow(e);
+ if (e instanceof RuntimeException) throw (RuntimeException) e;
+ throw new RuntimeException(e);
}
}
@@ -195,9 +194,9 @@ class Tasks {
try {
Object instance = shadowLoadClass("lombok.delombok.ant.DelombokTaskImpl").newInstance();
for (Field selfField : getClass().getDeclaredFields()) {
- Permit.setAccessible(selfField);
if (selfField.isSynthetic() || Modifier.isStatic(selfField.getModifiers())) continue;
- Field otherField = Permit.getField(instance.getClass(), selfField.getName());
+ Field otherField = instance.getClass().getDeclaredField(selfField.getName());
+ otherField.setAccessible(true);
if (selfField.getName().equals("formatOptions")) {
List<String> rep = new ArrayList<String>();
for (Format f : formatOptions) {
@@ -210,12 +209,13 @@ class Tasks {
}
}
- Method m = Permit.getMethod(instance.getClass(), "execute", Location.class);
+ Method m = instance.getClass().getMethod("execute", Location.class);
m.invoke(instance, loc);
- } catch (InvocationTargetException e) {
- throw Lombok.sneakyThrow(e.getCause());
} catch (Exception e) {
- throw Lombok.sneakyThrow(e);
+ Throwable t = (e instanceof InvocationTargetException) ? ((InvocationTargetException) e).getCause() : e;
+ if (t instanceof Error) throw (Error) t;
+ if (t instanceof RuntimeException) throw (RuntimeException) t;
+ throw new RuntimeException(t);
}
}
}