Migrated attachment for Guice issue 288, comment 93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/src/com/google/inject/internal/InjectorImpl.java b/core/src/com/google/inject/internal/InjectorImpl.java | |
index ee5e2d6..264cbab 100644 | |
--- a/core/src/com/google/inject/internal/InjectorImpl.java | |
+++ b/core/src/com/google/inject/internal/InjectorImpl.java | |
@@ -116,6 +116,13 @@ final class InjectorImpl implements Injector, Lookups { | |
final Set<Key<?>> failedJitBindings = Sets.newHashSet(); | |
Lookups lookups = new DeferredLookups(this); | |
+ | |
+ private static final class LocalContext extends ThreadLocal<Object[]> { | |
+ @Override | |
+ protected Object[] initialValue() { | |
+ return new Object[1]; | |
+ } | |
+ } | |
InjectorImpl(InjectorImpl parent, State state, InjectorOptions injectorOptions) { | |
this.parent = parent; | |
@@ -125,12 +132,7 @@ final class InjectorImpl implements Injector, Lookups { | |
if (parent != null) { | |
localContext = parent.localContext; | |
} else { | |
- localContext = new ThreadLocal<Object[]>() { | |
- @Override | |
- protected Object[] initialValue() { | |
- return new Object[1]; | |
- } | |
- }; | |
+ localContext = new LocalContext(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment