Skip to content

Commit

Permalink
refactor: remove usage of class.newInstance() deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
yeikel committed May 22, 2024
1 parent c0299ad commit 40372df
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/io/vertx/core/impl/VertxImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import java.io.InputStream;
import java.lang.ref.Cleaner;
import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.InetSocketAddress;
Expand Down Expand Up @@ -740,7 +741,13 @@ public Future<String> deployVerticle(Verticle verticle, DeploymentOptions option

@Override
public Future<String> deployVerticle(Class<? extends Verticle> verticleClass, DeploymentOptions options) {
return deployVerticle((Callable<Verticle>) verticleClass::newInstance, options);

try {
final var verticle = verticleClass.getDeclaredConstructor().newInstance();
return deployVerticle(verticle, options);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
}

@Override
Expand Down

0 comments on commit 40372df

Please sign in to comment.