From d41e804fe73faed5f8b90f4b472728bc3a0c85b7 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 6 May 2019 21:26:29 +0200 Subject: [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). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/delombok/lombok/delombok/ant/DelombokTask.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/delombok/lombok') 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); -- cgit