Source:
private void bindAutoBindSingleton(AutoBindSingleton annotation, Class<?> clazz) { LOG.info("Installing @AutoBindSingleton '{}'", clazz.getName()); LOG.info("***** @AutoBindSingleton for '{}' is deprecated soon.\nPlease use a Guice module with bind({}.class).asEagerSingleton(); instead", clazz.getName(), clazz.getSimpleName() ); Singleton singletonAnnotation = clazz.getAnnotation(Singleton.class); if (singletonAnnotation == null) { LOG.info("***** should also be annotation with @Singleton to ensure singleton behavior", clazz.getName()); } Class<?> annotationBaseClass = getAnnotationBaseClass(annotation); if ( annotationBaseClass != AutoBindSingleton.class ) { Object foundBindingClass = searchForBaseClass(clazz, annotationBaseClass, Sets.newHashSet()); if ( foundBindingClass == null ) { throw new IllegalArgumentException(String.format("AutoBindSingleton class %s does not implement or extend %s", clazz.getName(), annotationBaseClass.getName())); } if ( foundBindingClass instanceof Class ) { if ( annotation.multiple() ) { Multibinder<?> multibinder = Multibinder.newSetBinder(binder(), (Class)foundBindingClass); applyScope( multibinder .addBinding() .to((Class)clazz), clazz, annotation); } else { applyScope( binder() .withSource(getCurrentStackElement()) .bind((Class)foundBindingClass) .to(clazz), clazz, annotation); } } else if ( foundBindingClass instanceof Type ) { TypeLiteral typeLiteral = TypeLiteral.get((Type)foundBindingClass); if ( annotation.multiple() ) { Multibinder<?> multibinder = Multibinder.newSetBinder(binder(), typeLiteral); applyScope( multibinder .addBinding() .to((Class)clazz), clazz, annotation); } else { applyScope( binder() .withSource(getCurrentStackElement()) .bind(typeLiteral).to(clazz), clazz, annotation); } } else { throw new RuntimeException("Unexpected binding class: " + foundBindingClass); } } else { Preconditions.checkState(!annotation.multiple(), "@AutoBindSingleton(multiple=true) must have either value or baseClass set"); applyScope( binder() .withSource(getCurrentStackElement()) .bind(clazz), clazz, annotation); } }

Target:
private void bindAutoBindSingleton(AutoBindSingleton annotation, Class<?> clazz) { LOG.info("Installing @AutoBindSingleton '{}'", clazz.getName()); LOG.info("***** @AutoBindSingleton for '{}' is deprecated as of 2015-10-10.\nPlease use a Guice module with bind({}.class).asEagerSingleton() instead.\nSee <LINK_0>", clazz.getName(), clazz.getSimpleName() ); Singleton singletonAnnotation = clazz.getAnnotation(Singleton.class); if (singletonAnnotation == null) { LOG.info("***** should also be annotated with @Singleton to ensure singleton behavior", clazz.getName()); } Class<?> annotationBaseClass = getAnnotationBaseClass(annotation); if ( annotationBaseClass != AutoBindSingleton.class ) { Object foundBindingClass = searchForBaseClass(clazz, annotationBaseClass, Sets.newHashSet()); if ( foundBindingClass == null ) { throw new IllegalArgumentException(String.format("AutoBindSingleton class %s does not implement or extend %s", clazz.getName(), annotationBaseClass.getName())); } if ( foundBindingClass instanceof Class ) { if ( annotation.multiple() ) { Multibinder<?> multibinder = Multibinder.newSetBinder(binder(), (Class)foundBindingClass); applyScope( multibinder .addBinding() .to((Class)clazz), clazz, annotation); } else { applyScope( binder() .withSource(getCurrentStackElement()) .bind((Class)foundBindingClass) .to(clazz), clazz, annotation); } } else if ( foundBindingClass instanceof Type ) { TypeLiteral typeLiteral = TypeLiteral.get((Type)foundBindingClass); if ( annotation.multiple() ) { Multibinder<?> multibinder = Multibinder.newSetBinder(binder(), typeLiteral); applyScope( multibinder .addBinding() .to((Class)clazz), clazz, annotation); } else { applyScope( binder() .withSource(getCurrentStackElement()) .bind(typeLiteral).to(clazz), clazz, annotation); } } else { throw new RuntimeException("Unexpected binding class: " + foundBindingClass); } } else { Preconditions.checkState(!annotation.multiple(), "@AutoBindSingleton(multiple=true) must have either value or baseClass set"); applyScope( binder() .withSource(getCurrentStackElement()) .bind(clazz), clazz, annotation); } }