diff options
Diffstat (limited to 'core/src/com/google/inject/internal/InjectorImpl.java')
-rw-r--r-- | core/src/com/google/inject/internal/InjectorImpl.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/src/com/google/inject/internal/InjectorImpl.java b/core/src/com/google/inject/internal/InjectorImpl.java index bcf481d2..e20035ac 100644 --- a/core/src/com/google/inject/internal/InjectorImpl.java +++ b/core/src/com/google/inject/internal/InjectorImpl.java @@ -101,7 +101,7 @@ final class InjectorImpl implements Injector, Lookups { NO_JIT, /** allows existing just in time bindings, but does not allow new ones */ EXISTING_JIT, - /** allows existing just in time bindings & allows new ones to be created */ + /** allows existing just in time bindings & allows new ones to be created in the current injector */ NEW_OR_EXISTING_JIT, } @@ -779,10 +779,14 @@ final class InjectorImpl implements Injector, Lookups { boolean jitDisabled, JitLimitation jitType) throws ErrorsException { // ask the parent to create the JIT binding if (parent != null) { - try { - return parent.createJustInTimeBindingRecursive(key, new Errors(), jitDisabled, - parent.options.jitDisabled ? JitLimitation.NO_JIT : jitType); - } catch (ErrorsException ignored) { + if (jitDisabled && jitType == JitLimitation.NEW_OR_EXISTING_JIT) { + throw errors.jitDisabledInParent(key).toException(); + } else { + try { + return parent.createJustInTimeBindingRecursive(key, new Errors(), jitDisabled, + parent.options.jitDisabled ? JitLimitation.NO_JIT : jitType); + } catch (ErrorsException ignored) { + } } } |