Program: 29269
Project: 29269
Buggy source:
public ResourceConfig getResourceConfig(Set<Class<?>> classes,final ServerContext sc,final Habitat habitat,final Class<? extends Factory<Ref<Subject>>> subjectReferenceFactory) throws EndpointRegistrationException {
  final Reloader r=new Reloader();
  ResourceConfig rc=new ResourceConfig(classes);
  UriConnegFilter.enableFor(rc,getMimeMappings(),null);
  rc.addClasses(CsrfProtectionFilter.class);
  rc.addSingletons(r);
  rc.addClasses(ReloadResource.class);
  rc.addBinders(getJsonBinder(),new MultiPartBinder(),new AbstractBinder(){
    @Override protected void configure(){
      AbstractActiveDescriptor<Reloader> descriptor=BuilderHelper.createConstantDescriptor(r);
      descriptor.addContractType(Reloader.class);
      bind(descriptor);
      AbstractActiveDescriptor<ServerContext> scDescriptor=BuilderHelper.createConstantDescriptor(sc);
      scDescriptor.addContractType(ServerContext.class);
      bind(scDescriptor);
      AbstractActiveDescriptor<Habitat> hDescriptor=BuilderHelper.createConstantDescriptor(habitat);
      hDescriptor.addContractType(Habitat.class);
      bind(hDescriptor);
      RestSessionManager rsm=habitat.getService(RestSessionManager.class);
      AbstractActiveDescriptor<RestSessionManager> rmDescriptor=BuilderHelper.createConstantDescriptor(rsm);
      bind(rmDescriptor);
      bindFactory(subjectReferenceFactory).to(new TypeLiteral<Ref<Subject>>(){
      }
).in(PerLookup.class);
      bindFactory(ReferencingFactory.<Subject>referenceFactory()).to(new TypeLiteral<Ref<Subject>>(){
      }
).in(RequestScoped.class);
    }
  }
);
  rc.setProperty(MessageProperties.LEGACY_WORKERS_ORDERING,true);
  new RestConfigChangeListener(habitat,r,rc,sc);
  return rc;
}

Fixed version (ground truth):
@Override public ResourceConfig getResourceConfig(Set<Class<?>> classes,final ServerContext sc,final Habitat habitat,final Class<? extends Factory<Ref<Subject>>> subjectReferenceFactory) throws EndpointRegistrationException {
  final Reloader r=new Reloader();
  ResourceConfig rc=new ResourceConfig(classes);
  UriConnegFilter.enableFor(rc,getMimeMappings(),null);
  rc.addClasses(CsrfProtectionFilter.class);
  rc.addSingletons(r);
  rc.addClasses(ReloadResource.class);
  rc.addBinders(getJsonBinder(),new MultiPartBinder(),new AbstractBinder(){
    @Override protected void configure(){
      AbstractActiveDescriptor<Reloader> descriptor=BuilderHelper.createConstantDescriptor(r);
      descriptor.addContractType(Reloader.class);
      bind(descriptor);
      AbstractActiveDescriptor<ServerContext> scDescriptor=BuilderHelper.createConstantDescriptor(sc);
      scDescriptor.addContractType(ServerContext.class);
      bind(scDescriptor);
      AbstractActiveDescriptor<Habitat> hDescriptor=BuilderHelper.createConstantDescriptor(habitat);
      hDescriptor.addContractType(Habitat.class);
      bind(hDescriptor);
      RestSessionManager rsm=habitat.getService(RestSessionManager.class);
      AbstractActiveDescriptor<RestSessionManager> rmDescriptor=BuilderHelper.createConstantDescriptor(rsm);
      bind(rmDescriptor);
      bindFactory(subjectReferenceFactory).to(new TypeLiteral<Ref<Subject>>(){
      }
).in(PerLookup.class);
      bindFactory(ReferencingFactory.<Subject>referenceFactory()).to(new TypeLiteral<Ref<Subject>>(){
      }
).in(RequestScoped.class);
    }
  }
);
  rc.setProperty(MessageProperties.LEGACY_WORKERS_ORDERING,true);
  new RestConfigChangeListener(habitat,r,rc,sc);
  return rc;
}