diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-21 17:34:09 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-21 17:34:09 +0700 |
commit | ecb5320c7b61d72edbf4a440e4996171a9c8f7dd (patch) | |
tree | 2b5496ad42ca47d0f3c7e636f2130dbb4d8b6e2c /taskdefs | |
parent | e4a2a5a5d274bc16bae3d1178789752dba043730 (diff) | |
download | aspectj-ecb5320c7b61d72edbf4a440e4996171a9c8f7dd.tar.gz aspectj-ecb5320c7b61d72edbf4a440e4996171a9c8f7dd.zip |
Fix some deprecated Java and JUnit warnings by using newer API calls
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'taskdefs')
-rw-r--r-- | taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java | 6 | ||||
-rw-r--r-- | taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java index a48769ecb..a4415833a 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java @@ -287,7 +287,7 @@ public class AjcTask extends MatchingTask { if (null != editorClassName) { ClassLoader cl = AjcTask.class.getClassLoader(); Class editorClass = cl.loadClass(editorClassName); - editor = (ICommandEditor) editorClass.newInstance(); + editor = (ICommandEditor) editorClass.getDeclaredConstructor().newInstance(); } } catch (Throwable t) { System.err.println("Warning: unable to load command editor"); @@ -865,7 +865,7 @@ public class AjcTask extends MatchingTask { public void setMessageHolderClass(String className) { try { Class mclass = Class.forName(className); - IMessageHolder holder = (IMessageHolder) mclass.newInstance(); + IMessageHolder holder = (IMessageHolder) mclass.getDeclaredConstructor().newInstance(); setMessageHolder(holder); } catch (Throwable t) { String m = "unable to instantiate message holder: " + className; @@ -889,7 +889,7 @@ public class AjcTask extends MatchingTask { public void setCommandEditorClass(String className) { // skip Ant interface? try { Class mclass = Class.forName(className); - setCommandEditor((ICommandEditor) mclass.newInstance()); + setCommandEditor((ICommandEditor) mclass.getDeclaredConstructor().newInstance()); } catch (Throwable t) { String m = "unable to instantiate command editor: " + className; throw new BuildException(m, t); diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java index a3bcbd91a..fe6900755 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java @@ -92,7 +92,7 @@ public class Ajc extends DefaultCompilerAdapter { System.setErr(logstr); return (Integer) main.getMethod ("compile", new Class[]{String[].class}).invoke - (main.newInstance(), new Object[]{ + (main.getDeclaredConstructor().newInstance(), new Object[]{ removeUnsupported(cline, logstr) }) == AJC_COMPILER_SUCCESS; } catch (Exception e) { |