Skip to content

Commit 40372df

Browse files
committed
refactor: remove usage of class.newInstance() deprecated method
1 parent c0299ad commit 40372df

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/io/vertx/core/impl/VertxImpl.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import java.io.InputStream;
6464
import java.lang.ref.Cleaner;
6565
import java.lang.ref.WeakReference;
66+
import java.lang.reflect.InvocationTargetException;
6667
import java.lang.reflect.Method;
6768
import java.net.InetAddress;
6869
import java.net.InetSocketAddress;
@@ -740,7 +741,13 @@ public Future<String> deployVerticle(Verticle verticle, DeploymentOptions option
740741

741742
@Override
742743
public Future<String> deployVerticle(Class<? extends Verticle> verticleClass, DeploymentOptions options) {
743-
return deployVerticle((Callable<Verticle>) verticleClass::newInstance, options);
744+
745+
try {
746+
final var verticle = verticleClass.getDeclaredConstructor().newInstance();
747+
return deployVerticle(verticle, options);
748+
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
749+
throw new RuntimeException(e);
750+
}
744751
}
745752

746753
@Override

0 commit comments

Comments
 (0)