Skip to content

Commit

Permalink
Update call deprecated in Java 9
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Oct 2, 2023
1 parent c819e54 commit 447f003
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/examples/ProxyCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class ProxyCreator {
public static Object createProxy(final String pack, final String className) {
try {
final Class<?> cl = Class.forName(pack + "$$BCEL$$" + className);
return cl.newInstance();
return cl.getConstructor().newInstance();
} catch (final Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ public Instruction createCast(final Type srcType, final Type destType) {
final String name = "org.apache.bcel.generic." + SHORT_NAMES[src - Const.T_CHAR] + "2" + SHORT_NAMES[dest - Const.T_CHAR];
Instruction i = null;
try {
i = (Instruction) Class.forName(name).newInstance();
i = (Instruction) Class.forName(name).getConstructor().newInstance();
} catch (final Exception e) {
throw new IllegalArgumentException("Could not find instruction: " + name, e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/bcel/util/JavaWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private static java.lang.ClassLoader getClassLoader() {
throw new IllegalStateException("The property 'bcel.classloader' must be defined");
}
try {
return (java.lang.ClassLoader) Class.forName(s).newInstance();
return (java.lang.ClassLoader) Class.forName(s).getConstructor().newInstance();
} catch (final Exception e) {
throw new IllegalStateException(e.toString(), e);
}
Expand Down

0 comments on commit 447f003

Please sign in to comment.