nus-yam/ex-repair huggingface dataset:
Program: 60470
Project: 60470
Buggy source:
/** 
 * Safely gets the dependencies of possibly not initialized bindings. 
 */
@SuppressWarnings("String_Node_Str") private Set<Dependency<?>> getInternalDependencies(BindingImpl<?> binding){
  if (binding instanceof ConstructorBindingImpl) {
    return ((ConstructorBindingImpl)binding).getInternalDependencies();
  }
 else {
    return ((HasDependencies)binding).getDependencies();
  }
}

Fixed version (ground truth):
/** 
 * Safely gets the dependencies of possibly not initialized bindings. 
 */
@SuppressWarnings("String_Node_Str") private Set<Dependency<?>> getInternalDependencies(BindingImpl<?> binding){
  if (binding instanceof ConstructorBindingImpl) {
    return ((ConstructorBindingImpl)binding).getInternalDependencies();
  }
 else   if (binding instanceof HasDependencies) {
    return ((HasDependencies)binding).getDependencies();
  }
 else {
    return ImmutableSet.of();
  }
}
Program: 60471
Project: 60471
Buggy source:
/** 
 * When we're building the binding for A, we temporarily insert that binding to support circular dependencies. And so we can successfully create a binding for B. But later, when the binding for A ultimately fails, we need to clean up the dependent binding for B. The test loops through linked bindings & bindings with constructor & member injections, to make sure that all are cleaned up and traversed.  It also makes sure we don't touch explicit bindings.
 */
public void testCircularJitBindingsLeaveNoResidue(){
  Injector injector=Guice.createInjector(new AbstractModule(){
    @Override protected void configure(){
      bind(Valid.class);
      bind(Valid2.class);
    }
  }
);
  Binding v1=injector.getBinding(Valid.class);
  Binding v2=injector.getBinding(Valid2.class);
  Binding jv1=injector.getBinding(JitValid.class);
  Binding jv2=injector.getBinding(JitValid2.class);
  assertFailure(injector,Invalid.class);
  assertFailure(injector,InvalidLinked.class);
  assertFailure(injector,InvalidLinkedImpl.class);
  assertFailure(injector,InvalidLinked2.class);
  assertFailure(injector,InvalidLinked2Impl.class);
  assertFailure(injector,Invalid2.class);
  assertSame(v1,injector.getBinding(Valid.class));
  assertSame(v2,injector.getBinding(Valid2.class));
  assertSame(jv1,injector.getBinding(JitValid.class));
  assertSame(jv2,injector.getBinding(JitValid2.class));
}

Fixed version (ground truth):
/** 
 * When we're building the binding for A, we temporarily insert that binding to support circular dependencies. And so we can successfully create a binding for B. But later, when the binding for A ultimately fails, we need to clean up the dependent binding for B. The test loops through linked bindings & bindings with constructor & member injections, to make sure that all are cleaned up and traversed.  It also makes sure we don't touch explicit bindings.
 */
public void testCircularJitBindingsLeaveNoResidue(){
  Injector injector=Guice.createInjector(new AbstractModule(){
    @Override protected void configure(){
      bind(Valid.class);
      bind(Valid2.class);
    }
  }
);
  Binding v1=injector.getBinding(Valid.class);
  Binding v2=injector.getBinding(Valid2.class);
  Binding jv1=injector.getBinding(JitValid.class);
  Binding jv2=injector.getBinding(JitValid2.class);
  assertFailure(injector,Invalid.class);
  assertFailure(injector,InvalidLinked.class);
  assertFailure(injector,InvalidLinkedImpl.class);
  assertFailure(injector,InvalidLinked2.class);
  assertFailure(injector,InvalidLinked2Impl.class);
  assertFailure(injector,InvalidProvidedBy.class);
  assertFailure(injector,InvalidProvidedByProvider.class);
  assertFailure(injector,InvalidProvidedBy2.class);
  assertFailure(injector,InvalidProvidedBy2Provider.class);
  assertFailure(injector,Invalid2.class);
  assertSame(v1,injector.getBinding(Valid.class));
  assertSame(v2,injector.getBinding(Valid2.class));
  assertSame(jv1,injector.getBinding(JitValid.class));
  assertSame(jv2,injector.getBinding(JitValid2.class));
}
Program: 60473
Project: 60473
Buggy source:
@Override public boolean equals(Object obj){
  return obj instanceof Map.Entry && key.equals(((Map.Entry<?,?>)obj).getKey()) && value.equals(((Map.Entry<?,?>)obj).getValue());
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  return this.getClass() == obj.getClass() && equality.equals(((RealMapBinderProviderWithDependencies<?>)obj).equality);
}
Program: 60474
Project: 60474
Buggy source:
/** 
 * We tolerate duplicate bindings only if one exposes the other.
 * @param original the binding in the parent injector (candidate for an exposing binding)
 * @param binding the binding to check (candidate for the exposed binding)
 */
private boolean isOkayDuplicate(Binding<?> original,BindingImpl<?> binding){
  if (original instanceof ExposedBindingImpl) {
    ExposedBindingImpl exposed=(ExposedBindingImpl)original;
    InjectorImpl exposedFrom=(InjectorImpl)exposed.getPrivateElements().getInjector();
    return (exposedFrom == binding.getInjector());
  }
  return false;
}

Fixed version (ground truth):
/** 
 * We tolerate duplicate bindings if one exposes the other or if the two bindings are considered duplicates (see   {@link Bindings#areDuplicates(BindingImpl,BindingImpl)}. 
 * @param original the binding in the parent injector (candidate for an exposing binding)
 * @param binding the binding to check (candidate for the exposed binding)
 */
private boolean isOkayDuplicate(BindingImpl<?> original,BindingImpl<?> binding,State state){
  if (original instanceof ExposedBindingImpl) {
    ExposedBindingImpl exposed=(ExposedBindingImpl)original;
    InjectorImpl exposedFrom=(InjectorImpl)exposed.getPrivateElements().getInjector();
    return (exposedFrom == binding.getInjector());
  }
 else {
    original=(BindingImpl<?>)state.getExplicitBindingsThisLevel().get(binding.getKey());
    if (original == null) {
      return false;
    }
 else {
      return original.equals(binding);
    }
  }
}
Program: 60475
Project: 60475
Buggy source:
private void putBinding(BindingImpl<?> binding){
  Key<?> key=binding.getKey();
  Class<?> rawType=key.getTypeLiteral().getRawType();
  if (FORBIDDEN_TYPES.contains(rawType)) {
    errors.cannotBindToGuiceType(rawType.getSimpleName());
    return;
  }
  Binding<?> original=injector.state.getExplicitBinding(key);
  if (original != null && !isOkayDuplicate(original,binding)) {
    errors.bindingAlreadySet(key,original.getSource());
    return;
  }
  injector.state.parent().blacklist(key);
  injector.state.putBinding(key,binding);
}

Fixed version (ground truth):
private void putBinding(BindingImpl<?> binding){
  Key<?> key=binding.getKey();
  Class<?> rawType=key.getTypeLiteral().getRawType();
  if (FORBIDDEN_TYPES.contains(rawType)) {
    errors.cannotBindToGuiceType(rawType.getSimpleName());
    return;
  }
  BindingImpl<?> original=injector.state.getExplicitBinding(key);
  if (original != null) {
    try {
      if (!isOkayDuplicate(original,binding,injector.state)) {
        errors.bindingAlreadySet(key,original.getSource());
        return;
      }
    }
 catch (    Throwable t) {
      errors.errorCheckingDuplicateBinding(key,original.getSource(),t);
      return;
    }
  }
  injector.state.parent().blacklist(key);
  injector.state.putBinding(key,binding);
}
Program: 60479
Project: 60479
Buggy source:
@Override protected void configure(){
  bindScope(RequestScoped.class,REQUEST);
  bindScope(SessionScoped.class,SESSION);
  bind(ServletRequest.class).to(HttpServletRequest.class);
  bind(ServletResponse.class).to(HttpServletResponse.class);
  requestStaticInjection(GuiceFilter.class);
  bind(ManagedServletPipeline.class);
  bind(FilterPipeline.class).to(ManagedFilterPipeline.class).asEagerSingleton();
}

Fixed version (ground truth):
@Override protected void configure(){
  bindScope(RequestScoped.class,REQUEST);
  bindScope(SessionScoped.class,SESSION);
  bind(ServletRequest.class).to(HttpServletRequest.class);
  bind(ServletResponse.class).to(HttpServletResponse.class);
  requestStaticInjection(GuiceFilter.class);
  bind(ManagedFilterPipeline.class);
  bind(ManagedServletPipeline.class);
  bind(FilterPipeline.class).to(ManagedFilterPipeline.class).asEagerSingleton();
}
Program: 60480
Project: 60480
Buggy source:
/** 
 * Gets the strategy for an annotation type.
 */
static AnnotationStrategy strategyFor(Class<? extends Annotation> annotationType){
  checkNotNull(annotationType,"String_Node_Str");
  ensureRetainedAtRuntime(annotationType);
  ensureIsBindingAnnotation(annotationType);
  return new AnnotationTypeStrategy(annotationType,null);
}

Fixed version (ground truth):
/** 
 * Gets the strategy for an annotation type.
 */
static AnnotationStrategy strategyFor(Class<? extends Annotation> annotationType){
  checkNotNull(annotationType,"String_Node_Str");
  ensureRetainedAtRuntime(annotationType);
  ensureIsBindingAnnotation(annotationType);
  return new AnnotationTypeStrategy(Annotations.canonicalizeIfNamed(annotationType),null);
}
Program: 60481
Project: 60481
Buggy source:
/** 
 * If the annotation is an instance of   {@code javax.inject.Named} or {@code com.google.inject.name.Named}, return a canonicalized instance that will be equal to instances of either that have the same value. Returns the given annotation otherwise.
 */
public static Annotation canonicalizeIfNamed(Annotation annotation){
  if (annotation instanceof javax.inject.Named) {
    return Names.named(((javax.inject.Named)annotation).value());
  }
 else {
    return annotation;
  }
}

Fixed version (ground truth):
/** 
 * If the annotation is the class   {@code javax.inject.Named}, canonicalizes to com.google.guice.name.Named. Returns the given annotation class otherwise.
 */
public static Class<? extends Annotation> canonicalizeIfNamed(Class<? extends Annotation> annotationType){
  if (annotationType == javax.inject.Named.class) {
    return Named.class;
  }
 else {
    return annotationType;
  }
}
Program: 60482
Project: 60482
Buggy source:
public void testKeysCreatedWithDifferentTypesAreEqual(){
  assertEquals(keyForAnnotation(new GuiceNamed("String_Node_Str")),keyForAnnotation(new JsrNamed("String_Node_Str")));
  assertEquals(keyForAnnotation(Names.named("String_Node_Str")),keyForAnnotation(new GuiceNamed("String_Node_Str")));
  assertEquals(keyForAnnotation(Names.named("String_Node_Str")),keyForAnnotation(new JsrNamed("String_Node_Str")));
}

Fixed version (ground truth):
public void testKeysCreatedWithDifferentTypesAreEqual(){
  assertEquals(keyForAnnotation(new GuiceNamed("String_Node_Str")),keyForAnnotation(new JsrNamed("String_Node_Str")));
  assertEquals(keyForAnnotation(Names.named("String_Node_Str")),keyForAnnotation(new GuiceNamed("String_Node_Str")));
  assertEquals(keyForAnnotation(Names.named("String_Node_Str")),keyForAnnotation(new JsrNamed("String_Node_Str")));
  assertEquals(keyForAnnotationType(com.google.inject.name.Named.class),keyForAnnotationType(javax.inject.Named.class));
}
Program: 60483
Project: 60483
Buggy source:
<T>void initializeJitBinding(BindingImpl<T> binding,Errors errors) throws ErrorsException {
  if (binding instanceof ConstructorBindingImpl<?>) {
    Key<T> key=binding.getKey();
    jitBindings.put(key,binding);
    boolean successful=false;
    try {
      ((ConstructorBindingImpl)binding).initialize(this,errors);
      successful=true;
    }
  finally {
      if (!successful) {
        jitBindings.remove(key);
      }
    }
  }
}

