diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/nls/GlobalBundleCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/nls/GlobalBundleCache.java index 84bf21460..b437f635f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/nls/GlobalBundleCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/nls/GlobalBundleCache.java @@ -43,6 +43,7 @@ package org.eclipse.jgit.nls; +import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -92,12 +93,13 @@ static synchronized T lookupBundle(Locale locale, } TranslationBundle bundle = bundles.get(type); if (bundle == null) { - bundle = type.newInstance(); + bundle = type.getDeclaredConstructor().newInstance(); bundle.load(locale); bundles.put(type, bundle); } return (T) bundle; - } catch (InstantiationException | IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException + | InvocationTargetException | NoSuchMethodException e) { throw new Error(e); } } diff --git a/tools/BUILD b/tools/BUILD index 9abecc5f7..20c82c570 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -32,7 +32,7 @@ java_package_configuration( "-Xep:BoxedPrimitiveConstructor:ERROR", "-Xep:CannotMockFinalClass:ERROR", "-Xep:ClassCanBeStatic:ERROR", - "-Xep:ClassNewInstance:WARN", + "-Xep:ClassNewInstance:ERROR", "-Xep:DefaultCharset:ERROR", "-Xep:DoubleCheckedLocking:ERROR", "-Xep:ElementsCountedInLoop:ERROR",