diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-05-06 21:26:29 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-05-06 21:26:29 +0200 |
commit | d41e804fe73faed5f8b90f4b472728bc3a0c85b7 (patch) | |
tree | f47d82c4f383cfdb242c803c88eadde5c2982944 /src/delombok/lombok | |
parent | 2335f251665d43b4c8cebe00b980f07ef33bdb17 (diff) | |
download | lombok-d41e804fe73faed5f8b90f4b472728bc3a0c85b7.tar.gz lombok-d41e804fe73faed5f8b90f4b472728bc3a0c85b7.tar.bz2 lombok-d41e804fe73faed5f8b90f4b472728bc3a0c85b7.zip |
[trivial] replacing all calls to Class.newInstance() with Class.getConstructor().newInstance to avoid warnings which are default in many JDK11+ environments, and it shouldn’t change anything (we handle the change from sneaky throwing to InvocationTargetException appropriately).
Diffstat (limited to 'src/delombok/lombok')
-rw-r--r-- | src/delombok/lombok/delombok/ant/DelombokTask.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/delombok/lombok/delombok/ant/DelombokTask.java b/src/delombok/lombok/delombok/ant/DelombokTask.java index cb31ef4d..defd1709 100644 --- a/src/delombok/lombok/delombok/ant/DelombokTask.java +++ b/src/delombok/lombok/delombok/ant/DelombokTask.java @@ -188,7 +188,7 @@ class Tasks { Location loc = getLocation(); try { - Object instance = shadowLoadClass("lombok.delombok.ant.DelombokTaskImpl").newInstance(); + Object instance = shadowLoadClass("lombok.delombok.ant.DelombokTaskImpl").getConstructor().newInstance(); for (Field selfField : getClass().getDeclaredFields()) { if (selfField.isSynthetic() || Modifier.isStatic(selfField.getModifiers())) continue; Field otherField = instance.getClass().getDeclaredField(selfField.getName()); @@ -208,7 +208,7 @@ class Tasks { Method m = instance.getClass().getMethod("execute", Location.class); m.invoke(instance, loc); } catch (Exception e) { - Throwable t = (e instanceof InvocationTargetException) ? ((InvocationTargetException) e).getCause() : e; + Throwable t = (e instanceof InvocationTargetException) ? e.getCause() : e; if (t instanceof Error) throw (Error) t; if (t instanceof RuntimeException) throw (RuntimeException) t; throw new RuntimeException(t); |