Skip to content

Commit c8224fa

Browse files
committed
refactor: remove usage of class.newInstance() deprecated method
1 parent 1b8a5bd commit c8224fa

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;
@@ -757,7 +758,13 @@ public Future<String> deployVerticle(Verticle verticle, DeploymentOptions option
757758

758759
@Override
759760
public Future<String> deployVerticle(Class<? extends Verticle> verticleClass, DeploymentOptions options) {
760-
return deployVerticle((Callable<Verticle>) verticleClass::newInstance, options);
761+
762+
try {
763+
final var verticle = verticleClass.getDeclaredConstructor().newInstance();
764+
return deployVerticle(verticle, options);
765+
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
766+
throw new RuntimeException(e);
767+
}
761768
}
762769

763770
@Override

0 commit comments

Comments
 (0)