Deprecating the old commands and old SPI in favour of the new unified API. It uses one Element class for both Module Elements and Injector Elements.

git-svn-id: https://google-guice.googlecode.com/svn/trunk@568 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/BindCommandProcessor.java b/src/com/google/inject/BindCommandProcessor.java
deleted file mode 100644
index 515e91e..0000000
--- a/src/com/google/inject/BindCommandProcessor.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.inject;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.google.inject.commands.BindCommand;
-import com.google.inject.commands.BindConstantCommand;
-import com.google.inject.commands.BindScoping.Visitor;
-import com.google.inject.commands.BindTarget;
-import com.google.inject.internal.Annotations;
-import com.google.inject.internal.Classes;
-import com.google.inject.internal.Errors;
-import com.google.inject.internal.ErrorsException;
-import com.google.inject.internal.StackTraceElements;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Handles {@link Binder#bind} and {@link Binder#bindConstant} commands.
- *
- * @author crazybob@google.com (Bob Lee)
- * @author jessewilson@google.com (Jesse Wilson)
- */
-class BindCommandProcessor extends CommandProcessor {
-
-  private final InjectorImpl injector;
-  private final Map<Class<? extends Annotation>, Scope> scopes;
-  private final List<CreationListener> creationListeners = Lists.newArrayList();
-  private final Map<Key<?>, BindingImpl<?>> bindings;
-  private final CreationTimeMemberInjector memberInjector;
-  private final List<Runnable> untargettedBindings = Lists.newArrayList();
-
-  BindCommandProcessor(Errors errors,
-      InjectorImpl injector,
-      Map<Class<? extends Annotation>, Scope> scopes,
-      Map<Key<?>, BindingImpl<?>> bindings,
-      CreationTimeMemberInjector memberInjector) {
-    super(errors);
-    this.injector = injector;
-    this.scopes = scopes;
-    this.bindings = bindings;
-    this.memberInjector = memberInjector;
-  }
-
-  @Override public <T> Boolean visitBind(BindCommand<T> command) {
-    final Object source = command.getSource();
-
-    final Key<T> key = command.getKey();
-    Class<? super T> rawType = key.getTypeLiteral().getRawType();
-
-    if (rawType == Provider.class) {
-      errors.bindingToProvider();
-      return true;
-    }
-
-    validateKey(command.getSource(), command.getKey());
-
-    final LoadStrategy loadStrategy = command.getScoping().isEagerSingleton()
-        ? LoadStrategy.EAGER
-        : LoadStrategy.LAZY;
-    final Scope scope = command.getScoping().acceptVisitor(new Visitor<Scope>() {
-      public Scope visitEagerSingleton() {
-        return Scopes.SINGLETON;
-      }
-
-      public Scope visitScope(Scope scope) {
-        return scope;
-      }
-
-      public Scope visitScopeAnnotation(Class<? extends Annotation> scopeAnnotation) {
-        Scope scope = scopes.get(scopeAnnotation);
-        if (scope != null) {
-          return scope;
-        } else {
-          errors.scopeNotFound(scopeAnnotation);
-          return null;
-        }
-      }
-
-      public Scope visitNoScoping() {
-        return null;
-      }
-    });
-
-    command.getTarget().acceptVisitor(new BindTarget.Visitor<T, Void>() {
-      public Void visitToInstance(T instance) {
-        if (instance == null) {
-          errors.cannotBindToNullInstance();
-          putBinding(invalidBinding(injector, key, source));
-          return null;
-        }
-
-        ConstantFactory<? extends T> factory = new ConstantFactory<T>(instance);
-        memberInjector.requestInjection(instance, source);
-        InternalFactory<? extends T> scopedFactory
-            = Scopes.scope(key, injector, factory, scope);
-        putBinding(new InstanceBindingImpl<T>(injector, key, source, scopedFactory, instance));
-        return null;
-      }
-
-      public Void visitToProvider(Provider<? extends T> provider) {
-        InternalFactoryToProviderAdapter<? extends T> factory
-            = new InternalFactoryToProviderAdapter<T>(provider, source);
-        memberInjector.requestInjection(provider, source);
-        InternalFactory<? extends T> scopedFactory
-            = Scopes.scope(key, injector, factory, scope);
-        putBinding(new ProviderInstanceBindingImpl<T>(
-                injector, key, source, scopedFactory, scope, provider, loadStrategy));
-        return null;
-      }
-
-      public Void visitToProviderKey(Key<? extends Provider<? extends T>> providerKey) {
-        final BoundProviderFactory<T> boundProviderFactory =
-            new BoundProviderFactory<T>(providerKey, source);
-        creationListeners.add(boundProviderFactory);
-        InternalFactory<? extends T> scopedFactory = Scopes.scope(
-            key, injector, (InternalFactory<? extends T>) boundProviderFactory, scope);
-        putBinding(new LinkedProviderBindingImpl<T>(
-                injector, key, source, scopedFactory, scope, providerKey, loadStrategy));
-        return null;
-      }
-
-      public Void visitToKey(Key<? extends T> targetKey) {
-        if (key.equals(targetKey)) {
-          errors.recursiveBinding();
-        }
-
-        FactoryProxy<T> factory = new FactoryProxy<T>(key, targetKey, source);
-        creationListeners.add(factory);
-        InternalFactory<? extends T> scopedFactory
-            = Scopes.scope(key, injector, factory, scope);
-        putBinding(new LinkedBindingImpl<T>(
-                injector, key, source, scopedFactory, scope, targetKey, loadStrategy));
-        return null;
-      }
-
-      public Void visitUntargetted() {
-        final Type type = key.getTypeLiteral().getType();
-
-        // Error: Missing implementation.
-        // Example: bind(Date.class).annotatedWith(Red.class);
-        // We can't assume abstract types aren't injectable. They may have an
-        // @ImplementedBy annotation or something.
-        if (key.hasAnnotationType() || !(type instanceof Class<?>)) {
-          errors.missingImplementation(key);
-          putBinding(invalidBinding(injector, key, source));
-          return null;
-        }
-
-        // This cast is safe after the preceeding check.
-        @SuppressWarnings("unchecked")
-        Class<T> clazz = (Class<T>) type;
-        final BindingImpl<T> binding;
-        try {
-          binding = injector.createUnitializedBinding(
-              key, clazz, scope, source, loadStrategy, errors);
-          putBinding(binding);
-        } catch (ErrorsException e) {
-          errors.merge(e.getErrors());
-          putBinding(invalidBinding(injector, key, source));
-          return null;
-        }
-
-        untargettedBindings.add(new Runnable() {
-          public void run() {
-            try {
-              injector.initializeBinding(binding, errors.withSource(source));
-            } catch (ErrorsException e) {
-              errors.merge(e.getErrors());
-            }
-          }
-        });
-
-        return null;
-      }
-    });
-
-    return true;
-  }
-
-  private <T> void validateKey(Object source, Key<T> key) {
-    if (key.hasAnnotationType()) {
-      Class<? extends Annotation> annotationType = key.getAnnotationType();
-
-      if (!Annotations.isRetainedAtRuntime(annotationType)) {
-        errors.withSource(StackTraceElements.forType(annotationType)).missingRuntimeRetention(source);
-      }
-
-      if (!Key.isBindingAnnotation(annotationType)) {
-        errors.withSource(StackTraceElements.forType(annotationType)).missingBindingAnnotation(source);
-      }
-    }
-
-    Class<? super T> rawType = key.getRawType();
-    if (!Classes.isConcrete(rawType)) {
-      Class<? extends Annotation> scopeAnnotation = Scopes.findScopeAnnotation(errors, rawType);
-      if (scopeAnnotation != null) {
-        errors.withSource(StackTraceElements.forType(rawType))
-            .scopeAnnotationOnAbstractType(scopeAnnotation, rawType, source);
-      }
-    }
-  }
-
-  <T> InvalidBindingImpl<T> invalidBinding(InjectorImpl injector, Key<T> key, Object source) {
-    return new InvalidBindingImpl<T>(injector, key, source);
-  }
-
-  @Override public Boolean visitBindConstant(BindConstantCommand command) {
-    BindTarget<?> target = command.getTarget();
-    if (target == null) {
-      errors.missingConstantValues();
-      return true;
-    }
-
-    Object value = target.get();
-    validateKey(command.getSource(), command.getKey());
-    ConstantFactory<Object> factory = new ConstantFactory<Object>(value);
-    putBinding(new ConstantBindingImpl<Object>(
-        injector, command.getKey(), command.getSource(), factory, value));
-
-    return true;
-  }
-
-  public void createUntargettedBindings() {
-    for (Runnable untargettedBinding : untargettedBindings) {
-      untargettedBinding.run();
-    }
-  }
-
-  public void runCreationListeners(InjectorImpl injector) {
-    for (CreationListener creationListener : creationListeners) {
-      creationListener.notify(injector, errors);
-    }
-  }
-
-  private void putBinding(BindingImpl<?> binding) {
-    Key<?> key = binding.getKey();
-    Binding<?> original = bindings.get(key);
-
-    Class<?> rawType = key.getRawType();
-    if (FORBIDDEN_TYPES.contains(rawType)) {
-      errors.cannotBindToGuiceType(rawType.getSimpleName());
-      return;
-    }
-
-    if (bindings.containsKey(key)) {
-      errors.bindingAlreadySet(key, original.getSource());
-    } else {
-      bindings.put(key, binding);
-    }
-  }
-
-  private static Set<Class<?>> FORBIDDEN_TYPES = forbiddenTypes();
-
-  @SuppressWarnings("unchecked") // For generic array creation.
-  private static Set<Class<?>> forbiddenTypes() {
-    Set<Class<?>> set = Sets.newHashSet();
-
-    Collections.addAll(set,
-
-        // It's unfortunate that we have to maintain a blacklist of specific
-        // classes, but we can't easily block the whole package because of
-        // all our unit tests.
-
-        AbstractModule.class,
-        Binder.class,
-        Binding.class,
-        Key.class,
-        Module.class,
-        Provider.class,
-        Scope.class,
-        TypeLiteral.class);
-    return Collections.unmodifiableSet(set);
-  }
-
-  interface CreationListener {
-    void notify(InjectorImpl injector, Errors errors);
-  }
-}
diff --git a/src/com/google/inject/BindInterceptorCommandProcessor.java b/src/com/google/inject/BindInterceptorCommandProcessor.java
deleted file mode 100644
index 8767e0b..0000000
--- a/src/com/google/inject/BindInterceptorCommandProcessor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.inject;
-
-import com.google.inject.commands.BindInterceptorCommand;
-import com.google.inject.internal.Errors;
-
-/**
- * Handles {@link Binder#bindInterceptor} commands.
- *
- * @author crazybob@google.com (Bob Lee)
- * @author jessewilson@google.com (Jesse Wilson)
- */
-class BindInterceptorCommandProcessor extends CommandProcessor {
-
-  private final ProxyFactoryBuilder proxyFactoryBuilder;
-
-  BindInterceptorCommandProcessor(Errors errors) {
-    super(errors);
-    proxyFactoryBuilder = new ProxyFactoryBuilder();
-  }
-
-  @Override public Boolean visitBindInterceptor(BindInterceptorCommand command) {
-    proxyFactoryBuilder.intercept(
-        command.getClassMatcher(), command.getMethodMatcher(), command.getInterceptors());
-    return true;
-  }
-
-  ProxyFactory createProxyFactory() {
-    return proxyFactoryBuilder.create();
-  }
-}
diff --git a/src/com/google/inject/CommandProcessor.java b/src/com/google/inject/CommandProcessor.java
deleted file mode 100644
index 4b806a7..0000000
--- a/src/com/google/inject/CommandProcessor.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.inject;
-
-import com.google.inject.commands.AddMessageCommand;
-import com.google.inject.commands.BindCommand;
-import com.google.inject.commands.BindConstantCommand;
-import com.google.inject.commands.BindInterceptorCommand;
-import com.google.inject.commands.BindScopeCommand;
-import com.google.inject.commands.Command;
-import com.google.inject.commands.ConvertToTypesCommand;
-import com.google.inject.commands.GetProviderCommand;
-import com.google.inject.commands.RequestInjectionCommand;
-import com.google.inject.commands.RequestStaticInjectionCommand;
-import com.google.inject.internal.Errors;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Abstract base class for executing commands to creating an injector.
- *
- * <p>Extending classes must return {@code true} from any overridden
- * {@code visit*()} methods, in order for the command processor to remove the
- * handled command.
- *
- * @author jessewilson@google.com (Jesse Wilson)
- */
-abstract class CommandProcessor implements Command.Visitor<Boolean> {
-
-  protected Errors errors;
-
-  protected CommandProcessor(Errors errors) {
-    this.errors = errors;
-  }
-
-  public void processCommands(List<Command> commands) {
-    Errors errorsAnyCommand = this.errors;
-    try {
-      for (Iterator<Command> i = commands.iterator(); i.hasNext(); ) {
-        Command command = i.next();
-        this.errors = errorsAnyCommand.withSource(command.getSource());
-        Boolean allDone = command.acceptVisitor(this);
-        if (allDone) {
-          i.remove();
-        }
-      }
-    } finally {
-      this.errors = errorsAnyCommand;
-    }
-  }
-
-  public Boolean visitAddMessage(AddMessageCommand command) {
-    return false;
-  }
-
-  public Boolean visitBindInterceptor(BindInterceptorCommand command) {
-    return false;
-  }
-
-  public Boolean visitBindScope(BindScopeCommand command) {
-    return false;
-  }
-
-  public Boolean visitRequestInjection(RequestInjectionCommand command) {
-    return false;
-  }
-
-  public Boolean visitRequestStaticInjection(RequestStaticInjectionCommand command) {
-    return false;
-  }
-
-  public Boolean visitBindConstant(BindConstantCommand command) {
-    return false;
-  }
-
-  public Boolean visitConvertToTypes(ConvertToTypesCommand command) {
-    return false;
-  }
-
-  public <T> Boolean visitBind(BindCommand<T> command) {
-    return false;
-  }
-
-  public <T> Boolean visitGetProvider(GetProviderCommand<T> command) {
-    return false;
-  }
-}
diff --git a/src/com/google/inject/ConvertToTypesCommandProcessor.java b/src/com/google/inject/ConvertToTypesCommandProcessor.java
deleted file mode 100644
index 93b8609..0000000
--- a/src/com/google/inject/ConvertToTypesCommandProcessor.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package com.google.inject;
-
-import com.google.inject.commands.ConvertToTypesCommand;
-import com.google.inject.internal.Errors;
-import com.google.inject.internal.MatcherAndConverter;
-import com.google.inject.internal.SourceProvider;
-import com.google.inject.internal.Strings;
-import com.google.inject.matcher.AbstractMatcher;
-import com.google.inject.matcher.Matcher;
-import com.google.inject.matcher.Matchers;
-import com.google.inject.spi.TypeConverter;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * Handles {@link Binder#convertToTypes} commands.
- *
- * @author crazybob@google.com (Bob Lee)
- * @author jessewilson@google.com (Jesse Wilson)
- */
-class ConvertToTypesCommandProcessor extends CommandProcessor {
-
-  private final List<MatcherAndConverter> converters;
-
-  ConvertToTypesCommandProcessor(Errors errors, List<MatcherAndConverter> converters) {
-    super(errors);
-    this.converters = converters;
-
-    // Configure type converters.
-    convertToPrimitiveType(int.class, Integer.class);
-    convertToPrimitiveType(long.class, Long.class);
-    convertToPrimitiveType(boolean.class, Boolean.class);
-    convertToPrimitiveType(byte.class, Byte.class);
-    convertToPrimitiveType(short.class, Short.class);
-    convertToPrimitiveType(float.class, Float.class);
-    convertToPrimitiveType(double.class, Double.class);
-
-    convertToClass(Character.class, new TypeConverter() {
-      public Object convert(String value, TypeLiteral<?> toType) {
-        value = value.trim();
-        if (value.length() != 1) {
-          throw new RuntimeException("Length != 1.");
-        }
-        return value.charAt(0);
-      }
-
-      @Override public String toString() {
-        return "TypeConverter<Character>";
-      }
-    });
-
-    convertToClasses(Matchers.subclassesOf(Enum.class), new TypeConverter() {
-      @SuppressWarnings("unchecked")
-      public Object convert(String value, TypeLiteral<?> toType) {
-        return Enum.valueOf((Class) toType.getRawType(), value);
-      }
-
-      @Override public String toString() {
-        return "TypeConverter<E extends Enum<E>>";
-      }
-    });
-
-    internalConvertToTypes(
-      new AbstractMatcher<TypeLiteral<?>>() {
-        public boolean matches(TypeLiteral<?> typeLiteral) {
-          return typeLiteral.getRawType() == Class.class;
-        }
-
-        @Override public String toString() {
-          return "Class<?>";
-        }
-      },
-      new TypeConverter() {
-        @SuppressWarnings("unchecked")
-        public Object convert(String value, TypeLiteral<?> toType) {
-          try {
-            return Class.forName(value);
-          }
-          catch (ClassNotFoundException e) {
-            throw new RuntimeException(e.getMessage());
-          }
-        }
-
-        @Override public String toString() {
-          return "TypeConverter<Class<?>>";
-        }
-      }
-    );
-  }
-
-  private <T> void convertToPrimitiveType(Class<T> primitiveType,
-      final Class<T> wrapperType) {
-    try {
-      final Method parser = wrapperType.getMethod(
-          "parse" + Strings.capitalize(primitiveType.getName()), String.class);
-
-      TypeConverter typeConverter = new TypeConverter() {
-        @SuppressWarnings("unchecked")
-        public Object convert(String value, TypeLiteral<?> toType) {
-          try {
-            return parser.invoke(null, value);
-          }
-          catch (IllegalAccessException e) {
-            throw new AssertionError(e);
-          }
-          catch (InvocationTargetException e) {
-            throw new RuntimeException(e.getTargetException().getMessage());
-          }
-        }
-
-        @Override public String toString() {
-          return "TypeConverter<" + wrapperType.getSimpleName() + ">";
-        }
-      };
-
-      convertToClass(wrapperType, typeConverter);
-    } catch (NoSuchMethodException e) {
-      throw new AssertionError(e);
-    }
-  }
-
-  private <T> void convertToClass(Class<T> type, TypeConverter converter) {
-    convertToClasses(Matchers.identicalTo(type), converter);
-  }
-
-  private void convertToClasses(final Matcher<? super Class<?>> typeMatcher,
-      TypeConverter converter) {
-    internalConvertToTypes(new AbstractMatcher<TypeLiteral<?>>() {
-      public boolean matches(TypeLiteral<?> typeLiteral) {
-        Type type = typeLiteral.getType();
-        if (!(type instanceof Class)) {
-          return false;
-        }
-        Class<?> clazz = (Class<?>) type;
-        return typeMatcher.matches(clazz);
-      }
-
-      @Override public String toString() {
-        return typeMatcher.toString();
-      }
-    }, converter);
-  }
-
-  private void internalConvertToTypes(Matcher<? super TypeLiteral<?>> typeMatcher,
-      TypeConverter converter) {
-    converters.add(new MatcherAndConverter(typeMatcher, converter, SourceProvider.UNKNOWN_SOURCE));
-  }
-
-  @Override public Boolean visitConvertToTypes(ConvertToTypesCommand command) {
-    converters.add(new MatcherAndConverter(
-        command.getTypeMatcher(), command.getTypeConverter(), command.getSource()));
-    return true;
-  }
-}
diff --git a/src/com/google/inject/ErrorsCommandProcessor.java b/src/com/google/inject/ErrorsCommandProcessor.java
deleted file mode 100644
index d755391..0000000
--- a/src/com/google/inject/ErrorsCommandProcessor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.inject;
-
-import com.google.inject.commands.AddMessageCommand;
-import com.google.inject.internal.Errors;
-import com.google.inject.spi.Message;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Handles {@link Binder#addError} commands.
- *
- * @author crazybob@google.com (Bob Lee)
- * @author jessewilson@google.com (Jesse Wilson)
- */
-class ErrorsCommandProcessor extends CommandProcessor {
-
-  private static final Logger logger = Logger.getLogger(Guice.class.getName());
-
-  ErrorsCommandProcessor(Errors errors) {
-    super(errors);
-  }
-
-  @Override public Boolean visitAddMessage(AddMessageCommand command) {
-    Message message = command.getMessage();
-    if (message.getCause() != null) {
-      String rootMessage = getRootMessage(message.getCause());
-      logger.log(Level.INFO,
-          "An exception was caught and reported. Message: " + rootMessage,
-          message.getCause());
-    }
-
-    errors.addMessage(message);
-    return true;
-  }
-
-  public static String getRootMessage(Throwable t) {
-    Throwable cause = t.getCause();
-    return cause == null ? t.toString() : getRootMessage(cause);
-  }
-}
diff --git a/src/com/google/inject/RequestInjectionCommandProcessor.java b/src/com/google/inject/RequestInjectionCommandProcessor.java
deleted file mode 100644
index 3804607..0000000
--- a/src/com/google/inject/RequestInjectionCommandProcessor.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.inject;
-
-import com.google.common.collect.Lists;
-import com.google.inject.InjectorImpl.SingleMemberInjector;
-import com.google.inject.commands.RequestInjectionCommand;
-import com.google.inject.commands.RequestStaticInjectionCommand;
-import com.google.inject.internal.Errors;
-import com.google.inject.internal.ErrorsException;
-import java.util.List;
-
-/**
- * Handles {@link Binder#requestInjection} and {@link Binder#requestStaticInjection} commands.
- *
- * @author crazybob@google.com (Bob Lee)
- * @author jessewilson@google.com (Jesse Wilson)
- * @author mikeward@google.com (Mike Ward)
- */
-class RequestInjectionCommandProcessor extends CommandProcessor {
-
-  private final List<StaticInjection> staticInjections = Lists.newArrayList();
-  private final CreationTimeMemberInjector memberInjector;
-
-  RequestInjectionCommandProcessor(Errors errors,
-      CreationTimeMemberInjector memberInjector) {
-    super(errors);
-    this.memberInjector = memberInjector;
-  }
-
-  @Override public Boolean visitRequestStaticInjection(RequestStaticInjectionCommand command) {
-    for (Class<?> type : command.getTypes()) {
-      staticInjections.add(new StaticInjection(command.getSource(), type));
-    }
-    return true;
-  }
-
-  @Override public Boolean visitRequestInjection(RequestInjectionCommand command) {
-    for (Object instance : command.getInstances()) {
-      memberInjector.requestInjection(instance, command.getSource());
-    }
-    return true;
-  }
-
-  public void validate(InjectorImpl injector) {
-    for (StaticInjection staticInjection : staticInjections) {
-      staticInjection.validate(injector);
-    }
-  }
-
-  public void injectMembers(InjectorImpl injector) {
-    for (StaticInjection staticInjection : staticInjections) {
-      staticInjection.injectMembers(injector);
-    }
-  }
-
-  /** A requested static injection. */
-  private class StaticInjection {
-    final Object source;
-    final Class<?> type;
-    final List<SingleMemberInjector> memberInjectors = Lists.newArrayList();
-
-    public StaticInjection(Object source, Class type) {
-      this.source = source;
-      this.type = type;
-    }
-
-    void validate(final InjectorImpl injector) {
-      Errors errorsForMember = errors.withSource(source);
-      injector.addSingleInjectorsForFields(
-          type.getDeclaredFields(), true, memberInjectors, errorsForMember);
-      injector.addSingleInjectorsForMethods(
-          type.getDeclaredMethods(), true, memberInjectors, errorsForMember);
-    }
-
-    void injectMembers(InjectorImpl injector) {
-      try {
-        injector.callInContext(new ContextualCallable<Void>() {
-          public Void call(InternalContext context) {
-            for (SingleMemberInjector injector : memberInjectors) {
-              injector.inject(errors, context, null);
-            }
-            return null;
-          }
-        });
-      } catch (ErrorsException e) {
-        throw new AssertionError();
-      }
-    }
-  }
-}
diff --git a/src/com/google/inject/ScopesCommandProcessor.java b/src/com/google/inject/ScopesCommandProcessor.java
deleted file mode 100644
index dc2199f..0000000
--- a/src/com/google/inject/ScopesCommandProcessor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.inject;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.inject.commands.BindScopeCommand;
-import com.google.inject.internal.Annotations;
-import com.google.inject.internal.Errors;
-import com.google.inject.internal.StackTraceElements;
-import java.lang.annotation.Annotation;
-import java.util.Map;
-
-/**
- * Handles {@link Binder#bindScope} commands.
- *
- * @author crazybob@google.com (Bob Lee)
- * @author jessewilson@google.com (Jesse Wilson)
- */
-class ScopesCommandProcessor extends CommandProcessor {
-
-  private final Map<Class<? extends Annotation>, Scope> scopes;
-
-  ScopesCommandProcessor(Errors errors,
-      Map<Class<? extends Annotation>, Scope> scopes) {
-    super(errors);
-    this.scopes = scopes;
-  }
-
-  @Override public Boolean visitBindScope(BindScopeCommand command) {
-    Scope scope = command.getScope();
-    Class<? extends Annotation> annotationType = command.getAnnotationType();
-
-    if (!Scopes.isScopeAnnotation(annotationType)) {
-      errors.withSource(StackTraceElements.forType(annotationType)).missingScopeAnnotation();
-      // Go ahead and bind anyway so we don't get collateral errors.
-    }
-
-    if (!Annotations.isRetainedAtRuntime(annotationType)) {
-      errors.withSource(StackTraceElements.forType(annotationType))
-          .missingRuntimeRetention(command.getSource());
-      // Go ahead and bind anyway so we don't get collateral errors.
-    }
-
-    Scope existing = scopes.get(checkNotNull(annotationType, "annotation type"));
-    if (existing != null) {
-      errors.duplicateScopes(existing, annotationType, scope);
-    } else {
-      scopes.put(annotationType, checkNotNull(scope, "scope"));
-    }
-
-    return true;
-  }
-}
\ No newline at end of file
diff --git a/src/com/google/inject/commands/AddMessageCommand.java b/src/com/google/inject/commands/AddMessageCommand.java
new file mode 100644
index 0000000..8437d18
--- /dev/null
+++ b/src/com/google/inject/commands/AddMessageCommand.java
@@ -0,0 +1,59 @@
+/**
+ * Copyright (C) 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.inject.commands;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.spi.InjectionPoint;
+import com.google.inject.spi.Message;
+
+/**
+ * Immutable snapshot of a request to add a string message.
+ *
+ * @deprecated replaced with {@link com.google.inject.spi.Message}
+ *
+ * @author jessewilson@google.com (Jesse Wilson)
+ */
+@Deprecated
+public final class AddMessageCommand implements Command {
+  private final Message message;
+
+  AddMessageCommand(Message message) {
+    this.message = message;
+  }
+
+  AddMessageCommand(Object source, String message, Object[] arguments) {
+    this.message = new Message(source, String.format(message, arguments));
+  }
+
+  AddMessageCommand(Object source, Throwable throwable) {
+    this.message = new Message(source,
+        "An exception was caught and reported. Message: " + throwable.getMessage(), 
+        ImmutableList.<InjectionPoint>of(), throwable);
+  }
+
+  public Object getSource() {
+    return message.getSource();
+  }
+
+  public <T> T acceptVisitor(Visitor<T> visitor) {
+    return visitor.visitAddMessage(this);
+  }
+
+  public Message getMessage() {
+    return message;
+  }
+}
diff --git a/src/com/google/inject/commands/BindCommand.java b/src/com/google/inject/commands/BindCommand.java
index 46d169a..2b30f0a 100644
--- a/src/com/google/inject/commands/BindCommand.java
+++ b/src/com/google/inject/commands/BindCommand.java
@@ -31,8 +31,11 @@
 /**
  * Immutable snapshot of a request to bind a value.
  *
+ * @deprecated replaced with {@link com.google.inject.Binding}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public final class BindCommand<T> implements Command {
 
   private static final BindTarget<Object> EMPTY_BIND_TARGET = new AbstractTarget<Object>() {
diff --git a/src/com/google/inject/commands/BindConstantCommand.java b/src/com/google/inject/commands/BindConstantCommand.java
index a340cc8..35209c6 100644
--- a/src/com/google/inject/commands/BindConstantCommand.java
+++ b/src/com/google/inject/commands/BindConstantCommand.java
@@ -29,8 +29,11 @@
 /**
  * Immutable snapshot of a request to bind a constant.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.BindConstant}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public final class BindConstantCommand implements Command {
   private final Object source;
   private BindingAnnotation bindingAnnotation;
diff --git a/src/com/google/inject/commands/BindInterceptorCommand.java b/src/com/google/inject/commands/BindInterceptorCommand.java
index b7e0fa4..156e449 100644
--- a/src/com/google/inject/commands/BindInterceptorCommand.java
+++ b/src/com/google/inject/commands/BindInterceptorCommand.java
@@ -16,20 +16,22 @@
 
 package com.google.inject.commands;
 
-import com.google.inject.matcher.Matcher;
 import static com.google.common.base.Preconditions.checkNotNull;
-import org.aopalliance.intercept.MethodInterceptor;
-
+import com.google.inject.matcher.Matcher;
 import java.lang.reflect.Method;
 import java.util.Arrays;
 import static java.util.Collections.unmodifiableList;
 import java.util.List;
+import org.aopalliance.intercept.MethodInterceptor;
 
 /**
  * Immutable snapshot of a request to bind an interceptor.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.BindInterceptor}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public final class BindInterceptorCommand implements Command {
   private final Object source;
   private final Matcher<? super Class<?>> classMatcher;
diff --git a/src/com/google/inject/commands/BindScopeCommand.java b/src/com/google/inject/commands/BindScopeCommand.java
index a8019e7..de809da 100644
--- a/src/com/google/inject/commands/BindScopeCommand.java
+++ b/src/com/google/inject/commands/BindScopeCommand.java
@@ -16,16 +16,18 @@
 
 package com.google.inject.commands;
 
-import com.google.inject.Scope;
 import static com.google.common.base.Preconditions.checkNotNull;
-
+import com.google.inject.Scope;
 import java.lang.annotation.Annotation;
 
 /**
  * Immutable snapshot of a request to bind a scope.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.BindScope}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public final class BindScopeCommand implements Command {
   private final Object source;
   private final Class<? extends Annotation> annotationType;
diff --git a/src/com/google/inject/commands/BindScoping.java b/src/com/google/inject/commands/BindScoping.java
index 1eb2a83..972da44 100644
--- a/src/com/google/inject/commands/BindScoping.java
+++ b/src/com/google/inject/commands/BindScoping.java
@@ -18,15 +18,17 @@
 
 import com.google.inject.Scope;
 import com.google.inject.binder.ScopedBindingBuilder;
-
 import java.lang.annotation.Annotation;
 
 
 /**
  * Immutable snapshot of a binding scope.
  *
+ * @deprecated replaced with {@link com.google.inject.Binding.ScopingVisitor}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public interface BindScoping {
   void execute(ScopedBindingBuilder scopedBindingBuilder);
   boolean isEagerSingleton();
diff --git a/src/com/google/inject/commands/BindTarget.java b/src/com/google/inject/commands/BindTarget.java
index e76569d..88d8117 100644
--- a/src/com/google/inject/commands/BindTarget.java
+++ b/src/com/google/inject/commands/BindTarget.java
@@ -26,8 +26,11 @@
 /**
  * A binding target, which provides instances from a specific key. 
  *
+ * @deprecated replaced with {@link com.google.inject.Binding.TargetVisitor}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public interface BindTarget<T> {
 
   /**
diff --git a/src/com/google/inject/commands/Command.java b/src/com/google/inject/commands/Command.java
index 01e06cb..7564af2 100644
--- a/src/com/google/inject/commands/Command.java
+++ b/src/com/google/inject/commands/Command.java
@@ -19,8 +19,11 @@
 /**
  * Immutable snapshot of a binding command.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.Element}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public interface Command {
   Object getSource();
   <T> T acceptVisitor(Visitor<T> visitor);
diff --git a/src/com/google/inject/commands/CommandRecorder.java b/src/com/google/inject/commands/CommandRecorder.java
index 807d912..d60b6e9 100644
--- a/src/com/google/inject/commands/CommandRecorder.java
+++ b/src/com/google/inject/commands/CommandRecorder.java
@@ -46,8 +46,11 @@
  * Records commands executed by a module so they can be inspected or
  * {@link CommandReplayer replayed}.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.Elements#getElements(Module[])}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public final class CommandRecorder {
   private Stage currentStage = Stage.DEVELOPMENT;
 
diff --git a/src/com/google/inject/commands/CommandReplayer.java b/src/com/google/inject/commands/CommandReplayer.java
index 708e550..b742969 100644
--- a/src/com/google/inject/commands/CommandReplayer.java
+++ b/src/com/google/inject/commands/CommandReplayer.java
@@ -31,8 +31,11 @@
 /**
  * Executes commands against a binder.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.ModuleWriter}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public class CommandReplayer {
 
   /**
diff --git a/src/com/google/inject/commands/ConvertToTypesCommand.java b/src/com/google/inject/commands/ConvertToTypesCommand.java
index 775d5fe..c059bdd 100644
--- a/src/com/google/inject/commands/ConvertToTypesCommand.java
+++ b/src/com/google/inject/commands/ConvertToTypesCommand.java
@@ -16,16 +16,19 @@
 
 package com.google.inject.commands;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import com.google.inject.TypeLiteral;
 import com.google.inject.matcher.Matcher;
 import com.google.inject.spi.TypeConverter;
-import static com.google.common.base.Preconditions.checkNotNull;
 
 /**
  * Immutable snapshot of a request to convert binder types.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.ConvertToTypes}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public final class ConvertToTypesCommand implements Command {
   private final Object source;
   private final Matcher<? super TypeLiteral<?>> typeMatcher;
diff --git a/src/com/google/inject/commands/DefaultCommandVisitor.java b/src/com/google/inject/commands/DefaultCommandVisitor.java
index 91139dd..85e8210 100644
--- a/src/com/google/inject/commands/DefaultCommandVisitor.java
+++ b/src/com/google/inject/commands/DefaultCommandVisitor.java
@@ -21,8 +21,11 @@
  * No-op visitor for subclassing. All interface methods simply delegate to
  * {@link #visitCommand(Command)}, returning its result.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.DefaultElementVisitor}
+ *
  * @author sberlin@gmail.com (Sam Berlin)
  */
+@Deprecated
 public class DefaultCommandVisitor<V> implements Command.Visitor<V> {
 
   protected DefaultCommandVisitor() {}
diff --git a/src/com/google/inject/commands/GetProviderCommand.java b/src/com/google/inject/commands/GetProviderCommand.java
index b702446..10fe03e 100644
--- a/src/com/google/inject/commands/GetProviderCommand.java
+++ b/src/com/google/inject/commands/GetProviderCommand.java
@@ -24,8 +24,11 @@
 /**
  * Immutable snapshot of a request for a provider.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.GetProvider}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public final class GetProviderCommand<T> implements Command {
   private final Object source;
   private final Key<T> key;
diff --git a/src/com/google/inject/commands/RequestInjectionCommand.java b/src/com/google/inject/commands/RequestInjectionCommand.java
index f47c799..351f0cf 100644
--- a/src/com/google/inject/commands/RequestInjectionCommand.java
+++ b/src/com/google/inject/commands/RequestInjectionCommand.java
@@ -23,8 +23,11 @@
 /**
  * Immutable snapshot of a request for injection.
  *
+ * @deprecated replaced with {@link com.google.inject.spi.RequestInjection}
+ *
  * @author mikeward@google.com (Mike Ward)
  */
+@Deprecated
 public final class RequestInjectionCommand implements Command {
   private Object source;
   private List<Object> instances;
diff --git a/src/com/google/inject/commands/RequestStaticInjectionCommand.java b/src/com/google/inject/commands/RequestStaticInjectionCommand.java
index b1ce316..e91c42e 100644
--- a/src/com/google/inject/commands/RequestStaticInjectionCommand.java
+++ b/src/com/google/inject/commands/RequestStaticInjectionCommand.java
@@ -24,8 +24,11 @@
 /**
  * Immutable snapshot of a request for static injection.
  * 
+ * @deprecated replaced with {@link com.google.inject.spi.RequestStaticInjection}
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
+@Deprecated
 public final class RequestStaticInjectionCommand implements Command {
   private final Object source;
   private final List<Class> types;
diff --git a/src/com/google/inject/spi/oldversion/BindingVisitor.java b/src/com/google/inject/spi/oldversion/BindingVisitor.java
index 8e5b0fa..3c2fc83 100644
--- a/src/com/google/inject/spi/oldversion/BindingVisitor.java
+++ b/src/com/google/inject/spi/oldversion/BindingVisitor.java
@@ -21,8 +21,11 @@
  * {@link OldVersionBinding#accept(BindingVisitor)} and the binding
  * will call back to the appropriate visitor method for its type.
  *
+ * @deprecated replaced with {@link com.google.inject.Binding.Visitor}
+ *
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface BindingVisitor<T> {
 
   /**
diff --git a/src/com/google/inject/spi/oldversion/ClassBinding.java b/src/com/google/inject/spi/oldversion/ClassBinding.java
index 4cf691d..4ba8a48 100644
--- a/src/com/google/inject/spi/oldversion/ClassBinding.java
+++ b/src/com/google/inject/spi/oldversion/ClassBinding.java
@@ -24,8 +24,12 @@
  *
  * <p>Example: {@code bind(Concrete.class);}
  *
+ * @deprecated replaced with {@link
+ * com.google.inject.Binding.TargetVisitor#visitConstructor(java.lang.reflect.Constructor)}
+ *
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface ClassBinding<T> extends OldVersionBinding<T>, HasInjections {
 
   /**
diff --git a/src/com/google/inject/spi/oldversion/ConstantBinding.java b/src/com/google/inject/spi/oldversion/ConstantBinding.java
index 8eaae7c..7b2cd8d 100644
--- a/src/com/google/inject/spi/oldversion/ConstantBinding.java
+++ b/src/com/google/inject/spi/oldversion/ConstantBinding.java
@@ -21,8 +21,12 @@
  *
  * <p>Example: {@code bindConstant().annotatedWith(PoolSize.class).to(5);}
  *
+ * @deprecated replaced with {@link
+ * com.google.inject.Binding.TargetVisitor#visitConstant(Object)}
+ *
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface ConstantBinding<T> extends OldVersionBinding<T> {
 
   /**
diff --git a/src/com/google/inject/spi/oldversion/ConvertedConstantBinding.java b/src/com/google/inject/spi/oldversion/ConvertedConstantBinding.java
index e1a6920..43e8910 100644
--- a/src/com/google/inject/spi/oldversion/ConvertedConstantBinding.java
+++ b/src/com/google/inject/spi/oldversion/ConvertedConstantBinding.java
@@ -19,8 +19,12 @@
 /**
  * A binding which was converted from a string contant.
  *
+ * @deprecated replaced with {@link
+ * com.google.inject.Binding.TargetVisitor#visitConvertedConstant(Object)}
+ *
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface ConvertedConstantBinding<T> extends ConstantBinding<T> {
 
   /**
diff --git a/src/com/google/inject/spi/oldversion/InstanceBinding.java b/src/com/google/inject/spi/oldversion/InstanceBinding.java
index c3733e9..844303e 100644
--- a/src/com/google/inject/spi/oldversion/InstanceBinding.java
+++ b/src/com/google/inject/spi/oldversion/InstanceBinding.java
@@ -23,8 +23,12 @@
  *
  * <p>Example: {@code bind(Runnable.class).toInstance(new MyRunnable());}
  *
+ * @deprecated replaced with {@link
+ * com.google.inject.Binding.TargetVisitor#visitToInstance(Object)}
+ *
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface InstanceBinding<T> extends OldVersionBinding<T>, HasInjections {
 
   /**
diff --git a/src/com/google/inject/spi/oldversion/LinkedBinding.java b/src/com/google/inject/spi/oldversion/LinkedBinding.java
index 598bc6d..dfe5cce 100644
--- a/src/com/google/inject/spi/oldversion/LinkedBinding.java
+++ b/src/com/google/inject/spi/oldversion/LinkedBinding.java
@@ -21,8 +21,12 @@
  *
  * <p>Example: {@code bind(Collection.class).to(List.class);}
  *
+ * @deprecated replaced with {@link
+ * com.google.inject.Binding.TargetVisitor#visitToKey(com.google.inject.Key)}
+ *
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface LinkedBinding<T> extends OldVersionBinding<T> {
 
   /**
diff --git a/src/com/google/inject/spi/oldversion/LinkedProviderBinding.java b/src/com/google/inject/spi/oldversion/LinkedProviderBinding.java
index fd676d9..4bb8043 100644
--- a/src/com/google/inject/spi/oldversion/LinkedProviderBinding.java
+++ b/src/com/google/inject/spi/oldversion/LinkedProviderBinding.java
@@ -24,8 +24,12 @@
  *
  * <p>Example: {@code bind(Foo.class).toProvider(FooProvider.class);}
  *
+ * @deprecated replaced with {@link
+ * com.google.inject.Binding.TargetVisitor#visitToProviderKey(com.google.inject.Key)}
+ *
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface LinkedProviderBinding<T> extends OldVersionBinding<T> {
 
   /**
diff --git a/src/com/google/inject/spi/oldversion/OldVersionBinding.java b/src/com/google/inject/spi/oldversion/OldVersionBinding.java
index a9bd79c..731f294 100644
--- a/src/com/google/inject/spi/oldversion/OldVersionBinding.java
+++ b/src/com/google/inject/spi/oldversion/OldVersionBinding.java
@@ -24,8 +24,11 @@
  * instances of that type.  This interface is part of the {@link com.google.inject.Injector}
  * introspection API and is intended primary for use by tools.
  *
+ * @deprecated replaced with {@link com.google.inject.Binding}
+ * 
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface OldVersionBinding<T> extends Binding<T> {
 
   /**
diff --git a/src/com/google/inject/spi/oldversion/ProviderBinding.java b/src/com/google/inject/spi/oldversion/ProviderBinding.java
index 9ab12f4..b12cc48 100644
--- a/src/com/google/inject/spi/oldversion/ProviderBinding.java
+++ b/src/com/google/inject/spi/oldversion/ProviderBinding.java
@@ -22,8 +22,12 @@
  * A synthetic binding to {@code Provider<T>} which exists for any binding to
  * {@code T}.
  *
+ * @deprecated replaced with {@link 
+ * com.google.inject.Binding.TargetVisitor#visitProviderBinding(com.google.inject.Key)}
+ *
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface ProviderBinding<T> extends OldVersionBinding<Provider<T>> {
 
   /**
diff --git a/src/com/google/inject/spi/oldversion/ProviderInstanceBinding.java b/src/com/google/inject/spi/oldversion/ProviderInstanceBinding.java
index e0ac6b0..ede4f43 100644
--- a/src/com/google/inject/spi/oldversion/ProviderInstanceBinding.java
+++ b/src/com/google/inject/spi/oldversion/ProviderInstanceBinding.java
@@ -24,8 +24,12 @@
  *
  * <p>Example: {@code bind(Foo.class).toProvider(new FooProvider());}
  *
+ * @deprecated replaced with {@link
+ * com.google.inject.Binding.TargetVisitor#visitToProvider(com.google.inject.Provider)}
+ *
  * @author crazybob@google.com (Bob Lee)
  */
+@Deprecated
 public interface ProviderInstanceBinding<T> extends OldVersionBinding<T>, HasInjections {
 
   /**
diff --git a/test/com/google/inject/commands/CommandRecorderTest.java b/test/com/google/inject/commands/CommandRecorderTest.java
deleted file mode 100644
index 4779a7e..0000000
--- a/test/com/google/inject/commands/CommandRecorderTest.java
+++ /dev/null
@@ -1,852 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.inject.commands;
-
-import com.google.inject.AbstractModule;
-import static com.google.inject.Asserts.assertContains;
-import com.google.inject.BindingAnnotation;
-import com.google.inject.Key;
-import com.google.inject.Module;
-import com.google.inject.Provider;
-import com.google.inject.Scopes;
-import com.google.inject.Singleton;
-import com.google.inject.TypeLiteral;
-import com.google.inject.binder.AnnotatedBindingBuilder;
-import com.google.inject.binder.AnnotatedConstantBindingBuilder;
-import com.google.inject.binder.ConstantBindingBuilder;
-import com.google.inject.binder.ScopedBindingBuilder;
-import com.google.inject.matcher.Matcher;
-import com.google.inject.matcher.Matchers;
-import com.google.inject.name.Names;
-import com.google.inject.spi.TypeConverter;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicInteger;
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-
-/**
- * @author jessewilson@google.com (Jesse Wilson)
- */
-public class CommandRecorderTest extends TestCase {
-
-  private CommandRecorder commandRecorder = new CommandRecorder();
-
-  // Binder fidelity tests
-
-  public void testAddMessageErrorCommand() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            addError("Message %s %d %s", "A", 5, "C");
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitAddMessage(AddMessageCommand command) {
-            assertEquals("Message A 5 C", command.getMessage().getMessage());
-            assertNull(command.getMessage().getCause());
-            assertTrue(command.getMessage().getInjectionPoints().isEmpty());
-            assertContains(command.getMessage().getSource(), "CommandRecorderTest.java");
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testAddThrowableErrorCommand() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            addError(new Exception("A"));
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitAddMessage(AddMessageCommand command) {
-            assertEquals("A", command.getMessage().getCause().getMessage());
-            assertEquals(command.getMessage().getMessage(),
-                "An exception was caught and reported. Message: A");
-            assertTrue(command.getMessage().getInjectionPoints().isEmpty());
-            assertContains(command.getMessage().getSource(), "CommandRecorderTest.java");
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testErrorsAddedWhenExceptionsAreThrown() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            install(new AbstractModule() {
-              protected void configure() {
-                throw new RuntimeException("Throwing RuntimeException in AbstractModule.configure().");
-              }
-            });
-
-            addError("Code after the exception still gets executed");
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitAddMessage(AddMessageCommand command) {
-            assertEquals("Throwing RuntimeException in AbstractModule.configure().",
-                command.getMessage().getCause().getMessage());
-            assertTrue(command.getMessage().getInjectionPoints().isEmpty());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitAddMessage(AddMessageCommand command) {
-            assertEquals("Code after the exception still gets executed",
-                command.getMessage().getMessage());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindConstantAnnotations() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bindConstant().annotatedWith(SampleAnnotation.class).to("A");
-            bindConstant().annotatedWith(Names.named("Bee")).to("B");
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(String.class, SampleAnnotation.class), command.getKey());
-            assertEquals("A", command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(String.class, Names.named("Bee")), command.getKey());
-            assertEquals("B", command.getTarget().get());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindConstantTypes() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bindConstant().annotatedWith(Names.named("String")).to("A");
-            bindConstant().annotatedWith(Names.named("int")).to(2);
-            bindConstant().annotatedWith(Names.named("long")).to(3L);
-            bindConstant().annotatedWith(Names.named("boolean")).to(false);
-            bindConstant().annotatedWith(Names.named("double")).to(5.0d);
-            bindConstant().annotatedWith(Names.named("float")).to(6.0f);
-            bindConstant().annotatedWith(Names.named("short")).to((short) 7);
-            bindConstant().annotatedWith(Names.named("char")).to('h');
-            bindConstant().annotatedWith(Names.named("Class")).to(Iterator.class);
-            bindConstant().annotatedWith(Names.named("Enum")).to(CoinSide.TAILS);
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(String.class, Names.named("String")), command.getKey());
-            assertEquals("A", command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(Integer.class, Names.named("int")), command.getKey());
-            assertEquals(2, command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(Long.class, Names.named("long")), command.getKey());
-            assertEquals(3L, command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(Boolean.class, Names.named("boolean")), command.getKey());
-            assertEquals(false, command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(Double.class, Names.named("double")), command.getKey());
-            assertEquals(5.0d, command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(Float.class, Names.named("float")), command.getKey());
-            assertEquals(6.0f, command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(Short.class, Names.named("short")), command.getKey());
-            assertEquals((short) 7, command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(Character.class, Names.named("char")), command.getKey());
-            assertEquals('h', command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(Class.class, Names.named("Class")), command.getKey());
-            assertEquals(Iterator.class, command.getTarget().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            assertEquals(Key.get(CoinSide.class, Names.named("Enum")), command.getKey());
-            assertEquals(CoinSide.TAILS, command.getTarget().get());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindKeysNoAnnotations() {
-    FailingVisitor keyChecker = new FailingVisitor() {
-      @Override public Void visitBind(BindCommand command) {
-        assertEquals(Key.get(String.class), command.getKey());
-        return null;
-      }
-    };
-
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bind(String.class).toInstance("A");
-            bind(new TypeLiteral<String>() {
-            }).toInstance("B");
-            bind(Key.get(String.class)).toInstance("C");
-          }
-        },
-        keyChecker,
-        keyChecker,
-        keyChecker
-    );
-  }
-
-  public void testBindKeysWithAnnotationType() {
-    FailingVisitor annotationChecker = new FailingVisitor() {
-      @Override public Void visitBind(BindCommand command) {
-        assertEquals(Key.get(String.class, SampleAnnotation.class), command.getKey());
-        return null;
-      }
-    };
-
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bind(String.class).annotatedWith(SampleAnnotation.class).toInstance("A");
-            bind(new TypeLiteral<String>() {
-            }).annotatedWith(SampleAnnotation.class).toInstance("B");
-          }
-        },
-        annotationChecker,
-        annotationChecker
-    );
-  }
-
-  public void testBindKeysWithAnnotationInstance() {
-    FailingVisitor annotationChecker = new FailingVisitor() {
-      @Override public Void visitBind(BindCommand command) {
-        assertEquals(Key.get(String.class, Names.named("a")), command.getKey());
-        return null;
-      }
-    };
-
-
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bind(String.class).annotatedWith(Names.named("a")).toInstance("B");
-            bind(new TypeLiteral<String>() {
-            }).annotatedWith(Names.named("a")).toInstance("C");
-          }
-        },
-        annotationChecker,
-        annotationChecker
-    );
-  }
-
-  public void testBindToProvider() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bind(String.class).toProvider(new Provider<String>() {
-              public String get() {
-                return "A";
-              }
-            });
-            bind(List.class).toProvider(ListProvider.class);
-            bind(Collection.class).toProvider(Key.get(ListProvider.class));
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(String.class), command.getKey());
-            assertEquals("A", command.getTarget().getProvider().get());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(List.class), command.getKey());
-            assertNull(command.getTarget().get());
-            assertEquals(Key.get(ListProvider.class), command.getTarget().getProviderKey());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(Collection.class), command.getKey());
-            assertNull(command.getTarget().get());
-            assertEquals(Key.get(ListProvider.class), command.getTarget().getProviderKey());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindToLinkedBinding() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bind(List.class).to(ArrayList.class);
-            bind(Map.class).to(new TypeLiteral<HashMap<Integer, String>>() { });
-            bind(Set.class).to(Key.get(TreeSet.class, SampleAnnotation.class));
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(List.class), command.getKey());
-            assertEquals(Key.get(ArrayList.class), command.getTarget().getKey());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(Map.class), command.getKey());
-            assertEquals(Key.get(new TypeLiteral<HashMap<Integer, String>>() {}), command.getTarget().getKey());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(Set.class), command.getKey());
-            assertEquals(Key.get(TreeSet.class, SampleAnnotation.class), command.getTarget().getKey());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindToInstance() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bind(String.class).toInstance("A");
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(String.class), command.getKey());
-            assertEquals("A", command.getTarget().get());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindInScopes() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bind(List.class).to(ArrayList.class).in(Scopes.SINGLETON);
-            bind(Map.class).to(HashMap.class).in(Singleton.class);
-            bind(Set.class).to(TreeSet.class).asEagerSingleton();
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(List.class), command.getKey());
-            assertEquals(Scopes.SINGLETON, command.getScoping().getScope());
-            assertNull(command.getScoping().getScopeAnnotation());
-            assertFalse(command.getScoping().isEagerSingleton());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(Map.class), command.getKey());
-            assertEquals(Singleton.class, command.getScoping().getScopeAnnotation());
-            assertNull(command.getScoping().getScope());
-            assertFalse(command.getScoping().isEagerSingleton());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            assertEquals(Key.get(Set.class), command.getKey());
-            assertNull(command.getScoping().getScopeAnnotation());
-            assertNull(command.getScoping().getScope());
-            assertTrue(command.getScoping().isEagerSingleton());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindIntercepor() {
-    final Matcher<Class> classMatcher = Matchers.subclassesOf(List.class);
-    final Matcher<Object> methodMatcher = Matchers.any();
-    final MethodInterceptor methodInterceptor = new MethodInterceptor() {
-      public Object invoke(MethodInvocation methodInvocation) {
-        return null;
-      }
-    };
-
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bindInterceptor(classMatcher, methodMatcher, methodInterceptor);
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindInterceptor(BindInterceptorCommand command) {
-            assertSame(classMatcher, command.getClassMatcher());
-            assertSame(methodMatcher, command.getMethodMatcher());
-            assertEquals(Arrays.asList(methodInterceptor), command.getInterceptors());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindScope() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            bindScope(SampleAnnotation.class, Scopes.NO_SCOPE);
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindScope(BindScopeCommand command) {
-            assertSame(SampleAnnotation.class, command.getAnnotationType());
-            assertSame(Scopes.NO_SCOPE, command.getScope());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testConvertToTypes() {
-    final TypeConverter typeConverter = new TypeConverter() {
-      public Object convert(String value, TypeLiteral<?> toType) {
-        return value;
-      }
-    };
-
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            convertToTypes(Matchers.any(), typeConverter);
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitConvertToTypes(ConvertToTypesCommand command) {
-            assertSame(typeConverter, command.getTypeConverter());
-            assertSame(Matchers.any(), command.getTypeMatcher());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testGetProvider() {
-    commandRecorder = new CommandRecorder();
-
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            Provider<String> keyGetProvider = getProvider(Key.get(String.class, SampleAnnotation.class));
-            try {
-              keyGetProvider.get();
-            } catch (IllegalStateException e) {
-              assertEquals("This provider cannot be used until the Injector has been created.",
-                  e.getMessage());
-            }
-
-            Provider<String> typeGetProvider = getProvider(String.class);
-            try {
-              typeGetProvider.get();
-            } catch (IllegalStateException e) {
-              assertEquals("This provider cannot be used until the Injector has been created.",
-                  e.getMessage());
-            }
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitGetProvider(GetProviderCommand command) {
-            assertEquals(Key.get(String.class, SampleAnnotation.class), command.getKey());
-            assertNull(command.getDelegate());
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitGetProvider(GetProviderCommand command) {
-            assertEquals(Key.get(String.class), command.getKey());
-            assertNull(command.getDelegate());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testRequestInjection() {
-    final Object firstObject = new Object();
-    final Object secondObject = new Object();
-
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            requestInjection(firstObject, secondObject);
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitRequestInjection(RequestInjectionCommand command) {
-            assertEquals(Arrays.asList(firstObject, secondObject), command.getInstances());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testRequestStaticInjection() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            requestStaticInjection(ArrayList.class);
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitRequestStaticInjection(RequestStaticInjectionCommand command) {
-            assertEquals(Arrays.asList(ArrayList.class), command.getTypes());
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindWithMultipleAnnotationsAddsError() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            AnnotatedBindingBuilder<String> abb = bind(String.class);
-            abb.annotatedWith(SampleAnnotation.class);
-            abb.annotatedWith(Names.named("A"));
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitAddMessage(AddMessageCommand command) {
-            assertEquals("More than one annotation is specified for this binding.",
-                command.getMessage().getMessage());
-            assertNull(command.getMessage().getCause());
-            assertTrue(command.getMessage().getInjectionPoints().isEmpty());
-            assertContains(command.getMessage().getSource(), "CommandRecorderTest.java");
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindWithMultipleTargetsAddsError() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            AnnotatedBindingBuilder<String> abb = bind(String.class);
-            abb.toInstance("A");
-            abb.toInstance("B");
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitAddMessage(AddMessageCommand command) {
-            assertEquals("Implementation is set more than once.",
-                command.getMessage().getMessage());
-            assertNull(command.getMessage().getCause());
-            assertTrue(command.getMessage().getInjectionPoints().isEmpty());
-            assertContains(command.getMessage().getSource(), "CommandRecorderTest.java");
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindWithMultipleScopesAddsError() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            ScopedBindingBuilder sbb = bind(List.class).to(ArrayList.class);
-            sbb.in(Scopes.NO_SCOPE);
-            sbb.asEagerSingleton();
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public <T> Void visitBind(BindCommand<T> command) {
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitAddMessage(AddMessageCommand command) {
-            assertEquals("Scope is set more than once.", command.getMessage().getMessage());
-            assertNull(command.getMessage().getCause());
-            assertTrue(command.getMessage().getInjectionPoints().isEmpty());
-            assertContains(command.getMessage().getSource(), "CommandRecorderTest.java");
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindConstantWithMultipleAnnotationsAddsError() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            AnnotatedConstantBindingBuilder cbb = bindConstant();
-            cbb.annotatedWith(SampleAnnotation.class).to("A");
-            cbb.annotatedWith(Names.named("A"));
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitAddMessage(AddMessageCommand command) {
-            assertEquals("More than one annotation is specified for this binding.",
-                command.getMessage().getMessage());
-            assertNull(command.getMessage().getCause());
-            assertTrue(command.getMessage().getInjectionPoints().isEmpty());
-            assertContains(command.getMessage().getSource(), "CommandRecorderTest.java");
-            return null;
-          }
-        }
-    );
-  }
-
-  public void testBindConstantWithMultipleTargetsAddsError() {
-    checkModule(
-        new AbstractModule() {
-          protected void configure() {
-            ConstantBindingBuilder cbb = bindConstant().annotatedWith(SampleAnnotation.class);
-            cbb.to("A");
-            cbb.to("B");
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitBindConstant(BindConstantCommand command) {
-            return null;
-          }
-        },
-
-        new FailingVisitor() {
-          @Override public Void visitAddMessage(AddMessageCommand command) {
-            assertEquals("Constant value is set more than once.",
-                command.getMessage().getMessage());
-            assertNull(command.getMessage().getCause());
-            assertTrue(command.getMessage().getInjectionPoints().isEmpty());
-            assertContains(command.getMessage().getSource(), "CommandRecorderTest.java");
-            return null;
-          }
-        }
-    );
-  }
-
-  // Business logic tests
-
-  public void testModulesAreInstalledAtMostOnce() {
-    final AtomicInteger aConfigureCount = new AtomicInteger(0);
-    final Module a = new AbstractModule() {
-      public void configure() {
-        aConfigureCount.incrementAndGet();
-      }
-    };
-
-    commandRecorder.recordCommands(a, a);
-    assertEquals(1, aConfigureCount.get());
-
-    aConfigureCount.set(0);
-    Module b = new AbstractModule() {
-      protected void configure() {
-        install(a);
-        install(a);
-      }
-    };
-
-    commandRecorder.recordCommands(b);
-    assertEquals(1, aConfigureCount.get());
-  }
-
-
-  /**
-   * Ensures the module performs the commands consistent with {@code visitors}.
-   */
-  protected void checkModule(Module module, Command.Visitor<?>... visitors) {
-    List<Command> commands = commandRecorder.recordCommands(module);
-
-    assertEquals(commands.size(), visitors.length);
-
-    for (int i = 0; i < visitors.length; i++) {
-      Command.Visitor<?> visitor = visitors[i];
-      Command command = commands.get(i);
-      assertContains(command.getSource().toString(), "CommandRecorderTest.java");
-      command.acceptVisitor(visitor);
-    }
-  }
-
-  private static class ListProvider implements Provider<List> {
-    public List get() {
-      return new ArrayList();
-    }
-  }
-
-  private static class FailingVisitor implements Command.Visitor<Void> {
-    public Void visitAddMessage(AddMessageCommand command) {
-      throw new AssertionFailedError();
-    }
-
-    public Void visitBindInterceptor(BindInterceptorCommand command) {
-      throw new AssertionFailedError();
-    }
-
-    public Void visitBindScope(BindScopeCommand command) {
-      throw new AssertionFailedError();
-    }
-
-    public Void visitRequestInjection(RequestInjectionCommand command) {
-      throw new AssertionFailedError();
-    }
-
-    public Void visitRequestStaticInjection(RequestStaticInjectionCommand command) {
-      throw new AssertionFailedError();
-    }
-
-    public Void visitBindConstant(BindConstantCommand command) {
-      throw new AssertionFailedError();
-    }
-
-    public Void visitConvertToTypes(ConvertToTypesCommand command) {
-      throw new AssertionFailedError();
-    }
-
-    public <T> Void visitBind(BindCommand<T> command) {
-      throw new AssertionFailedError();
-    }
-
-    public Void visitGetProvider(GetProviderCommand command) {
-      throw new AssertionFailedError();
-    }
-  }
-
-  @Retention(RUNTIME)
-  @Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
-  @BindingAnnotation
-  public @interface SampleAnnotation { }
-
-  public enum CoinSide { HEADS, TAILS }
-}
diff --git a/test/com/google/inject/commands/CommandReplayerTest.java b/test/com/google/inject/commands/CommandReplayerTest.java
deleted file mode 100644
index 7297743..0000000
--- a/test/com/google/inject/commands/CommandReplayerTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.inject.commands;
-
-import com.google.inject.Module;
-
-import java.util.List;
-
-
-/**
- * @author jessewilson@google.com (Jesse Wilson)
- */
-public class CommandReplayerTest extends CommandRecorderTest {
-
-  protected void checkModule(Module module, Command.Visitor<?>... visitors) {
-    // get some commands to replay
-    List<Command> commands = new CommandRecorder().recordCommands(module);
-
-    // replay the recorded commands, and record them again!
-    List<Command> replayedCommands = new CommandRecorder()
-        .recordCommands(new CommandReplayer().createModule(commands));
-
-    // verify that the replayed commands are as expected
-    assertEquals(replayedCommands.size(), visitors.length);
-    for (int i = 0; i < visitors.length; i++) {
-      Command.Visitor<?> visitor = visitors[i];
-      Command command = replayedCommands.get(i);
-      command.acceptVisitor(visitor);
-    }
-  }
-}
diff --git a/test/com/google/inject/commands/CommandRewriteTest.java b/test/com/google/inject/commands/CommandRewriteTest.java
deleted file mode 100644
index 44bb1ae..0000000
--- a/test/com/google/inject/commands/CommandRewriteTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.inject.commands;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Binder;
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.Module;
-import com.google.inject.Provider;
-import com.google.inject.name.Names;
-import java.util.List;
-import junit.framework.TestCase;
-
-
-/**
- * @author jessewilson@google.com (Jesse Wilson)
- */
-public class CommandRewriteTest extends TestCase {
-
-  public void testRewriteBindings() {
-    // create a module the binds String.class and CharSequence.class
-    Module module = new AbstractModule() {
-      protected void configure() {
-        bind(String.class).toInstance("Pizza");
-        bind(CharSequence.class).toInstance("Wine");
-      }
-    };
-
-    // record the commands from that module
-    CommandRecorder commandRecorder = new CommandRecorder();
-    List<Command> commands = commandRecorder.recordCommands(module);
-
-    // create a rewriter that rewrites the binding to 'Wine' with a binding to 'Beer'
-    CommandReplayer rewriter = new CommandReplayer() {
-      @Override public <T> void replayBind(Binder binder, BindCommand<T> command) {
-        if ("Wine".equals(command.getTarget().get())) {
-          binder.bind(CharSequence.class).toInstance("Beer");
-        } else {
-          super.replayBind(binder, command);
-        }
-      }
-    };
-
-    // create a module from the original list of commands and the rewriter
-    Module rewrittenModule = rewriter.createModule(commands);
-
-    // it all works
-    Injector injector = Guice.createInjector(rewrittenModule);
-    assertEquals("Pizza", injector.getInstance(String.class));
-    assertEquals("Beer", injector.getInstance(CharSequence.class));
-  }
-
-  public void testGetProviderAvailableAtInjectMembersTime() {
-    Module module = new AbstractModule() {
-      public void configure() {
-        final Provider<String> stringProvider = getProvider(String.class);
-
-        bind(String.class).annotatedWith(Names.named("2")).toProvider(new Provider<String>() {
-          private String value;
-
-          @Inject void initialize() {
-            value = stringProvider.get();
-          }
-
-          public String get() {
-            return value;
-          }
-        });
-
-        bind(String.class).toInstance("A");
-      }
-    };
-
-    // the module works fine normally
-    Injector injector = Guice.createInjector(module);
-    assertEquals("A", injector.getInstance(Key.get(String.class, Names.named("2"))));
-
-    // and it should also work fine if we rewrite it
-    List<Command> commands = new CommandRecorder().recordCommands(module);
-    Module replayed = new CommandReplayer().createModule(commands);
-    Injector replayedInjector = Guice.createInjector(replayed);
-    assertEquals("A", replayedInjector.getInstance(Key.get(String.class, Names.named("2"))));
-  }
-}