Fixed version (ground truth):
<T>void initializeJitBinding(BindingImpl<T> binding,Errors errors) throws ErrorsException {
  if (binding instanceof ConstructorBindingImpl<?>) {
    Key<T> key=binding.getKey();
    jitBindings.put(key,binding);
    boolean successful=false;
    ConstructorBindingImpl cb=(ConstructorBindingImpl)binding;
    try {
      cb.initialize(this,errors);
      successful=true;
    }
  finally {
      if (!successful) {
        removeFailedJitBinding(key,null);
        cleanup(binding,new HashSet<Key>());
      }
    }
  }
}
Program: 60484
Project: 60484
Buggy source:
public Provided get(){
  return new Provided(){
    public void go(){
    }
  }
;
}

Fixed version (ground truth):
public String get(){
  return TEST_VALUE;
}
Program: 60485
Project: 60485
Buggy source:
/** 
 * When we're building the binding for A, we temporarily insert that binding to support circular dependencies. And so we can successfully create a binding for B. But later, when the binding for A ultimately fails, we need to clean up the dependent binding for B.
 */
public void testCircularJitBindingsLeaveNoResidue(){
  Injector injector=Guice.createInjector();
  try {
    injector.getBinding(A.class);
    fail();
  }
 catch (  ConfigurationException expected) {
  }
  try {
    injector.getBinding(B.class);
    fail();
  }
 catch (  ConfigurationException expected) {
  }
}

Fixed version (ground truth):
/** 
 * When we're building the binding for A, we temporarily insert that binding to support circular dependencies. And so we can successfully create a binding for B. But later, when the binding for A ultimately fails, we need to clean up the dependent binding for B. The test loops through linked bindings & bindings with constructor & member injections, to make sure that all are cleaned up and traversed.  It also makes sure we don't touch explicit bindings.
 */
public void testCircularJitBindingsLeaveNoResidue(){
  Injector injector=Guice.createInjector(new AbstractModule(){
    @Override protected void configure(){
      bind(Valid.class);
      bind(Valid2.class);
    }
  }
);
  Binding v1=injector.getBinding(Valid.class);
  Binding v2=injector.getBinding(Valid2.class);
  Binding jv1=injector.getBinding(JitValid.class);
  Binding jv2=injector.getBinding(JitValid2.class);
  assertFailure(injector,Invalid.class);
  assertFailure(injector,InvalidLinked.class);
  assertFailure(injector,InvalidLinkedImpl.class);
  assertFailure(injector,InvalidLinked2.class);
  assertFailure(injector,InvalidLinked2Impl.class);
  assertFailure(injector,Invalid2.class);
  assertSame(v1,injector.getBinding(Valid.class));
  assertSame(v2,injector.getBinding(Valid2.class));
  assertSame(jv1,injector.getBinding(JitValid.class));
  assertSame(jv2,injector.getBinding(JitValid2.class));
}
Program: 60486
Project: 60486
Buggy source:
protected void configure(){
  bind(I.class).to(AlternateImpl.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(String.class).toProvider(TestStringProvider.class);
}
Program: 60487
Project: 60487
Buggy source:
private static ClassLoader getClassLoader(Class<?> type,ClassLoader delegate){
  if (!CUSTOM_LOADER_ENABLED) {
    return delegate;
  }
  delegate=canonicalize(delegate);
  if (delegate == GUICE_CLASS_LOADER || delegate instanceof BridgeClassLoader) {
    return delegate;
  }
  if (Visibility.forType(type) == Visibility.PUBLIC) {
    if (delegate != SystemBridgeHolder.SYSTEM_BRIDGE.getParent()) {
      return CLASS_LOADER_CACHE.get(delegate);
    }
    return SystemBridgeHolder.SYSTEM_BRIDGE;
  }
  return delegate;
}

Fixed version (ground truth):
private static ClassLoader getClassLoader(Class<?> type,ClassLoader delegate){
  if (!CUSTOM_LOADER_ENABLED) {
    return delegate;
  }
  if (type.getName().startsWith("String_Node_Str")) {
    return GUICE_CLASS_LOADER;
  }
  delegate=canonicalize(delegate);
  if (delegate == GUICE_CLASS_LOADER || delegate instanceof BridgeClassLoader) {
    return delegate;
  }
  if (Visibility.forType(type) == Visibility.PUBLIC) {
    if (delegate != SystemBridgeHolder.SYSTEM_BRIDGE.getParent()) {
      return CLASS_LOADER_CACHE.get(delegate);
    }
    return SystemBridgeHolder.SYSTEM_BRIDGE;
  }
  return delegate;
}
Program: 60488
Project: 60488
Buggy source:
<T>ProviderMethod<T> createProviderMethod(Binder binder,final Method method){
  binder=binder.withSource(method);
  Errors errors=new Errors(method);
  List<Dependency<?>> dependencies=Lists.newArrayList();
  List<Provider<?>> parameterProviders=Lists.newArrayList();
  List<TypeLiteral<?>> parameterTypes=typeLiteral.getParameterTypes(method);
  Annotation[][] parameterAnnotations=method.getParameterAnnotations();
  for (int i=0; i < parameterTypes.size(); i++) {
    Key<?> key=getKey(errors,parameterTypes.get(i),method,parameterAnnotations[i]);
    dependencies.add(Dependency.get(key));
    parameterProviders.add(binder.getProvider(key));
  }
  @SuppressWarnings("String_Node_Str") TypeLiteral<T> returnType=(TypeLiteral<T>)typeLiteral.getReturnType(method);
  Key<T> key=getKey(errors,returnType,method,method.getAnnotations());
  Class<? extends Annotation> scopeAnnotation=Annotations.findScopeAnnotation(errors,method.getAnnotations());
  for (  Message message : errors.getMessages()) {
    binder.addError(message);
  }
  return new ProviderMethod<T>(key,method,delegate,ImmutableSet.copyOf(dependencies),parameterProviders,scopeAnnotation);
}

Fixed version (ground truth):
<T>ProviderMethod<T> createProviderMethod(Binder binder,final Method method){
  binder=binder.withSource(method);
  Errors errors=new Errors(method);
  List<Dependency<?>> dependencies=Lists.newArrayList();
  List<Provider<?>> parameterProviders=Lists.newArrayList();
  List<TypeLiteral<?>> parameterTypes=typeLiteral.getParameterTypes(method);
  Annotation[][] parameterAnnotations=method.getParameterAnnotations();
  for (int i=0; i < parameterTypes.size(); i++) {
    Key<?> key=getKey(errors,parameterTypes.get(i),method,parameterAnnotations[i]);
    if (key.equals(Key.get(Logger.class))) {
      Key<Logger> loggerKey=Key.get(Logger.class,UniqueAnnotations.create());
      binder.bind(loggerKey).toProvider(new LogProvider(method));
      key=loggerKey;
    }
    dependencies.add(Dependency.get(key));
    parameterProviders.add(binder.getProvider(key));
  }
  @SuppressWarnings("String_Node_Str") TypeLiteral<T> returnType=(TypeLiteral<T>)typeLiteral.getReturnType(method);
  Key<T> key=getKey(errors,returnType,method,method.getAnnotations());
  Class<? extends Annotation> scopeAnnotation=Annotations.findScopeAnnotation(errors,method.getAnnotations());
  for (  Message message : errors.getMessages()) {
    binder.addError(message);
  }
  return new ProviderMethod<T>(key,method,delegate,ImmutableSet.copyOf(dependencies),parameterProviders,scopeAnnotation);
}
Program: 60489
Project: 60489
Buggy source:
protected void configure(){
}

Fixed version (ground truth):
@Override protected void configure(){
}
Program: 60490
Project: 60490
Buggy source:
public T call(InternalContext context) throws ErrorsException {
  Dependency dependency=context.getDependency();
  return internalFactory.get(errors,context,dependency,false);
}

Fixed version (ground truth):
public T call(InternalContext context) throws ErrorsException {
  Dependency dependency=context.getDependency();
  return internalFactory.get(errors,context,dependency,true);
}
Program: 60491
Project: 60491
Buggy source:
public T get(){
  final Errors errors=new Errors();
  try {
    T t=injector.callInContext(new ContextualCallable<T>(){
      public T call(      InternalContext context) throws ErrorsException {
        Dependency dependency=context.getDependency();
        return internalFactory.get(errors,context,dependency,false);
      }
    }
);
    errors.throwIfNewErrors(0);
    return t;
  }
 catch (  ErrorsException e) {
    throw new ProvisionException(errors.merge(e.getErrors()).getMessages());
  }
}

Fixed version (ground truth):
public T get(){
  final Errors errors=new Errors();
  try {
    T t=injector.callInContext(new ContextualCallable<T>(){
      public T call(      InternalContext context) throws ErrorsException {
        Dependency dependency=context.getDependency();
        return internalFactory.get(errors,context,dependency,true);
      }
    }
);
    errors.throwIfNewErrors(0);
    return t;
  }
 catch (  ErrorsException e) {
    throw new ProvisionException(errors.merge(e.getErrors()).getMessages());
  }
}
Program: 60492
Project: 60492
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + Named.class.getName() + "String_Node_Str"+ value+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + delegate + "String_Node_Str";
}
Program: 60494
Project: 60494
Buggy source:
/** 
 * Creates an injector for the given set of modules, in a given development stage.
 * @throws CreationException if one or more errors occur during Injectorconstruction
 */
