fixed deprecations with java 11

Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
This commit is contained in:
Christian Dietrich 2019-05-07 11:38:57 +02:00
parent 54d920ad5e
commit 86fb88215c
6 changed files with 8 additions and 8 deletions

View file

@ -72,7 +72,7 @@ public class InjectionExtension implements BeforeEachCallback, AfterEachCallback
IInjectorProvider injectorProvider = injectorProviderClassCache.get(klass);
if (injectorProvider == null) {
try {
injectorProvider = klass.newInstance();
injectorProvider = klass.getDeclaredConstructor().newInstance();
injectorProviderClassCache.put(klass, injectorProvider);
} catch (Exception e) {
throwUncheckedException(e);

View file

@ -35,7 +35,7 @@ public class InjectorProviders {
IInjectorProvider injectorProvider = injectorProviderClassCache.get(klass);
if (injectorProvider == null) {
try {
injectorProvider = klass.newInstance();
injectorProvider = klass.getDeclaredConstructor().newInstance();
injectorProviderClassCache.put(klass, injectorProvider);
} catch (Exception e) {
throwUncheckedException(e);
@ -58,7 +58,7 @@ public class InjectorProviders {
InjectWith injectWith = testClass.getJavaClass().getAnnotation(InjectWith.class);
if (injectWith != null) {
try {
return injectWith.value().newInstance();
return injectWith.value().getDeclaredConstructor().newInstance();
} catch (Exception e) {
throwUncheckedException(e);
}

View file

@ -96,7 +96,7 @@ public abstract class AbstractXtextTests extends Assert implements ResourceLoadH
protected void with(Class<? extends ISetup> setupClazz) throws Exception {
assertTrue("super.setUp() has to be called before any injector is instantiated", canCreateInjector);
ISetup instance = setupClazz.newInstance();
ISetup instance = setupClazz.getDeclaredConstructor().newInstance();
setInjector(instance.createInjectorAndDoEMFRegistration());
}

View file

@ -73,7 +73,7 @@ public class ValidationTestHelper {
@Override
protected AbstractDeclarativeValidator newInstance(Class<? extends AbstractDeclarativeValidator> clazz) {
try {
return clazz.newInstance();
return clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
@ -96,7 +96,7 @@ public class ValidationTestHelper {
@Override
protected AbstractDeclarativeValidator newInstance(Class<? extends AbstractDeclarativeValidator> clazz) {
try {
return clazz.newInstance();
return clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}

View file

@ -52,7 +52,7 @@ class XtextGeneratorResourceSetInitializer {
if (resourceServiceProvider === null) {
try {
val genModelSupport = Class.forName('org.eclipse.emf.codegen.ecore.xtext.GenModelSupport')
val instance = genModelSupport.newInstance()
val instance = genModelSupport.getDeclaredConstructor().newInstance()
genModelSupport.getDeclaredMethod('createInjectorAndDoEMFRegistration').invoke(instance)
} catch (ClassNotFoundException e) {
LOG.debug("org.eclipse.emf.codegen.ecore.xtext.GenModelSupport not found, GenModels will not be indexed")

View file

@ -61,7 +61,7 @@ public class XtextGeneratorResourceSetInitializer {
if ((resourceServiceProvider == null)) {
try {
final Class<?> genModelSupport = Class.forName("org.eclipse.emf.codegen.ecore.xtext.GenModelSupport");
final Object instance = genModelSupport.newInstance();
final Object instance = genModelSupport.getDeclaredConstructor().newInstance();
genModelSupport.getDeclaredMethod("createInjectorAndDoEMFRegistration").invoke(instance);
} catch (final Throwable _t) {
if (_t instanceof ClassNotFoundException) {