[Runtime] Remove use of deprecated methods
Change-Id: I37aa51401e8be6fc1f7bc87f420e5e5e7c320aa4
diff --git a/jcommons/org.eclipse.statet.jcommons.util/src/org/eclipse/statet/jcommons/runtime/bundle/Bundles.java b/jcommons/org.eclipse.statet.jcommons.util/src/org/eclipse/statet/jcommons/runtime/bundle/Bundles.java
index 2bc595e..730556a 100644
--- a/jcommons/org.eclipse.statet.jcommons.util/src/org/eclipse/statet/jcommons/runtime/bundle/Bundles.java
+++ b/jcommons/org.eclipse.statet.jcommons.util/src/org/eclipse/statet/jcommons/runtime/bundle/Bundles.java
@@ -91,10 +91,11 @@
}
if (id.indexOf('.') > 0) {
try {
- final Class<?> resolverClass= Class.forName(id);
- return (BundleResolver)resolverClass.newInstance();
+ @SuppressWarnings("unchecked")
+ final var resolverClass= (Class<? extends BundleResolver>)Class.forName(id);
+ return resolverClass.getConstructor().newInstance();
}
- catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+ catch (final ReflectiveOperationException e) {
throw new StatusException(new ErrorStatus(BUNDLE_ID,
String.format("Failed to create bundle resolver '%1$s'.", id),
e ));