Program: 60437
Project: 60437
Buggy source:
private ScopedBindingBuilder toInternal(final Key<? extends CheckedProvider> targetKey){
  final Key<Result> resultKey=Key.get(Result.class,UniqueAnnotations.create());
  final Key<P> key=createKey();
  final Provider<Result> resultProvider=binder.getProvider(resultKey);
  final Provider<? extends CheckedProvider> targetProvider=binder.getProvider(targetKey);
  if (valid) {
    binder.bind(key).toProvider(new ProviderWithDependencies<P>(){
      private final P instance=interfaceType.cast(Proxy.newProxyInstance(interfaceType.getClassLoader(),new Class<?>[]{interfaceType},new InvocationHandler(){
        public Object invoke(        Object proxy,        Method method,        Object[] args) throws Throwable {
          return resultProvider.get().getOrThrow();
        }
      }
));
      public P get(){
        return instance;
      }
      public Set<Dependency<?>> getDependencies(){
        return ImmutableSet.<Dependency<?>>of(Dependency.get(resultKey));
      }
    }
);
  }
  return binder.bind(resultKey).toProvider(new ProviderWithDependencies<Result>(){
    public Result get(){
      try {
        return Result.forValue(targetProvider.get().get());
      }
 catch (      Exception e) {
        for (        Class<? extends Throwable> exceptionType : exceptionTypes) {
          if (exceptionType.isInstance(e)) {
            return Result.forException(e);
          }
        }
        if (e instanceof RuntimeException) {
          throw (RuntimeException)e;
        }
 else {
          throw new RuntimeException(e);
        }
      }
    }
    public Set<Dependency<?>> getDependencies(){
      return ImmutableSet.<Dependency<?>>of(Dependency.get(targetKey));
    }
  }
);
}

Fixed version (ground truth):
private ScopedBindingBuilder toInternal(final Key<? extends CheckedProvider> targetKey){
  final Key<Result> resultKey=Key.get(Result.class,UniqueAnnotations.create());
  final Provider<Result> resultProvider=binder.getProvider(resultKey);
  final Provider<? extends CheckedProvider> targetProvider=binder.getProvider(targetKey);
  interfaceKey=createKey();
  if (valid) {
    binder.bind(interfaceKey).toProvider(new ProviderWithDependencies<P>(){
      private final P instance=interfaceType.cast(Proxy.newProxyInstance(interfaceType.getClassLoader(),new Class<?>[]{interfaceType},new InvocationHandler(){
        public Object invoke(        Object proxy,        Method method,        Object[] args) throws Throwable {
          return resultProvider.get().getOrThrow();
        }
      }
));
      public P get(){
        return instance;
      }
      public Set<Dependency<?>> getDependencies(){
        return ImmutableSet.<Dependency<?>>of(Dependency.get(resultKey));
      }
    }
);
  }
  return binder.bind(resultKey).toProvider(new ProviderWithDependencies<Result>(){
    public Result get(){
      try {
        return Result.forValue(targetProvider.get().get());
      }
 catch (      Exception e) {
        for (        Class<? extends Throwable> exceptionType : exceptionTypes) {
          if (exceptionType.isInstance(e)) {
            return Result.forException(e);
          }
        }
        if (e instanceof RuntimeException) {
          throw (RuntimeException)e;
        }
 else {
          throw new RuntimeException(e);
        }
      }
    }
    public Set<Dependency<?>> getDependencies(){
      return ImmutableSet.<Dependency<?>>of(Dependency.get(targetKey));
    }
  }
);
}