提交 4ab9c096 编写于 作者: J Jesse Glick

Be more resilient against Guice errors.

com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance can throw NCDFE, it seems.
上级 f5a78695
...@@ -414,7 +414,7 @@ public abstract class ExtensionFinder implements ExtensionPoint { ...@@ -414,7 +414,7 @@ public abstract class ExtensionFinder implements ExtensionPoint {
* Instead, we should just drop the failing plugins. * Instead, we should just drop the failing plugins.
*/ */
public static final Scope FAULT_TOLERANT_SCOPE = new Scope() { public static final Scope FAULT_TOLERANT_SCOPE = new Scope() {
public <T> Provider<T> scope(Key<T> key, Provider<T> unscoped) { public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscoped) {
final Provider<T> base = Scopes.SINGLETON.scope(key,unscoped); final Provider<T> base = Scopes.SINGLETON.scope(key,unscoped);
return new Provider<T>() { return new Provider<T>() {
public T get() { public T get() {
...@@ -423,6 +423,9 @@ public abstract class ExtensionFinder implements ExtensionPoint { ...@@ -423,6 +423,9 @@ public abstract class ExtensionFinder implements ExtensionPoint {
} catch (Exception e) { } catch (Exception e) {
LOGGER.log(Level.WARNING,"Failed to instantiate. Skipping this component",e); LOGGER.log(Level.WARNING,"Failed to instantiate. Skipping this component",e);
return null; return null;
} catch (LinkageError e) {
LOGGER.log(Level.WARNING,"Failed to instantiate. Skipping this component",e);
return null;
} }
} }
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册