* public class MyModule extends AbstractModule { @@ -54,84 +52,63 @@ Binder binder; + @Override public final synchronized void configure(Binder builder) { checkState(this.binder == null, "Re-entry is not allowed."); this.binder = checkNotNull(builder, "builder"); try { configure(); - } - finally { + } finally { this.binder = null; } } - /** - * Configures a {@link Binder} via the exposed methods. - */ - protected abstract void configure(); + /** Configures a {@link Binder} via the exposed methods. */ + protected void configure() {} - /** - * Gets direct access to the underlying {@code Binder}. - */ + /** Gets direct access to the underlying {@code Binder}. */ protected Binder binder() { checkState(binder != null, "The binder can only be used inside configure()"); return binder; } - /** - * @see Binder#bindScope(Class, Scope) - */ - protected void bindScope(Class extends Annotation> scopeAnnotation, - Scope scope) { + /** @see Binder#bindScope(Class, Scope) */ + protected void bindScope(Class extends Annotation> scopeAnnotation, Scope scope) { binder().bindScope(scopeAnnotation, scope); } - /** - * @see Binder#bind(Key) - */ + /** @see Binder#bind(Key) */ protected* + *LinkedBindingBuilder bind(Key key) { return binder().bind(key); } - /** - * @see Binder#bind(TypeLiteral) - */ + /** @see Binder#bind(TypeLiteral) */ protected AnnotatedBindingBuilder bind(TypeLiteral typeLiteral) { return binder().bind(typeLiteral); } - /** - * @see Binder#bind(Class) - */ + /** @see Binder#bind(Class) */ protected AnnotatedBindingBuilder bind(Class clazz) { return binder().bind(clazz); } - /** - * @see Binder#bindConstant() - */ + /** @see Binder#bindConstant() */ protected AnnotatedConstantBindingBuilder bindConstant() { return binder().bindConstant(); } - /** - * @see Binder#install(Module) - */ + /** @see Binder#install(Module) */ protected void install(Module module) { binder().install(module); } - /** - * @see Binder#addError(String, Object[]) - */ + /** @see Binder#addError(String, Object[]) */ protected void addError(String message, Object... arguments) { binder().addError(message, arguments); } - /** - * @see Binder#addError(Throwable) - */ + /** @see Binder#addError(Throwable) */ protected void addError(Throwable t) { binder().addError(t); } @@ -152,9 +129,7 @@ binder().requestInjection(instance); } - /** - * @see Binder#requestStaticInjection(Class[]) - */ + /** @see Binder#requestStaticInjection(Class[]) */ protected void requestStaticInjection(Class>... types) { binder().requestStaticInjection(types); } @@ -162,10 +137,10 @@ /*if[AOP]*/ /** * @see Binder#bindInterceptor(com.google.inject.matcher.Matcher, - * com.google.inject.matcher.Matcher, - * org.aopalliance.intercept.MethodInterceptor[]) + * com.google.inject.matcher.Matcher, org.aopalliance.intercept.MethodInterceptor[]) */ - protected void bindInterceptor(Matcher super Class>> classMatcher, + protected void bindInterceptor( + Matcher super Class>> classMatcher, Matcher super Method> methodMatcher, org.aopalliance.intercept.MethodInterceptor... interceptors) { binder().bindInterceptor(classMatcher, methodMatcher, interceptors); @@ -173,10 +148,9 @@ /*end[AOP]*/ /** - * Adds a dependency from this module to {@code key}. When the injector is - * created, Guice will report an error if {@code key} cannot be injected. - * Note that this requirement may be satisfied by implicit binding, such as - * a public no-arguments constructor. + * Adds a dependency from this module to {@code key}. When the injector is created, Guice will + * report an error if {@code key} cannot be injected. Note that this requirement may be satisfied + * by implicit binding, such as a public no-arguments constructor. * * @since 2.0 */ @@ -185,10 +159,9 @@ } /** - * Adds a dependency from this module to {@code type}. When the injector is - * created, Guice will report an error if {@code type} cannot be injected. - * Note that this requirement may be satisfied by implicit binding, such as - * a public no-arguments constructor. + * Adds a dependency from this module to {@code type}. When the injector is created, Guice will + * report an error if {@code type} cannot be injected. Note that this requirement may be satisfied + * by implicit binding, such as a public no-arguments constructor. * * @since 2.0 */ @@ -216,13 +189,13 @@ * @see Binder#convertToTypes * @since 2.0 */ - protected void convertToTypes(Matcher super TypeLiteral>> typeMatcher, - TypeConverter converter) { + protected void convertToTypes( + Matcher super TypeLiteral>> typeMatcher, TypeConverter converter) { binder().convertToTypes(typeMatcher, converter); } /** - * @see Binder#currentStage() + * @see Binder#currentStage() * @since 2.0 */ protected Stage currentStage() { @@ -246,21 +219,19 @@ } /** - * @see Binder#bindListener(com.google.inject.matcher.Matcher, - * com.google.inject.spi.TypeListener) + * @see Binder#bindListener(com.google.inject.matcher.Matcher, com.google.inject.spi.TypeListener) * @since 2.0 */ - protected void bindListener(Matcher super TypeLiteral>> typeMatcher, - TypeListener listener) { + protected void bindListener(Matcher super TypeLiteral>> typeMatcher, TypeListener listener) { binder().bindListener(typeMatcher, listener); } - + /** * @see Binder#bindListener(Matcher, ProvisionListener...) * @since 4.0 */ - protected void bindListener(Matcher super Binding>> bindingMatcher, - ProvisionListener... listener) { + protected void bindListener( + Matcher super Binding>> bindingMatcher, ProvisionListener... listener) { binder().bindListener(bindingMatcher, listener); } } diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/binder/AnnotatedBindingBuilder.java sisu-guice-4.2.0/core/src/com/google/inject/binder/AnnotatedBindingBuilder.java --- sisu-guice-3.2.6/core/src/com/google/inject/binder/AnnotatedBindingBuilder.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/binder/AnnotatedBindingBuilder.java 2018-04-03 18:18:08.000000000 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,14 +25,9 @@ */ public interface AnnotatedBindingBuilder extends LinkedBindingBuilder { - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ - LinkedBindingBuilder annotatedWith( - Class extends Annotation> annotationType); + /** See the EDSL examples at {@link com.google.inject.Binder}. */ + LinkedBindingBuilder annotatedWith(Class extends Annotation> annotationType); - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ LinkedBindingBuilder annotatedWith(Annotation annotation); } diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/binder/AnnotatedConstantBindingBuilder.java sisu-guice-4.2.0/core/src/com/google/inject/binder/AnnotatedConstantBindingBuilder.java --- sisu-guice-3.2.6/core/src/com/google/inject/binder/AnnotatedConstantBindingBuilder.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/binder/AnnotatedConstantBindingBuilder.java 2018-04-03 18:18:08.000000000 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,14 +25,9 @@ */ public interface AnnotatedConstantBindingBuilder { - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ - ConstantBindingBuilder annotatedWith( - Class extends Annotation> annotationType); + /** See the EDSL examples at {@link com.google.inject.Binder}. */ + ConstantBindingBuilder annotatedWith(Class extends Annotation> annotationType); - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ ConstantBindingBuilder annotatedWith(Annotation annotation); } diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/binder/AnnotatedElementBuilder.java sisu-guice-4.2.0/core/src/com/google/inject/binder/AnnotatedElementBuilder.java --- sisu-guice-3.2.6/core/src/com/google/inject/binder/AnnotatedElementBuilder.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/binder/AnnotatedElementBuilder.java 2018-04-03 18:18:08.000000000 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,13 +26,9 @@ */ public interface AnnotatedElementBuilder { - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ void annotatedWith(Class extends Annotation> annotationType); - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ void annotatedWith(Annotation annotation); } diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/binder/ConstantBindingBuilder.java sisu-guice-4.2.0/core/src/com/google/inject/binder/ConstantBindingBuilder.java --- sisu-guice-3.2.6/core/src/com/google/inject/binder/ConstantBindingBuilder.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/binder/ConstantBindingBuilder.java 2018-04-03 18:18:08.000000000 +0000 @@ -16,65 +16,43 @@ package com.google.inject.binder; -/** - * Binds to a constant value. - */ +/** Binds to a constant value. */ public interface ConstantBindingBuilder { - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ void to(String value); - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ void to(int value); - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ void to(long value); - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ void to(boolean value); - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ void to(double value); - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ void to(float value); - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ void to(short value); - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ void to(char value); /** * Binds constant to the given value. - * + * * @since 3.0 */ void to(byte value); - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ void to(Class> value); - /** - * Binds constant to the given value. - */ + /** Binds constant to the given value. */ > void to(E value); } diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/binder/LinkedBindingBuilder.java sisu-guice-4.2.0/core/src/com/google/inject/binder/LinkedBindingBuilder.java --- sisu-guice-3.2.6/core/src/com/google/inject/binder/LinkedBindingBuilder.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/binder/LinkedBindingBuilder.java 2018-04-03 18:18:08.000000000 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,6 @@ import com.google.inject.Key; import com.google.inject.Provider; import com.google.inject.TypeLiteral; - import java.lang.reflect.Constructor; /** @@ -29,19 +28,13 @@ */ public interface LinkedBindingBuilder extends ScopedBindingBuilder { - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ ScopedBindingBuilder to(Class extends T> implementation); - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ ScopedBindingBuilder to(TypeLiteral extends T> implementation); - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ ScopedBindingBuilder to(Key extends T> targetKey); /** @@ -57,7 +50,7 @@ * @see com.google.inject.Injector#injectMembers */ ScopedBindingBuilder toProvider(Provider extends T> provider); - + /** * See the EDSL examples at {@link com.google.inject.Binder}. * @@ -66,34 +59,26 @@ */ ScopedBindingBuilder toProvider(javax.inject.Provider extends T> provider); - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ - ScopedBindingBuilder toProvider( - Class extends javax.inject.Provider extends T>> providerType); + /** See the EDSL examples at {@link com.google.inject.Binder}. */ + ScopedBindingBuilder toProvider(Class extends javax.inject.Provider extends T>> providerType); - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ ScopedBindingBuilder toProvider( TypeLiteral extends javax.inject.Provider extends T>> providerType); - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ - ScopedBindingBuilder toProvider( - Key extends javax.inject.Provider extends T>> providerKey); + /** See the EDSL examples at {@link com.google.inject.Binder}. */ + ScopedBindingBuilder toProvider(Key extends javax.inject.Provider extends T>> providerKey); /** * See the EDSL examples at {@link com.google.inject.Binder}. - * + * * @since 3.0 */ ScopedBindingBuilder toConstructor(Constructorconstructor); /** * See the EDSL examples at {@link com.google.inject.Binder}. - * + * * @since 3.0 */ScopedBindingBuilder toConstructor( diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/binder/package-info.java sisu-guice-4.2.0/core/src/com/google/inject/binder/package-info.java --- sisu-guice-3.2.6/core/src/com/google/inject/binder/package-info.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/binder/package-info.java 2018-04-03 18:18:08.000000000 +0000 @@ -14,8 +14,5 @@ * limitations under the License. */ -/** - * Interfaces which make up {@link com.google.inject.Binder}'s - * expression language. - */ -package com.google.inject.binder; \ No newline at end of file +/** Interfaces which make up {@link com.google.inject.Binder}'s expression language. */ +package com.google.inject.binder; diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/binder/ScopedBindingBuilder.java sisu-guice-4.2.0/core/src/com/google/inject/binder/ScopedBindingBuilder.java --- sisu-guice-3.2.6/core/src/com/google/inject/binder/ScopedBindingBuilder.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/binder/ScopedBindingBuilder.java 2018-04-03 18:18:08.000000000 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,6 @@ package com.google.inject.binder; import com.google.inject.Scope; - import java.lang.annotation.Annotation; /** @@ -27,20 +26,15 @@ */ public interface ScopedBindingBuilder { - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ void in(Class extends Annotation> scopeAnnotation); - /** - * See the EDSL examples at {@link com.google.inject.Binder}. - */ + /** See the EDSL examples at {@link com.google.inject.Binder}. */ void in(Scope scope); /** - * Instructs the {@link com.google.inject.Injector} to eagerly initialize this - * singleton-scoped binding upon creation. Useful for application - * initialization logic. See the EDSL examples at + * Instructs the {@link com.google.inject.Injector} to eagerly initialize this singleton-scoped + * binding upon creation. Useful for application initialization logic. See the EDSL examples at * {@link com.google.inject.Binder}. */ void asEagerSingleton(); diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/Binder.java sisu-guice-4.2.0/core/src/com/google/inject/Binder.java --- sisu-guice-3.2.6/core/src/com/google/inject/Binder.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/Binder.java 2018-04-03 18:18:08.000000000 +0000 @@ -26,129 +26,111 @@ import com.google.inject.spi.ProvisionListener; import com.google.inject.spi.TypeConverter; import com.google.inject.spi.TypeListener; - import java.lang.annotation.Annotation; import java.lang.reflect.Method; -import java.lang.reflect.Proxy; /** - * Collects configuration information (primarily bindings) which will be - * used to create an {@link Injector}. Guice provides this object to your - * application's {@link Module} implementors so they may each contribute - * their own bindings and other registrations. + * Collects configuration information (primarily bindings) which will be used to create an + * {@link Injector}. Guice provides this object to your application's {@link Module} implementors so + * they may each contribute their own bindings and other registrations. * *The Guice Binding EDSL
* - * Guice uses an embedded domain-specific language, or EDSL, to help you - * create bindings simply and readably. This approach is great for overall - * usability, but it does come with a small cost: it is difficult to - * learn how to use the Binding EDSL by reading - * method-level javadocs. Instead, you should consult the series of - * examples below. To save space, these examples omit the opening - * {@code binder}, just as you will if your module extends - * {@link AbstractModule}. + * Guice uses an embedded domain-specific language, or EDSL, to help you create bindings + * simply and readably. This approach is great for overall usability, but it does come with a small + * cost: it is difficult to learn how to use the Binding EDSL by reading method-level + * javadocs. Instead, you should consult the series of examples below. To save space, these + * examples omit the opening {@code binder}, just as you will if your module extends {@link + * AbstractModule}. * ** bind(ServiceImpl.class);* - * This statement does essentially nothing; it "binds the {@code ServiceImpl} - * class to itself" and does not change Guice's default behavior. You may still - * want to use this if you prefer your {@link Module} class to serve as an - * explicit manifest for the services it provides. Also, in rare cases, - * Guice may be unable to validate a binding at injector creation time unless it - * is given explicitly. + * This statement does essentially nothing; it "binds the {@code ServiceImpl} class to itself" and + * does not change Guice's default behavior. You may still want to use this if you prefer your + * {@link Module} class to serve as an explicit manifest for the services it provides. Also, + * in rare cases, Guice may be unable to validate a binding at injector creation time unless it is + * given explicitly. * ** bind(Service.class).to(ServiceImpl.class);* - * Specifies that a request for a {@code Service} instance with no binding - * annotations should be treated as if it were a request for a - * {@code ServiceImpl} instance. This overrides the function of any - * {@link ImplementedBy @ImplementedBy} or {@link ProvidedBy @ProvidedBy} - * annotations found on {@code Service}, since Guice will have already - * "moved on" to {@code ServiceImpl} before it reaches the point when it starts - * looking for these annotations. + * Specifies that a request for a {@code Service} instance with no binding annotations should be + * treated as if it were a request for a {@code ServiceImpl} instance. This overrides the + * function of any {@link ImplementedBy @ImplementedBy} or {@link ProvidedBy @ProvidedBy} + * annotations found on {@code Service}, since Guice will have already "moved on" to {@code + * ServiceImpl} before it reaches the point when it starts looking for these annotations. * ** bind(Service.class).toProvider(ServiceProvider.class);* - * In this example, {@code ServiceProvider} must extend or implement - * {@code Provider}. This binding specifies that Guice should resolve - * an unannotated injection request for {@code Service} by first resolving an - * instance of {@code ServiceProvider} in the regular way, then calling - * {@link Provider#get get()} on the resulting Provider instance to obtain the - * {@code Service} instance. - * - * The {@link Provider} you use here does not have to be a "factory"; that - * is, a provider which always creates each instance it provides. - * However, this is generally a good practice to follow. You can then use - * Guice's concept of {@link Scope scopes} to guide when creation should happen - * -- "letting Guice work for you". + * In this example, {@code ServiceProvider} must extend or implement {@code Provider
}. This + * binding specifies that Guice should resolve an unannotated injection request for {@code Service} + * by first resolving an instance of {@code ServiceProvider} in the regular way, then calling {@link + * Provider#get get()} on the resulting Provider instance to obtain the {@code Service} instance. + * + * The {@link Provider} you use here does not have to be a "factory"; that is, a provider which + * always creates each instance it provides. However, this is generally a good practice to + * follow. You can then use Guice's concept of {@link Scope scopes} to guide when creation should + * happen -- "letting Guice work for you". * *
* bind(Service.class).annotatedWith(Red.class).to(ServiceImpl.class);* - * Like the previous example, but only applies to injection requests that use - * the binding annotation {@code @Red}. If your module also includes bindings - * for particular values of the {@code @Red} annotation (see below), - * then this binding will serve as a "catch-all" for any values of {@code @Red} - * that have no exact match in the bindings. - * + * Like the previous example, but only applies to injection requests that use the binding annotation + * {@code @Red}. If your module also includes bindings for particular values of the + * {@code @Red} annotation (see below), then this binding will serve as a "catch-all" for any values + * of {@code @Red} that have no exact match in the bindings. + * ** bind(ServiceImpl.class).in(Singleton.class); * // or, alternatively * bind(ServiceImpl.class).in(Scopes.SINGLETON);* - * Either of these statements places the {@code ServiceImpl} class into - * singleton scope. Guice will create only one instance of {@code ServiceImpl} - * and will reuse it for all injection requests of this type. Note that it is - * still possible to bind another instance of {@code ServiceImpl} if the second - * binding is qualified by an annotation as in the previous example. Guice is - * not overly concerned with preventing you from creating multiple - * instances of your "singletons", only with enabling your application to - * share only one instance if that's all you tell Guice you need. - * - *Note: a scope specified in this way overrides any scope that - * was specified with an annotation on the {@code ServiceImpl} class. - * - *
Besides {@link Singleton}/{@link Scopes#SINGLETON}, there are - * servlet-specific scopes available in - * {@code com.google.inject.servlet.ServletScopes}, and your Modules can - * contribute their own custom scopes for use here as well. + * Either of these statements places the {@code ServiceImpl} class into singleton scope. Guice will + * create only one instance of {@code ServiceImpl} and will reuse it for all injection requests of + * this type. Note that it is still possible to bind another instance of {@code ServiceImpl} if the + * second binding is qualified by an annotation as in the previous example. Guice is not overly + * concerned with preventing you from creating multiple instances of your "singletons", only + * with enabling your application to share only one instance if that's all you tell Guice you + * need. + * + *
Note: a scope specified in this way overrides any scope that was specified with + * an annotation on the {@code ServiceImpl} class. + * + *
Besides {@link Singleton}/{@link Scopes#SINGLETON}, there are servlet-specific scopes + * available in {@code com.google.inject.servlet.ServletScopes}, and your Modules can contribute + * their own custom scopes for use here as well. * *
* bind(new TypeLiteral<PaymentService<CreditCard>>() {}) * .to(CreditCardPaymentService.class);* - * This admittedly odd construct is the way to bind a parameterized type. It - * tells Guice how to honor an injection request for an element of type - * {@code PaymentService}. The class - * {@code CreditCardPaymentService} must implement the - * {@code PaymentService } interface. Guice cannot currently bind or - * inject a generic type, such as {@code Set }; all type parameters must be - * fully specified. + * This admittedly odd construct is the way to bind a parameterized type. It tells Guice how to + * honor an injection request for an element of type {@code PaymentService }. The class + * {@code CreditCardPaymentService} must implement the {@code PaymentService } interface. + * Guice cannot currently bind or inject a generic type, such as {@code Set }; all type parameters + * must be fully specified. * * * bind(Service.class).toInstance(new ServiceImpl()); * // or, alternatively * bind(Service.class).toInstance(SomeLegacyRegistry.getService());* - * In this example, your module itself, not Guice, takes responsibility - * for obtaining a {@code ServiceImpl} instance, then asks Guice to always use - * this single instance to fulfill all {@code Service} injection requests. When - * the {@link Injector} is created, it will automatically perform field - * and method injection for this instance, but any injectable constructor on - * {@code ServiceImpl} is simply ignored. Note that using this approach results - * in "eager loading" behavior that you can't control. + * In this example, your module itself, not Guice, takes responsibility for obtaining a + * {@code ServiceImpl} instance, then asks Guice to always use this single instance to fulfill all + * {@code Service} injection requests. When the {@link Injector} is created, it will automatically + * perform field and method injection for this instance, but any injectable constructor on {@code + * ServiceImpl} is simply ignored. Note that using this approach results in "eager loading" behavior + * that you can't control. * ** bindConstant().annotatedWith(ServerHost.class).to(args[0]);* - * Sets up a constant binding. Constant injections must always be annotated. - * When a constant binding's value is a string, it is eligile for conversion to - * all primitive types, to {@link Enum#valueOf(Class, String) all enums}, and to - * {@link Class#forName class literals}. Conversions for other types can be - * configured using {@link #convertToTypes(Matcher, TypeConverter) + * Sets up a constant binding. Constant injections must always be annotated. When a constant + * binding's value is a string, it is eligile for conversion to all primitive types, to {@link + * Enum#valueOf(Class, String) all enums}, and to {@link Class#forName class literals}. Conversions + * for other types can be configured using {@link #convertToTypes(Matcher, TypeConverter) * convertToTypes()}. * *@@ -157,46 +139,42 @@ * red = MyModule.class.getDeclaredField("red").getAnnotation(Color.class); * bind(Service.class).annotatedWith(red).to(RedService.class);* - * If your binding annotation has parameters you can apply different bindings to - * different specific values of your annotation. Getting your hands on the - * right instance of the annotation is a bit of a pain -- one approach, shown - * above, is to apply a prototype annotation to a field in your module class, so - * that you can read this annotation instance and give it to Guice. + * If your binding annotation has parameters you can apply different bindings to different specific + * values of your annotation. Getting your hands on the right instance of the annotation is a bit of + * a pain -- one approach, shown above, is to apply a prototype annotation to a field in your module + * class, so that you can read this annotation instance and give it to Guice. * ** bind(Service.class) * .annotatedWith(Names.named("blue")) * .to(BlueService.class);* - * Differentiating by names is a common enough use case that we provided a - * standard annotation, {@link com.google.inject.name.Named @Named}. Because of - * Guice's library support, binding by name is quite easier than in the - * arbitrary binding annotation case we just saw. However, remember that these - * names will live in a single flat namespace with all the other names used in - * your application. + * Differentiating by names is a common enough use case that we provided a standard annotation, + * {@link com.google.inject.name.Named @Named}. Because of Guice's library support, binding by name + * is quite easier than in the arbitrary binding annotation case we just saw. However, remember that + * these names will live in a single flat namespace with all the other names used in your + * application. * ** Constructor* - * In this example, we directly tell Guice which constructor to use in a concrete - * class implementation. It means that we do not need to place {@literal @}Inject - * on any of the constructors and that Guice treats the provided constructor as though - * it were annotated so. It is useful for cases where you cannot modify existing - * classes and is a bit simpler than using a {@link Provider}. - * - *loneCtor = getLoneCtorFromServiceImplViaReflection(); * bind(ServiceImpl.class) * .toConstructor(loneCtor); The above list of examples is far from exhaustive. If you can think of - * how the concepts of one example might coexist with the concepts from another, - * you can most likely weave the two together. If the two concepts make no - * sense with each other, you most likely won't be able to do it. In a few - * cases Guice will let something bogus slip by, and will then inform you of - * the problems at runtime, as soon as you try to create your Injector. - * - *
The other methods of Binder such as {@link #bindScope}, - * {@link #bindInterceptor}, {@link #install}, {@link #requestStaticInjection}, - * {@link #addError} and {@link #currentStage} are not part of the Binding EDSL; - * you can learn how to use these in the usual way, from the method + * In this example, we directly tell Guice which constructor to use in a concrete class + * implementation. It means that we do not need to place {@literal @}Inject on any of the + * constructors and that Guice treats the provided constructor as though it were annotated so. It is + * useful for cases where you cannot modify existing classes and is a bit simpler than using a + * {@link Provider}. + * + *
The above list of examples is far from exhaustive. If you can think of how the concepts of one + * example might coexist with the concepts from another, you can most likely weave the two together. + * If the two concepts make no sense with each other, you most likely won't be able to do it. In a + * few cases Guice will let something bogus slip by, and will then inform you of the problems at + * runtime, as soon as you try to create your Injector. + * + *
The other methods of Binder such as {@link #bindScope}, {@link #bindInterceptor}, {@link + * #install}, {@link #requestStaticInjection}, {@link #addError} and {@link #currentStage} are not + * part of the Binding EDSL; you can learn how to use these in the usual way, from the method * documentation. * * @author crazybob@google.com (Bob Lee) @@ -211,51 +189,41 @@ * eligible for interception if: * *
- *
* - * @param classMatcher matches classes the interceptor should apply to. For - * example: {@code only(Runnable.class)}. - * @param methodMatcher matches methods the interceptor should apply to. For - * example: {@code annotatedWith(Transactional.class)}. - * @param interceptors to bind. The interceptors are called in the order they - * are given. + * @param classMatcher matches classes the interceptor should apply to. For example: {@code + * only(Runnable.class)}. + * @param methodMatcher matches methods the interceptor should apply to. For example: {@code + * annotatedWith(Transactional.class)}. + * @param interceptors to bind. The interceptors are called in the order they are given. */ - void bindInterceptor(Matcher super Class>> classMatcher, + void bindInterceptor( + Matcher super Class>> classMatcher, Matcher super Method> methodMatcher, org.aopalliance.intercept.MethodInterceptor... interceptors); /*end[AOP]*/ - /** - * Binds a scope to an annotation. - */ + /** Binds a scope to an annotation. */ void bindScope(Class extends Annotation> annotationType, Scope scope); - /** - * See the EDSL examples at {@link Binder}. - */ + /** See the EDSL examples at {@link Binder}. */- Guice created the instance the method is on
- *- Neither the enclosing type nor the method is final
- *- And the method is package-private, protected, or public
+ *- Guice created the instance the method is on + *
- Neither the enclosing type nor the method is final + *
- And the method is package-private, protected, or public *
LinkedBindingBuilder bind(Key key); - /** - * See the EDSL examples at {@link Binder}. - */ + /** See the EDSL examples at {@link Binder}. */ AnnotatedBindingBuilder bind(TypeLiteral typeLiteral); - /** - * See the EDSL examples at {@link Binder}. - */ + /** See the EDSL examples at {@link Binder}. */ AnnotatedBindingBuilder bind(Class type); - /** - * See the EDSL examples at {@link Binder}. - */ + /** See the EDSL examples at {@link Binder}. */ AnnotatedConstantBindingBuilder bindConstant(); /** - * Upon successful creation, the {@link Injector} will inject instance fields - * and methods of the given object. + * Upon successful creation, the {@link Injector} will inject instance fields and methods of the + * given object. * * @param type of instance * @param instance for which members will be injected @@ -264,8 +232,8 @@ void requestInjection(TypeLiteral type, T instance); /** - * Upon successful creation, the {@link Injector} will inject instance fields - * and methods of the given object. + * Upon successful creation, the {@link Injector} will inject instance fields and methods of the + * given object. * * @param instance for which members will be injected * @since 2.0 @@ -273,37 +241,30 @@ void requestInjection(Object instance); /** - * Upon successful creation, the {@link Injector} will inject static fields - * and methods in the given classes. + * Upon successful creation, the {@link Injector} will inject static fields and methods in the + * given classes. * * @param types for which static members will be injected */ void requestStaticInjection(Class>... types); - /** - * Uses the given module to configure more bindings. - */ + /** Uses the given module to configure more bindings. */ void install(Module module); - /** - * Gets the current stage. - */ + /** Gets the current stage. */ Stage currentStage(); /** - * Records an error message which will be presented to the user at a later - * time. Unlike throwing an exception, this enable us to continue - * configuring the Injector and discover more errors. Uses {@link - * String#format(String, Object[])} to insert the arguments into the - * message. + * Records an error message which will be presented to the user at a later time. Unlike throwing + * an exception, this enable us to continue configuring the Injector and discover more errors. + * Uses {@link String#format(String, Object[])} to insert the arguments into the message. */ void addError(String message, Object... arguments); /** - * Records an exception, the full details of which will be logged, and the - * message of which will be presented to the user at a later - * time. If your Module calls something that you worry may fail, you should - * catch the exception and pass it into this. + * Records an exception, the full details of which will be logged, and the message of which will + * be presented to the user at a later time. If your Module calls something that you worry may + * fail, you should catch the exception and pass it into this. */ void addError(Throwable t); @@ -315,32 +276,29 @@ void addError(Message message); /** - * Returns the provider used to obtain instances for the given injection key. - * The returned provider will not be valid until the {@link Injector} has been - * created. The provider will throw an {@code IllegalStateException} if you - * try to use it beforehand. + * Returns the provider used to obtain instances for the given injection key. The returned + * provider will not be valid until the {@link Injector} has been created. The provider will throw + * an {@code IllegalStateException} if you try to use it beforehand. * * @since 2.0 */ Provider getProvider(Key key); /** - * Returns the provider used to obtain instances for the given injection key. - * The returned provider will be attached to the injection point and will - * follow the nullability specified in the dependency. - * Additionally, the returned provider will not be valid until the {@link Injector} - * has been created. The provider will throw an {@code IllegalStateException} if you - * try to use it beforehand. + * Returns the provider used to obtain instances for the given injection key. The returned + * provider will be attached to the injection point and will follow the nullability specified in + * the dependency. Additionally, the returned provider will not be valid until the {@link + * Injector} has been created. The provider will throw an {@code IllegalStateException} if you try + * to use it beforehand. * * @since 4.0 */ Provider getProvider(Dependency dependency); /** - * Returns the provider used to obtain instances for the given injection type. - * The returned provider will not be valid until the {@link Injector} has been - * created. The provider will throw an {@code IllegalStateException} if you - * try to use it beforehand. + * Returns the provider used to obtain instances for the given injection type. The returned + * provider will not be valid until the {@link Injector} has been created. The provider will throw + * an {@code IllegalStateException} if you try to use it beforehand. * * @since 2.0 */ @@ -369,15 +327,14 @@ MembersInjector getMembersInjector(Class type); /** - * Binds a type converter. The injector will use the given converter to - * convert string constants to matching types as needed. + * Binds a type converter. The injector will use the given converter to convert string constants + * to matching types as needed. * * @param typeMatcher matches types the converter can handle * @param converter converts values * @since 2.0 */ - void convertToTypes(Matcher super TypeLiteral>> typeMatcher, - TypeConverter converter); + void convertToTypes(Matcher super TypeLiteral>> typeMatcher, TypeConverter converter); /** * Registers a listener for injectable types. Guice will notify the listener when it encounters @@ -387,43 +344,38 @@ * @param listener for injectable types matched by typeMatcher * @since 2.0 */ - void bindListener(Matcher super TypeLiteral>> typeMatcher, - TypeListener listener); + void bindListener(Matcher super TypeLiteral>> typeMatcher, TypeListener listener); /** - * Registers listeners for provisioned objects. Guice will notify the - * listeners just before and after the object is provisioned. Provisioned - * objects that are also injectable (everything except objects provided - * through Providers) can also be notified through TypeListeners registered in - * {@link #bindListener}. - * - * @param bindingMatcher that matches bindings of provisioned objects the listener - * should be notified of - * @param listeners for provisioned objects matched by bindingMatcher + * Registers listeners for provisioned objects. Guice will notify the listeners just before and + * after the object is provisioned. Provisioned objects that are also injectable (everything + * except objects provided through Providers) can also be notified through TypeListeners + * registered in {@link #bindListener}. + * + * @param bindingMatcher that matches bindings of provisioned objects the listener should be + * notified of + * @param listeners for provisioned objects matched by bindingMatcher * @since 4.0 */ void bindListener(Matcher super Binding>> bindingMatcher, ProvisionListener... listeners); /** - * Returns a binder that uses {@code source} as the reference location for - * configuration errors. This is typically a {@link StackTraceElement} - * for {@code .java} source but it could any binding source, such as the - * path to a {@code .properties} file. + * Returns a binder that uses {@code source} as the reference location for configuration errors. + * This is typically a {@link StackTraceElement} for {@code .java} source but it could any binding + * source, such as the path to a {@code .properties} file. * - * @param source any object representing the source location and has a - * concise {@link Object#toString() toString()} value + * @param source any object representing the source location and has a concise {@link + * Object#toString() toString()} value * @return a binder that shares its configuration with this binder * @since 2.0 */ Binder withSource(Object source); /** - * Returns a binder that skips {@code classesToSkip} when identify the - * calling code. The caller's {@link StackTraceElement} is used to locate - * the source of configuration errors. + * Returns a binder that skips {@code classesToSkip} when identify the calling code. The caller's + * {@link StackTraceElement} is used to locate the source of configuration errors. * - * @param classesToSkip library classes that create bindings on behalf of - * their clients. + * @param classesToSkip library classes that create bindings on behalf of their clients. * @return a binder that shares its configuration with this binder. * @since 2.0 */ @@ -435,75 +387,69 @@ * PrivateModule} for details. * * @return a binder that inherits configuration from this binder. Only exposed configuration on - * the returned binder will be visible to this binder. + * the returned binder will be visible to this binder. * @since 2.0 */ PrivateBinder newPrivateBinder(); /** - * Instructs the Injector that bindings must be listed in a Module in order to - * be injected. Classes that are not explicitly bound in a module cannot be - * injected. Bindings created through a linked binding - * ( bind(Foo.class).to(FooImpl.class)
) are allowed, but the - * implicit binding (FooImpl
) cannot be directly injected unless - * it is also explicitly bound (bind(FooImpl.class)
). - *- * Tools can still retrieve bindings for implicit bindings (bindings created - * through a linked binding) if explicit bindings are required, however - * {@link Binding#getProvider} will fail. - *
- * By default, explicit bindings are not required. - *
- * If a parent injector requires explicit bindings, then all child injectors - * (and private modules within that injector) also require explicit bindings. - * If a parent does not require explicit bindings, a child injector or private - * module may optionally declare itself as requiring explicit bindings. If it - * does, the behavior is limited only to that child or any grandchildren. No - * siblings of the child will require explicit bindings. - *
- * In the absence of an explicit binding for the target, linked bindings in - * child injectors create a binding for the target in the parent. Since this - * behavior can be surprising, it causes an error instead if explicit bindings - * are required. To avoid this error, add an explicit binding for the target, - * either in the child or the parent. - * + * Instructs the Injector that bindings must be listed in a Module in order to be injected. + * Classes that are not explicitly bound in a module cannot be injected. Bindings created through + * a linked binding (
bind(Foo.class).to(FooImpl.class)
) are allowed, but the implicit + * binding (FooImpl
) cannot be directly injected unless it is also explicitly bound ( + *bind(FooImpl.class)
). + * + *Tools can still retrieve bindings for implicit bindings (bindings created through a linked + * binding) if explicit bindings are required, however {@link Binding#getProvider} will fail. + * + *
By default, explicit bindings are not required. + * + *
If a parent injector requires explicit bindings, then all child injectors (and private + * modules within that injector) also require explicit bindings. If a parent does not require + * explicit bindings, a child injector or private module may optionally declare itself as + * requiring explicit bindings. If it does, the behavior is limited only to that child or any + * grandchildren. No siblings of the child will require explicit bindings. + * + *
In the absence of an explicit binding for the target, linked bindings in child injectors + * create a binding for the target in the parent. Since this behavior can be surprising, it causes + * an error instead if explicit bindings are required. To avoid this error, add an explicit + * binding for the target, either in the child or the parent. + * * @since 3.0 */ void requireExplicitBindings(); - + /** - * Prevents Guice from constructing a {@link Proxy} when a circular dependency - * is found. By default, circular proxies are not disabled. - *
- * If a parent injector disables circular proxies, then all child injectors - * (and private modules within that injector) also disable circular proxies. - * If a parent does not disable circular proxies, a child injector or private - * module may optionally declare itself as disabling circular proxies. If it - * does, the behavior is limited only to that child or any grandchildren. No - * siblings of the child will disable circular proxies. - * + * Prevents Guice from injecting dependencies that form a cycle, unless broken by a {@link + * Provider}. By default, circular dependencies are not disabled. + * + *
If a parent injector disables circular dependencies, then all child injectors (and private + * modules within that injector) also disable circular dependencies. If a parent does not disable + * circular dependencies, a child injector or private module may optionally declare itself as + * disabling circular dependencies. If it does, the behavior is limited only to that child or any + * grandchildren. No siblings of the child will disable circular dependencies. + * * @since 3.0 */ void disableCircularProxies(); - + /** * Requires that a {@literal @}{@link Inject} annotation exists on a constructor in order for * Guice to consider it an eligible injectable class. By default, Guice will inject classes that * have a no-args constructor if no {@literal @}{@link Inject} annotation exists on any * constructor. - *
- * If the class is bound using {@link LinkedBindingBuilder#toConstructor}, Guice will still inject - * that constructor regardless of annotations. + * + *
If the class is bound using {@link LinkedBindingBuilder#toConstructor}, Guice will still + * inject that constructor regardless of annotations. * * @since 4.0 */ void requireAtInjectOnConstructors(); /** - * Requires that Guice finds an exactly matching binding annotation. This disables the - * error-prone feature in Guice where it can substitute a binding for - *
{@literal @}Named Foo
when attempting to inject - *{@literal @}Named("foo") Foo
. + * Requires that Guice finds an exactly matching binding annotation. This disables the error-prone + * feature in Guice where it can substitute a binding for{@literal @}Named Foo
when + * attempting to inject{@literal @}Named("foo") Foo
. * * @since 4.0 */ diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/BindingAnnotation.java sisu-guice-4.2.0/core/src/com/google/inject/BindingAnnotation.java --- sisu-guice-3.2.6/core/src/com/google/inject/BindingAnnotation.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/BindingAnnotation.java 2018-04-03 18:18:08.000000000 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,9 +23,9 @@ import java.lang.annotation.Target; /** - * Annotates annotations which are used for binding. Only one such annotation - * may apply to a single injection point. You must also annotate binder - * annotations with {@code @Retention(RUNTIME)}. For example: + * Annotates annotations which are used for binding. Only one such annotation may apply to a single + * injection point. You must also annotate binder annotations with {@code @Retention(RUNTIME)}. For + * example: * ** {@code @}Retention(RUNTIME) diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/Binding.java sisu-guice-4.2.0/core/src/com/google/inject/Binding.java --- sisu-guice-3.2.6/core/src/com/google/inject/Binding.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/Binding.java 2018-04-03 18:18:08.000000000 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,55 +22,50 @@ /** * A mapping from a key (type and optional annotation) to the strategy for getting instances of the - * type. This interface is part of the introspection API and is intended primarily for use by - * tools. + * type. This interface is part of the introspection API and is intended primarily for use by tools. * *Bindings are created in several ways: + * *
- *
+ * bindConstant().annotatedWith(ServerHost.class).to(args[0]);- Explicitly in a module, via {@code bind()} and {@code bindConstant()} - * statements: - *
+ *- Explicitly in a module, via {@code bind()} and {@code bindConstant()} statements: + *
- ** bind(Service.class).annotatedWith(Red.class).to(ServiceImpl.class); - * bindConstant().annotatedWith(ServerHost.class).to(args[0]);- Implicitly by the Injector by following a type's {@link ImplementedBy - * pointer} {@link ProvidedBy annotations} or by using its {@link Inject annotated} or - * default constructor.
- *- By converting a bound instance to a different type.
- *- For {@link Provider providers}, by delegating to the binding for the provided type.
- *
They exist on both modules and on injectors, and their behaviour is different for each: + * *
Guice supports a model of development that draws clear boundaries between APIs, + * Implementations of these APIs, Modules which configure these implementations, and finally + * Applications which consist of a collection of Modules. It is the Application, which typically + * defines your {@code main()} method, that bootstraps the Guice Injector using the {@code Guice} + * class, as in this example: * - *
Guice supports a model of development that draws clear boundaries between - * APIs, Implementations of these APIs, Modules which configure these - * implementations, and finally Applications which consist of a collection of - * Modules. It is the Application, which typically defines your {@code main()} - * method, that bootstraps the Guice Injector using the {@code Guice} class, as - * in this example: *
* public class FooApplication { * public static void main(String[] args) { @@ -52,50 +50,40 @@ private Guice() {} /** - * Creates an injector for the given set of modules. This is equivalent to - * calling {@link #createInjector(Stage, Module...)} with Stage.DEVELOPMENT. + * Creates an injector for the given set of modules. This is equivalent to calling {@link + * #createInjector(Stage, Module...)} with Stage.DEVELOPMENT. * - * @throws CreationException if one or more errors occur during injector - * construction + * @throws CreationException if one or more errors occur during injector construction */ public static Injector createInjector(Module... modules) { return createInjector(Arrays.asList(modules)); } /** - * Creates an injector for the given set of modules. This is equivalent to - * calling {@link #createInjector(Stage, Iterable)} with Stage.DEVELOPMENT. + * Creates an injector for the given set of modules. This is equivalent to calling {@link + * #createInjector(Stage, Iterable)} with Stage.DEVELOPMENT. * - * @throws CreationException if one or more errors occur during injector - * creation + * @throws CreationException if one or more errors occur during injector creation */ public static Injector createInjector(Iterable extends Module> modules) { return createInjector(Stage.DEVELOPMENT, modules); } /** - * Creates an injector for the given set of modules, in a given development - * stage. + * Creates an injector for the given set of modules, in a given development stage. * - * @throws CreationException if one or more errors occur during injector - * creation. + * @throws CreationException if one or more errors occur during injector creation. */ public static Injector createInjector(Stage stage, Module... modules) { return createInjector(stage, Arrays.asList(modules)); } /** - * Creates an injector for the given set of modules, in a given development - * stage. + * Creates an injector for the given set of modules, in a given development stage. * - * @throws CreationException if one or more errors occur during injector - * construction + * @throws CreationException if one or more errors occur during injector construction */ - public static Injector createInjector(Stage stage, - Iterable extends Module> modules) { - return new InternalInjectorCreator() - .stage(stage) - .addModules(modules) - .build(); + public static Injector createInjector(Stage stage, Iterable extends Module> modules) { + return new InternalInjectorCreator().stage(stage).addModules(modules).build(); } } diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/ImplementedBy.java sisu-guice-4.2.0/core/src/com/google/inject/ImplementedBy.java --- sisu-guice-3.2.6/core/src/com/google/inject/ImplementedBy.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/ImplementedBy.java 2018-04-03 18:18:08.000000000 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,8 +31,6 @@ @Target(TYPE) public @interface ImplementedBy { - /** - * The implementation type. - */ + /** The implementation type. */ Class> value(); } diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/Inject.java sisu-guice-4.2.0/core/src/com/google/inject/Inject.java --- sisu-guice-3.2.6/core/src/com/google/inject/Inject.java 2015-04-25 16:25:40.000000000 +0000 +++ sisu-guice-4.2.0/core/src/com/google/inject/Inject.java 2018-04-03 18:18:08.000000000 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,44 +26,37 @@ import java.lang.annotation.Target; /** - * Annotates members of your implementation class (constructors, methods - * and fields) into which the {@link Injector} should inject values. - * The Injector fulfills injection requests for: + * Annotates members of your implementation class (constructors, methods and fields) into which the + * {@link Injector} should inject values. The Injector fulfills injection requests for: * *
The returned map does not include bindings inherited from a {@link #getParent() parent - * injector}, should one exist. The returned map is guaranteed to iterate (for example, with - * its {@link Map#entrySet()} iterator) in the order of insertion. In other words, the order in - * which bindings appear in user Modules. + * injector}, should one exist. The returned map is guaranteed to iterate (for example, with its + * {@link Map#entrySet()} iterator) in the order of insertion. In other words, the order in which + * bindings appear in user Modules. * *
This method is part of the Guice SPI and is intended for use by tools and extensions. */ @@ -108,14 +105,15 @@ /** * Returns a snapshot of this injector's bindings, both explicit and * just-in-time. The returned map is immutable; it contains only the bindings that were - * present when {@code getAllBindings()} was invoked. Subsequent calls may return a map with - * additional just-in-time bindings. + * present when {@code getAllBindings()} was invoked. Just-in-time bindings are only present if + * they have been requested at least once. Subsequent calls may return a map with additional + * just-in-time bindings. * *
The returned map does not include bindings inherited from a {@link #getParent() parent * injector}, should one exist. * *
This method is part of the Guice SPI and is intended for use by tools and extensions.
- *
+ *
* @since 3.0
*/
Map This method is part of the Guice SPI and is intended for use by tools and extensions.
- *
+ * Returns the binding if it already exists, or null if does not exist. Unlike {@link
+ * #getBinding(Key)}, this does not attempt to create just-in-time bindings for keys that aren't
+ * bound.
+ *
+ * This method is part of the Guice SPI and is intended for use by tools and extensions.
+ *
* @since 3.0
*/
- Just-in-time bindings created for child injectors will be created in an ancestor injector
* whenever possible. This allows for scoped instances to be shared between injectors. Use
- * explicit bindings to prevent bindings from being shared with the parent injector. Optional
- * injections in just-in-time bindings (created in the parent injector) may be silently
- * ignored if the optional dependencies are from the child injector.
+ * explicit bindings to prevent bindings from being shared with the parent injector. Optional
+ * injections in just-in-time bindings (created in the parent injector) may be silently ignored if
+ * the optional dependencies are from the child injector.
*
* No key may be bound by both an injector and one of its ancestors. This includes just-in-time
* bindings. The lone exception is the key for {@code Injector.class}, which is bound by each
@@ -243,12 +241,12 @@
Injector createChildInjector(Module... modules);
/**
- * Returns a map containing all scopes in the injector. The maps keys are scoping annotations
- * like {@code Singleton.class}, and the values are scope instances, such as {@code
- * Scopes.SINGLETON}. The returned map is immutable.
+ * Returns a map containing all scopes in the injector. The maps keys are scoping annotations like
+ * {@code Singleton.class}, and the values are scope instances, such as {@code Scopes.SINGLETON}.
+ * The returned map is immutable.
*
* This method is part of the Guice SPI and is intended for use by tools and extensions.
- *
+ *
* @since 3.0
*/
Map This method is part of the Guice SPI and is intended for use by tools and extensions.
- *
+ *
* @since 3.0
*/
Set Extending classes must return {@code true} from any overridden
- * {@code visit*()} methods, in order for the element processor to remove the
- * handled element.
+ * Extending classes must return {@code true} from any overridden {@code visit*()} methods, in
+ * order for the element processor to remove the handled element.
*
* @author jessewilson@google.com (Jesse Wilson)
*/
@@ -63,7 +61,7 @@
this.injector = null;
}
}
-
+
@Override
protected Boolean visitOther(Element element) {
return false;
diff -Nru sisu-guice-3.2.6/core/src/com/google/inject/internal/Annotations.java sisu-guice-4.2.0/core/src/com/google/inject/internal/Annotations.java
--- sisu-guice-3.2.6/core/src/com/google/inject/internal/Annotations.java 2015-04-25 16:25:40.000000000 +0000
+++ sisu-guice-4.2.0/core/src/com/google/inject/internal/Annotations.java 2018-04-03 18:18:08.000000000 +0000
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,6 +16,8 @@
package com.google.inject.internal;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Joiner.MapJoiner;
@@ -32,7 +34,6 @@
import com.google.inject.internal.util.Classes;
import com.google.inject.name.Named;
import com.google.inject.name.Names;
-
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -43,7 +44,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
-
import javax.inject.Qualifier;
/**
@@ -53,9 +53,7 @@
*/
public class Annotations {
- /**
- * Returns {@code true} if the given annotation type has no attributes.
- */
+ /** Returns {@code true} if the given annotation type has no attributes. */
public static boolean isMarker(Class extends Annotation> annotationType) {
return annotationType.getDeclaredMethods().length == 0;
}
@@ -72,13 +70,15 @@
}
private static final LoadingCache