Eliminated static from SourceProviders. The new mechanism to specify the source of a binding is like this:
Binder myBinder = binder.withSource(source);
git-svn-id: https://google-guice.googlecode.com/svn/trunk@525 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/commands/CommandRecorder.java b/src/com/google/inject/commands/CommandRecorder.java
index 312428e..d91b01a 100644
--- a/src/com/google/inject/commands/CommandRecorder.java
+++ b/src/com/google/inject/commands/CommandRecorder.java
@@ -19,6 +19,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.google.inject.Key;
import com.google.inject.Module;
@@ -30,7 +31,7 @@
import com.google.inject.binder.AnnotatedConstantBindingBuilder;
import com.google.inject.matcher.Matcher;
import com.google.inject.spi.Message;
-import com.google.inject.spi.SourceProviders;
+import com.google.inject.spi.SourceProvider;
import com.google.inject.spi.TypeConverter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -47,13 +48,12 @@
* @author jessewilson@google.com (Jesse Wilson)
*/
public final class CommandRecorder {
+ private static final SourceProvider sourceProvider = new SourceProvider(
+ RecordingBinder.class, AbstractModule.class);
+
private Stage currentStage = Stage.DEVELOPMENT;
private final EarlyRequestsProvider earlyRequestsProvider;
- static {
- SourceProviders.skip(RecordingBinder.class);
- }
-
/**
* @param earlyRequestsProvider satisfies requests to
* {@link Binder#getProvider} at module execution time. For modules that
@@ -196,7 +196,7 @@
}
protected Object getSource() {
- return SourceProviders.defaultSource();
+ return sourceProvider.get();
}
@Override public String toString() {