public static Injector createInjector(Stage stage,Iterable<? extends Module> modules){
  return new InjectorBuilder().stage(stage).addModules(modules).build();
}

Fixed version (ground truth):
/** 
 * Creates an injector for the given set of modules, in a given development stage.
 * @throws CreationException if one or more errors occur during Injectorconstruction
 */
public static Injector createInjector(Stage stage,Iterable<? extends Module> modules){
  return new InjectorBuilderImpl().stage(stage).addModules(modules).build();
}
Program: 60495
Project: 60495
Buggy source:
@SuppressWarnings("String_Node_Str") public T get(){
  if (instance == null) {
synchronized (InjectorBuilder.class) {
      if (instance == null) {
        T provided=creator.get();
        if (provided instanceof CircularDependencyProxy) {
          return provided;
        }
        Object providedOrSentinel=(provided == null) ? NULL : provided;
        if (instance != null && instance != providedOrSentinel) {
          throw new ProvisionException("String_Node_Str");
        }
        instance=providedOrSentinel;
      }
    }
  }
  Object localInstance=instance;
  @SuppressWarnings("String_Node_Str") T returnedInstance=(localInstance != NULL) ? (T)localInstance : null;
  return returnedInstance;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public T get(){
  if (instance == null) {
synchronized (InjectorBuilderImpl.class) {
      if (instance == null) {
        T provided=creator.get();
        if (provided instanceof CircularDependencyProxy) {
          return provided;
        }
        Object providedOrSentinel=(provided == null) ? NULL : provided;
        if (instance != null && instance != providedOrSentinel) {
          throw new ProvisionException("String_Node_Str");
        }
        instance=providedOrSentinel;
      }
    }
  }
  Object localInstance=instance;
  @SuppressWarnings("String_Node_Str") T returnedInstance=(localInstance != NULL) ? (T)localInstance : null;
  return returnedInstance;
}
Program: 60496
Project: 60496
Buggy source:
public T get(Errors errors,InternalContext context,Dependency<?> dependency) throws ErrorsException {
  errors=errors.withSource(providerKey);
  javax.inject.Provider<? extends T> provider=providerFactory.get(errors,context,dependency);
  try {
    return errors.checkForNull(provider.get(),source,dependency);
  }
 catch (  RuntimeException userException) {
    throw errors.errorInProvider(userException).toException();
  }
}

Fixed version (ground truth):
public T get(Errors errors,InternalContext context,Dependency<?> dependency,boolean linked) throws ErrorsException {
  errors=errors.withSource(providerKey);
  javax.inject.Provider<? extends T> provider=providerFactory.get(errors,context,dependency,true);
  try {
    return errors.checkForNull(provider.get(),source,dependency);
  }
 catch (  RuntimeException userException) {
    throw errors.errorInProvider(userException).toException();
  }
}
Program: 60497
Project: 60497
Buggy source:
public void notify(Errors errors){
  try {
    providerFactory=injector.getInternalFactory(providerKey,errors.withSource(source));
  }
 catch (  ErrorsException e) {
    errors.merge(e.getErrors());
  }
}

Fixed version (ground truth):
public void notify(Errors errors){
  try {
    providerFactory=injector.getInternalFactory(providerKey,errors.withSource(source),JitLimitation.NEW_OR_EXISTING_JIT);
  }
 catch (  ErrorsException e) {
    errors.merge(e.getErrors());
  }
}
Program: 60498
Project: 60498
Buggy source:
public T get(Errors errors,InternalContext context,Dependency dependency) throws ErrorsException {
  return initializable.get(errors);
}

Fixed version (ground truth):
public T get(Errors errors,InternalContext context,Dependency dependency,boolean linked) throws ErrorsException {
  return initializable.get(errors);
}
Program: 60499
Project: 60499
Buggy source:
public ConstructorBindingImpl(Key<T> key,Object source,Scoping scoping,InjectionPoint constructorInjectionPoint,Set<InjectionPoint> injectionPoints){
  super(source,key,scoping);
  this.factory=new Factory<T>();
  ConstructionProxy<T> constructionProxy=new DefaultConstructionProxyFactory<T>(constructorInjectionPoint).create();
  this.constructorInjectionPoint=constructorInjectionPoint;
  factory.constructorInjector=new ConstructorInjector<T>(injectionPoints,constructionProxy,null,null);
}

Fixed version (ground truth):
public ConstructorBindingImpl(Key<T> key,Object source,Scoping scoping,InjectionPoint constructorInjectionPoint,Set<InjectionPoint> injectionPoints){
  super(source,key,scoping);
  this.factory=new Factory<T>(false,key);
  ConstructionProxy<T> constructionProxy=new DefaultConstructionProxyFactory<T>(constructorInjectionPoint).create();
  this.constructorInjectionPoint=constructorInjectionPoint;
  factory.constructorInjector=new ConstructorInjector<T>(injectionPoints,constructionProxy,null,null);
}
Program: 60500
Project: 60500
Buggy source:
@SuppressWarnings("String_Node_Str") public T get(Errors errors,InternalContext context,Dependency<?> dependency) throws ErrorsException {
  checkState(constructorInjector != null,"String_Node_Str");
  return (T)constructorInjector.construct(errors,context,dependency.getKey().getTypeLiteral().getRawType());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public T get(Errors errors,InternalContext context,Dependency<?> dependency,boolean linked) throws ErrorsException {
  checkState(constructorInjector != null,"String_Node_Str");
  if (failIfNotLinked && !linked) {
    throw errors.jitDisabled(key).toException();
  }
  return (T)constructorInjector.construct(errors,context,dependency.getKey().getTypeLiteral().getRawType());
}
Program: 60502
Project: 60502
Buggy source:
public T get(Errors errors,InternalContext context,Dependency<?> dependency) throws ErrorsException {
  return delegate.getInternalFactory().get(errors,context,dependency);
}

Fixed version (ground truth):
public T get(Errors errors,InternalContext context,Dependency<?> dependency,boolean linked) throws ErrorsException {
  return delegate.getInternalFactory().get(errors,context,dependency,linked);
}
Program: 60503
Project: 60503
Buggy source:
public T get(Errors errors,InternalContext context,Dependency<?> dependency) throws ErrorsException {
  return targetFactory.get(errors.withSource(targetKey),context,dependency);
}

Fixed version (ground truth):
public T get(Errors errors,InternalContext context,Dependency<?> dependency,boolean linked) throws ErrorsException {
  return targetFactory.get(errors.withSource(targetKey),context,dependency,true);
}
Program: 60504
Project: 60504
Buggy source:
public void notify(final Errors errors){
  try {
    targetFactory=injector.getInternalFactory(targetKey,errors.withSource(source));
  }
 catch (  ErrorsException e) {
    errors.merge(e.getErrors());
  }
}

Fixed version (ground truth):
public void notify(final Errors errors){
  try {
    targetFactory=injector.getInternalFactory(targetKey,errors.withSource(source),JitLimitation.NEW_OR_EXISTING_JIT);
  }
 catch (  ErrorsException e) {
    errors.merge(e.getErrors());
  }
}
Program: 60505
Project: 60505
Buggy source:
/** 
 * Returns the Guice   {@link Key} for this parameter.
 */
public Object getValue(Injector injector){
  if (null == provider) {
synchronized (this) {
      if (null == provider) {
        provider=isProvider ? injector.getProvider(getBindingForType(getProvidedType(type))) : injector.getProvider(getPrimaryBindingKey());
      }
    }
  }
  return provider.get();
}

Fixed version (ground truth):
/** 
 * Returns the Guice   {@link Key} for this parameter.
 */
public Object getValue(Injector injector){
  if (null == provider) {
synchronized (this) {
      if (null == provider) {
        provider=isProvider ? injector.getProvider(getBindingForType(getProvidedType(type))) : injector.getProvider(getPrimaryBindingKey());
      }
    }
  }
  return isProvider ? provider : provider.get();
}
Program: 60506
Project: 60506
Buggy source:
@SuppressWarnings("String_Node_Str") protected void configure(){
  Binder binder=binder().withSource(method);
  int p=0;
  if (!data.optimized) {
    for (    Key<?> paramKey : data.paramTypes) {
      binder.bind((Key)paramKey).toProvider(Providers.of(args[p++]));
    }
  }
 else {
    for (    Key<?> paramKey : data.paramTypes) {
      binder.bind((Key)paramKey).toProvider(data.providers.get(p++));
    }
  }
  Constructor<?> constructor=data.constructor;
  if (injector.getExistingBinding(returnType) != null) {
    constructor=null;
  }
  TypeLiteral<?> implementation=collector.getBindings().get(returnType);
  if (implementation != null) {
    if (constructor == null) {
      binder.bind(assistedReturnType).to((TypeLiteral)implementation);
    }
 else {
      binder.bind(assistedReturnType).toConstructor((Constructor)constructor,(TypeLiteral)implementation);
    }
  }
 else {
    if (constructor == null) {
      binder.bind(assistedReturnType).to((Key)returnType);
    }
 else {
      binder.bind(assistedReturnType).toConstructor((Constructor)constructor);
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected void configure(){
  Binder binder=binder().withSource(method);
  int p=0;
  if (!data.optimized) {
    for (    Key<?> paramKey : data.paramTypes) {
      binder.bind((Key)paramKey).toProvider(Providers.of(args[p++]));
    }
  }
 else {
    for (    Key<?> paramKey : data.paramTypes) {
      binder.bind((Key)paramKey).toProvider(data.providers.get(p++));
    }
  }
  Constructor<?> constructor=data.constructor;
  if (injector.getExistingBinding(returnType) != null) {
    constructor=null;
  }
  TypeLiteral<?> implementation=collector.getBindings().get(returnType);
  if (implementation != null) {
    if (constructor == null) {
      binder.bind(assistedReturnType).to((TypeLiteral)implementation);
    }
 else {
      binder.bind(assistedReturnType).toConstructor((Constructor)constructor,(TypeLiteral)implementation);
    }
  }
 else {
    if (constructor == null) {
      binder.bind(assistedReturnType).to((Key)returnType);
    }
 else {
      binder.bind(assistedReturnType).toConstructor((Constructor)constructor,(TypeLiteral)returnType.getTypeLiteral());
    }
  }
}
Program: 60508
Project: 60508
Buggy source:
@Override protected void configure(){
  bind(Double.class).toInstance(5.0d);
  install(new FactoryModuleBuilder().build(VersatileCarFactory.class));
}

Fixed version (ground truth):
@Override protected void configure(){
  install(new FactoryModuleBuilder().build(new TypeLiteral<Foo.Factory<String>>(){
  }
));
}
Program: 60509
Project: 60509
Buggy source:
Mustang create(Color color);

Fixed version (ground truth):
Foo<E> create(Bar bar);
Program: 60510
Project: 60510
Buggy source:
public Void call(InternalContext context){
  context.setDependency(dependency);
  Errors errorsForBinding=errors.withSource(dependency);
  try {
    binding.getInternalFactory().get(errorsForBinding,context,dependency);
  }
 catch (  ErrorsException e) {
    errorsForBinding.merge(e.getErrors());
  }
 finally {
    context.setDependency(null);
  }
  return null;
}

Fixed version (ground truth):
public Void call(InternalContext context){
  Dependency previous=context.setDependency(dependency);
  Errors errorsForBinding=errors.withSource(dependency);
  try {
    binding.getInternalFactory().get(errorsForBinding,context,dependency);
  }
 catch (  ErrorsException e) {
    errorsForBinding.merge(e.getErrors());
  }
 finally {
    context.setDependency(previous);
  }
  return null;
}
Program: 60511
Project: 60511
Buggy source:
/** 
 * Loads eager singletons, or all singletons if we're in Stage.PRODUCTION. Bindings discovered while we're binding these singletons are not be eager.
 */
void loadEagerSingletons(InjectorImpl injector,Stage stage,final Errors errors){
  @SuppressWarnings("String_Node_Str") Set<BindingImpl<?>> candidateBindings=ImmutableSet.copyOf(Iterables.concat((Collection)injector.state.getExplicitBindingsThisLevel().values(),injector.jitBindings.values()));
  for (  final BindingImpl<?> binding : candidateBindings) {
    if (isEagerSingleton(injector,binding,stage)) {
      try {
        injector.callInContext(new ContextualCallable<Void>(){
          Dependency<?> dependency=Dependency.get(binding.getKey());
          public Void call(          InternalContext context){
            context.setDependency(dependency);
            Errors errorsForBinding=errors.withSource(dependency);
            try {
              binding.getInternalFactory().get(errorsForBinding,context,dependency);
            }
 catch (            ErrorsException e) {
              errorsForBinding.merge(e.getErrors());
            }
 finally {
              context.setDependency(null);
            }
            return null;
          }
        }
);
      }
 catch (      ErrorsException e) {
        throw new AssertionError();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads eager singletons, or all singletons if we're in Stage.PRODUCTION. Bindings discovered while we're binding these singletons are not be eager.
 */
void loadEagerSingletons(InjectorImpl injector,Stage stage,final Errors errors){
  @SuppressWarnings("String_Node_Str") Set<BindingImpl<?>> candidateBindings=ImmutableSet.copyOf(Iterables.concat((Collection)injector.state.getExplicitBindingsThisLevel().values(),injector.jitBindings.values()));
  for (  final BindingImpl<?> binding : candidateBindings) {
    if (isEagerSingleton(injector,binding,stage)) {
      try {
        injector.callInContext(new ContextualCallable<Void>(){
          Dependency<?> dependency=Dependency.get(binding.getKey());
          public Void call(          InternalContext context){
            Dependency previous=context.setDependency(dependency);
            Errors errorsForBinding=errors.withSource(dependency);
            try {
              binding.getInternalFactory().get(errorsForBinding,context,dependency);
            }
 catch (            ErrorsException e) {
              errorsForBinding.merge(e.getErrors());
            }
 finally {
              context.setDependency(previous);
            }
            return null;
          }
        }
);
      }
 catch (      ErrorsException e) {
        throw new AssertionError();
      }
    }
  }
}
Program: 60512
Project: 60512
Buggy source:
public T get(){
  final Errors errors=new Errors(dependency);
  try {
    T t=callInContext(new ContextualCallable<T>(){
      public T call(      InternalContext context) throws ErrorsException {
        context.setDependency(dependency);
        try {
          return factory.get(errors,context,dependency);
        }
  finally {
          context.setDependency(null);
        }
      }
    }
);
    errors.throwIfNewErrors(0);
    return t;
  }
 catch (  ErrorsException e) {
    throw new ProvisionException(errors.merge(e.getErrors()).getMessages());
  }
}

Fixed version (ground truth):
public T get(){
  final Errors errors=new Errors(dependency);
  try {
    T t=callInContext(new ContextualCallable<T>(){
      public T call(      InternalContext context) throws ErrorsException {
        Dependency previous=context.setDependency(dependency);
        try {
          return factory.get(errors,context,dependency);
        }
  finally {
          context.setDependency(previous);
        }
      }
    }
);
    errors.throwIfNewErrors(0);
    return t;
  }
 catch (  ErrorsException e) {
    throw new ProvisionException(errors.merge(e.getErrors()).getMessages());
  }
}
Program: 60513
Project: 60513
Buggy source:
<T>Provider<T> getProviderOrThrow(final Key<T> key,Errors errors) throws ErrorsException {
  final InternalFactory<? extends T> factory=getInternalFactory(key,errors);
  final Dependency<T> dependency=Dependency.get(key);
  return new Provider<T>(){
    public T get(){
      final Errors errors=new Errors(dependency);
      try {
        T t=callInContext(new ContextualCallable<T>(){
          public T call(          InternalContext context) throws ErrorsException {
            context.setDependency(dependency);
            try {
              return factory.get(errors,context,dependency);
            }
  finally {
              context.setDependency(null);
            }
          }
        }
);
        errors.throwIfNewErrors(0);
        return t;
      }
 catch (      ErrorsException e) {
        throw new ProvisionException(errors.merge(e.getErrors()).getMessages());
      }
    }
    @Override public String toString(){
      return factory.toString();
    }
  }
;
}

Fixed version (ground truth):
<T>Provider<T> getProviderOrThrow(final Key<T> key,Errors errors) throws ErrorsException {
  final InternalFactory<? extends T> factory=getInternalFactory(key,errors);
  final Dependency<T> dependency=Dependency.get(key);
  return new Provider<T>(){
    public T get(){
      final Errors errors=new Errors(dependency);
      try {
        T t=callInContext(new ContextualCallable<T>(){
          public T call(          InternalContext context) throws ErrorsException {
            Dependency previous=context.setDependency(dependency);
            try {
              return factory.get(errors,context,dependency);
            }
  finally {
              context.setDependency(previous);
            }
          }
        }
);
        errors.throwIfNewErrors(0);
        return t;
      }
 catch (      ErrorsException e) {
        throw new ProvisionException(errors.merge(e.getErrors()).getMessages());
      }
    }
    @Override public String toString(){
      return factory.toString();
    }
  }
;
}
Program: 60514
Project: 60514
Buggy source:
public T call(InternalContext context) throws ErrorsException {
  context.setDependency(dependency);
  try {
    return factory.get(errors,context,dependency);
  }
  finally {
    context.setDependency(null);
  }
}

Fixed version (ground truth):
public T call(InternalContext context) throws ErrorsException {
  Dependency previous=context.setDependency(dependency);
  try {
    return factory.get(errors,context,dependency);
  }
  finally {
    context.setDependency(previous);
  }
}
Program: 60515
Project: 60515
Buggy source:
public void setDependency(Dependency dependency){
  this.dependency=dependency;
}

Fixed version (ground truth):
public Dependency setDependency(Dependency dependency){
  Dependency previous=dependency;
  this.dependency=dependency;
  return previous;
}
Program: 60516
Project: 60516
Buggy source:
public void inject(Errors errors,InternalContext context,Object o){
  errors=errors.withSource(dependency);
  context.setDependency(dependency);
  try {
    Object value=factory.get(errors,context,dependency);
    field.set(o,value);
  }
 catch (  ErrorsException e) {
    errors.withSource(injectionPoint).merge(e.getErrors());
  }
catch (  IllegalAccessException e) {
    throw new AssertionError(e);
  }
 finally {
    context.setDependency(null);
  }
}

Fixed version (ground truth):
public void inject(Errors errors,InternalContext context,Object o){
  errors=errors.withSource(dependency);
  Dependency previous=context.setDependency(dependency);
  try {
    Object value=factory.get(errors,context,dependency);
    field.set(o,value);
  }
 catch (  ErrorsException e) {
    errors.withSource(injectionPoint).merge(e.getErrors());
  }
catch (  IllegalAccessException e) {
    throw new AssertionError(e);
  }
 finally {
    context.setDependency(previous);
  }
}
Program: 60517
Project: 60517
Buggy source:
private T inject(Errors errors,InternalContext context) throws ErrorsException {
  context.setDependency(dependency);
  try {
    return factory.get(errors.withSource(dependency),context,dependency);
  }
  finally {
    context.setDependency(null);
  }
}

Fixed version (ground truth):
private T inject(Errors errors,InternalContext context) throws ErrorsException {
  Dependency previous=context.setDependency(dependency);
  try {
    return factory.get(errors.withSource(dependency),context,dependency);
  }
  finally {
    context.setDependency(previous);
  }
}
Program: 60518
Project: 60518
Buggy source:
Dependency(InjectionPoint injectionPoint,Key<T> key,boolean nullable,int parameterIndex){
  this.injectionPoint=injectionPoint;
  this.key=key;
  this.nullable=nullable;
  this.parameterIndex=parameterIndex;
}

Fixed version (ground truth):
Dependency(InjectionPoint injectionPoint,Key<T> key,boolean nullable,int parameterIndex){
  this.injectionPoint=injectionPoint;
  this.key=checkNotNull(key,"String_Node_Str");
  this.nullable=nullable;
  this.parameterIndex=parameterIndex;
}
Program: 60519
Project: 60519
Buggy source:
protected void configure(){
  bindScope(CustomScoped.class,Scopes.NO_SCOPE);
}

Fixed version (ground truth):
protected void configure(){
  bind(B.class);
  bind(C.class);
  ProviderGetScope providerGetScope=new ProviderGetScope();
  requestInjection(providerGetScope);
  bindScope(CustomScoped.class,providerGetScope);
}
Program: 60520
Project: 60520
Buggy source:
public ProvidedBySingleton get(){
  return new ProvidedBySingleton();
}

Fixed version (ground truth):
public T get(){
  bProvider.get();
  return unscoped.get();
}
Program: 60521
Project: 60521
Buggy source:
public <T>Provider<T> scope(Key<T> key,Provider<T> unscoped){
  providers.put(key,unscoped);
  return unscoped;
}

Fixed version (ground truth):
public <T>Provider<T> scope(Key<T> key,final Provider<T> unscoped){
  return new Provider<T>(){
    public T get(){
      bProvider.get();
      return unscoped.get();
    }
  }
;
}
Program: 60522
Project: 60522
Buggy source:
<T>void initializeBinding(BindingImpl<T> binding,Errors errors) throws ErrorsException {
  if (binding instanceof ConstructorBindingImpl<?>) {
    Key<T> key=binding.getKey();
    jitBindings.put(key,binding);
    boolean successful=false;
    try {
      ((ConstructorBindingImpl)binding).initialize(this,errors);
      successful=true;
    }
  finally {
      if (!successful) {
        jitBindings.remove(key);
      }
    }
  }
}

Fixed version (ground truth):
<T>void initializeBinding(BindingImpl<T> binding,Errors errors) throws ErrorsException {
  if (binding instanceof ConstructorBindingImpl<?>) {
    ((ConstructorBindingImpl)binding).initialize(this,errors);
  }
}
Program: 60524
Project: 60524
Buggy source:
protected void configure(){
  bind(D.class).toInstance(new D(Stage.PRODUCTION));
  bind(Object.class).to(D.class);
  getProvider(new Key<C<Stage>>(){
  }
);
}

Fixed version (ground truth):
protected void configure(){
  bind(F.class);
}
Program: 60525
Project: 60525
Buggy source:
public List get(){
  return new ArrayList();
}

Fixed version (ground truth):
public T get(){
  return null;
}
Program: 60528
Project: 60528
Buggy source:
@Provides @Named("String_Node_Str") String provideFoo(){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Provides void provideFoo(){
}
Program: 60529
Project: 60529
Buggy source:
@Override protected void configure(){
  install(ProviderMethodsModule.forObject(methodsObject));
}

Fixed version (ground truth):
protected void configure(){
}
Program: 60530
Project: 60530
Buggy source:
public void testMultipleBindingAnnotations(){
  try {
    Guice.createInjector(new AbstractModule(){
      protected void configure(){
      }
      @Provides @Named("String_Node_Str") @Blue public String provideString(){
        return "String_Node_Str";
      }
    }
);
    fail();
  }
 catch (  CreationException expected) {
    Asserts.assertContains(expected.getMessage(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + getClass().getName(),"String_Node_Str");
  }
}

Fixed version (ground truth):
public void testMultipleBindingAnnotations(){
  try {
    Guice.createInjector(new AbstractModule(){
      protected void configure(){
      }
      @Provides @Named("String_Node_Str") @Blue public String provideString(){
        return "String_Node_Str";
      }
    }
);
    fail();
  }
 catch (  CreationException expected) {
    assertContains(expected.getMessage(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + getClass().getName(),"String_Node_Str");
  }
}
Program: 60531
Project: 60531
Buggy source:
public WildcardTypeImpl(Type[] upperBounds,Type[] lowerBounds){
  checkArgument(upperBounds.length <= 1,"String_Node_Str");
  checkArgument(upperBounds.length == 1,"String_Node_Str");
  if (lowerBounds.length == 1) {
    checkNotNull(lowerBounds[0],"String_Node_Str");
    checkNotPrimitive(lowerBounds[0],"String_Node_Str");
    checkArgument(upperBounds[0] == Object.class,"String_Node_Str");
    this.lowerBound=canonicalize(lowerBounds[0]);
    this.upperBound=Object.class;
  }
 else {
    checkNotNull(upperBounds[0],"String_Node_Str");
    checkNotPrimitive(upperBounds[0],"String_Node_Str");
    this.lowerBound=null;
    this.upperBound=canonicalize(upperBounds[0]);
  }
}

Fixed version (ground truth):
public WildcardTypeImpl(Type[] upperBounds,Type[] lowerBounds){
  checkArgument(lowerBounds.length <= 1,"String_Node_Str");
  checkArgument(upperBounds.length == 1,"String_Node_Str");
  if (lowerBounds.length == 1) {
    checkNotNull(lowerBounds[0],"String_Node_Str");
    checkNotPrimitive(lowerBounds[0],"String_Node_Str");
    checkArgument(upperBounds[0] == Object.class,"String_Node_Str");
    this.lowerBound=canonicalize(lowerBounds[0]);
    this.upperBound=Object.class;
  }
 else {
    checkNotNull(upperBounds[0],"String_Node_Str");
    checkNotPrimitive(upperBounds[0],"String_Node_Str");
    this.lowerBound=null;
    this.upperBound=canonicalize(upperBounds[0]);
  }
}
Program: 60533
Project: 60533
Buggy source:
public void addError(Message message){
  errors.addMessage(message);
}

Fixed version (ground truth):
public void addError(Message message){
  checkState(valid,"String_Node_Str");
  errors.addMessage(message);
}
Program: 60534
Project: 60534
Buggy source:
public void bindInterceptor(Matcher<? super Method> methodMatcher,MethodInterceptor... interceptors){
  if (aspects == null) {
    aspects=Lists.newArrayList();
  }
  aspects.add(new MethodAspect(Matchers.any(),methodMatcher,interceptors));
}

Fixed version (ground truth):
public void bindInterceptor(Matcher<? super Method> methodMatcher,MethodInterceptor... interceptors){
  checkState(valid,"String_Node_Str");
  if (aspects == null) {
    aspects=Lists.newArrayList();
  }
  aspects.add(new MethodAspect(Matchers.any(),methodMatcher,interceptors));
}
Program: 60535
Project: 60535
Buggy source:
@SuppressWarnings("String_Node_Str") public void register(InjectionListener<? super T> injectionListener){
  if (injectionListeners == null) {
    injectionListeners=Lists.newArrayList();
  }
  injectionListeners.add(injectionListener);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void register(InjectionListener<? super T> injectionListener){
  checkState(valid,"String_Node_Str");
  if (injectionListeners == null) {
    injectionListeners=Lists.newArrayList();
  }
  injectionListeners.add(injectionListener);
}