mirror of
https://github.com/google/guice.git
synced 2024-04-21 12:32:36 +00:00
Fix Javadoc that fails when running with Java 9+.
Also: - configure bazel and maven to use the same -Xdoclint option - skip maven tests when generating javadoc and API diffs - fix shell script to fail when any command returned non-zero exit code - fix issue with the script that errors when trying to generate API diffs for module that does not contain Java doc (e.g extensions-parent) PiperOrigin-RevId: 427018267
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
JAVAC_OPTS = [
|
||||
"-Xdoclint:html,syntax",
|
||||
"-source",
|
||||
"1.8",
|
||||
"-target",
|
||||
|
||||
@@ -139,9 +139,7 @@ public abstract class AbstractModule implements Module {
|
||||
binder().requestStaticInjection(types);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link Binder#bindInterceptor(com.google.inject.matcher.Matcher, MethodInterceptor[])}.
|
||||
*/
|
||||
/** @see Binder#bindInterceptor */
|
||||
protected void bindInterceptor(
|
||||
Matcher<? super Class<?>> classMatcher,
|
||||
Matcher<? super Method> methodMatcher,
|
||||
|
||||
@@ -103,9 +103,10 @@ import org.aopalliance.intercept.MethodInterceptor;
|
||||
* available in {@code com.google.inject.servlet.ServletScopes}, and your Modules can contribute
|
||||
* their own custom scopes for use here as well.
|
||||
*
|
||||
* <pre>
|
||||
* bind(new TypeLiteral<PaymentService<CreditCard>>() {})
|
||||
* .to(CreditCardPaymentService.class);</pre>
|
||||
* <pre>{@code
|
||||
* bind(new TypeLiteral<PaymentService<CreditCard>>() {})
|
||||
* .to(CreditCardPaymentService.class);
|
||||
* }</pre>
|
||||
*
|
||||
* 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<CreditCard>}. The class
|
||||
@@ -156,10 +157,11 @@ import org.aopalliance.intercept.MethodInterceptor;
|
||||
* these names will live in a single flat namespace with all the other names used in your
|
||||
* application.
|
||||
*
|
||||
* <pre>
|
||||
* Constructor<T> loneCtor = getLoneCtorFromServiceImplViaReflection();
|
||||
* bind(ServiceImpl.class)
|
||||
* .toConstructor(loneCtor);</pre>
|
||||
* <pre>{@code
|
||||
* Constructor<T> loneCtor = getLoneCtorFromServiceImplViaReflection();
|
||||
* bind(ServiceImpl.class)
|
||||
* .toConstructor(loneCtor);
|
||||
* }</pre>
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -41,25 +41,26 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* <p>Example usage:
|
||||
*
|
||||
* <pre>{@code
|
||||
* @RestrictedBindingSource.Permit
|
||||
* @Retention(RetentionPolicy.RUNTIME)
|
||||
* @interface NetworkPermit {}
|
||||
* <pre>
|
||||
* {@literal @}RestrictedBindingSource.Permit
|
||||
* {@literal @}Retention(RetentionPolicy.RUNTIME)
|
||||
* {@literal @}interface NetworkPermit {}
|
||||
*
|
||||
* @RestrictedBindingSource(
|
||||
* {@literal @}RestrictedBindingSource(
|
||||
* explanation = "Only NetworkModule can create network bindings.",
|
||||
* permits = {NetworkPermit.class})
|
||||
* @Qualifier
|
||||
* @Retention(RetentionPolicy.RUNTIME)
|
||||
* public @interface GatewayIpAdress {}
|
||||
* {@literal @}Qualifier
|
||||
* {@literal @}Retention(RetentionPolicy.RUNTIME)
|
||||
* public {@literal @}interface GatewayIpAdress {}
|
||||
*
|
||||
* @NetworkPermit
|
||||
* {@literal @}NetworkPermit
|
||||
* public final class NetworkModule extends AbstractModule {
|
||||
* @Provides
|
||||
* @GatewayIpAdress // Allowed because the module is annotated with @NetworkPermit.
|
||||
* // Allowed because the module is annotated with {@literal @}NetworkPermit.
|
||||
* {@literal @}Provides
|
||||
* {@literal @}GatewayIpAdress
|
||||
* int provideGatewayIp() { ... }
|
||||
* }
|
||||
* }</pre>
|
||||
* </pre>
|
||||
*
|
||||
* @author vzm@google.com (Vladimir Makaric)
|
||||
* @since 5.0
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.google.inject.internal;
|
||||
|
||||
/**
|
||||
* Something that needs some delayed initialization, typically a binding or internal factory that
|
||||
* needs to be created & put into the bindings map & then initialized later.
|
||||
* needs to be created; put into the bindings map and then initialized later.
|
||||
*
|
||||
* @author sameb@google.com (Sam Berlin)
|
||||
*/
|
||||
|
||||
@@ -108,7 +108,7 @@ final class InjectorImpl implements Injector, Lookups {
|
||||
NO_JIT,
|
||||
/** allows existing just in time bindings, but does not allow new ones */
|
||||
EXISTING_JIT,
|
||||
/** allows existing just in time bindings & allows new ones to be created */
|
||||
/** allows existing just in time bindings and allows new ones to be created */
|
||||
NEW_OR_EXISTING_JIT,
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ final class InjectorImpl implements Injector, Lookups {
|
||||
return new SyntheticProviderBindingImpl<T>(this, key, delegate);
|
||||
}
|
||||
|
||||
/** A framework-created JIT Provider<T> binding. */
|
||||
/** A framework-created JIT {@code Provider<T>} binding. */
|
||||
private static class SyntheticProviderBindingImpl<T> extends BindingImpl<Provider<T>>
|
||||
implements ProviderBinding<Provider<T>>, HasDependencies {
|
||||
final BindingImpl<T> providedBinding;
|
||||
@@ -618,7 +618,7 @@ final class InjectorImpl implements Injector, Lookups {
|
||||
|
||||
/**
|
||||
* Iterates through the binding's dependencies to clean up any stray bindings that were leftover
|
||||
* from a failed JIT binding. This is required because the bindings are eagerly & optimistically
|
||||
* from a failed JIT binding. This is required because the bindings are eagerly and optimistically
|
||||
* added to allow circular dependency support, so dependencies may pass where they should have
|
||||
* failed.
|
||||
*/
|
||||
|
||||
@@ -55,8 +55,8 @@ import java.util.logging.Logger;
|
||||
* similarly, but using {@link PrivateElements} instead of modules.
|
||||
*
|
||||
* <p>It is necessary to create the root and child injectors in a single batch because there can be
|
||||
* bidirectional parent <-> child injector dependencies that require the entire tree of injectors to
|
||||
* be initialized together in the {@link InternalInjectorCreator}.
|
||||
* bidirectional parent <-> child injector dependencies that require the entire tree of
|
||||
* injectors to be initialized together in the {@link InternalInjectorCreator}.
|
||||
*
|
||||
* @author jessewilson@google.com (Jesse Wilson)
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Keeps track of creation listeners & uninitialized bindings, so they can be processed after
|
||||
* Keeps track of creation listeners and uninitialized bindings, so they can be processed after
|
||||
* bindings are recorded.
|
||||
*
|
||||
* @author sameb@google.com (Sam Berlin)
|
||||
|
||||
@@ -20,8 +20,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.inject.internal.ProvisionListenerStackCallback.ProvisionCallback;
|
||||
import com.google.inject.spi.Dependency;
|
||||
import javax.inject.Provider;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Provider;
|
||||
|
||||
/**
|
||||
* Base class for InternalFactories that are used by Providers, to handle circular dependencies.
|
||||
@@ -75,7 +75,7 @@ abstract class ProviderInternalFactory<T> implements InternalFactory<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provisions a new instance. Subclasses should override this to catch exceptions & rethrow as
|
||||
* Provisions a new instance. Subclasses should override this to catch exceptions and rethrow as
|
||||
* ErrorsExceptions.
|
||||
*/
|
||||
protected T provision(
|
||||
|
||||
@@ -110,7 +110,7 @@ final class ProvisionListenerCallbackStore {
|
||||
return new ProvisionListenerStackCallback<T>(binding, listeners);
|
||||
}
|
||||
|
||||
/** A struct that holds key & binding but uses just key for equality/hashcode. */
|
||||
/** A struct that holds key and binding but uses just key for equality/hashcode. */
|
||||
private static class KeyBinding {
|
||||
final Key<?> key;
|
||||
final Binding<?> binding;
|
||||
|
||||
@@ -207,15 +207,16 @@ public final class RealMapBinder<K, V> implements Module {
|
||||
TypeLiteral.get(Types.setOf(entryOfJavaxProviderOf(keyType, valueType).getType()));
|
||||
}
|
||||
|
||||
/** Given a Key<T> will return a Key<Provider<T>> */
|
||||
/** Given a {@code Key<T>} will return a {@code Key<Provider<T>>}. */
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T> Key<Provider<T>> getKeyOfProvider(Key<T> valueKey) {
|
||||
return (Key<Provider<T>>)
|
||||
valueKey.ofType(Types.providerOf(valueKey.getTypeLiteral().getType()));
|
||||
}
|
||||
|
||||
// Note: We use valueTypeAndAnnotation effectively as a Pair<TypeLiteral, Annotation|Class>
|
||||
// since it's an easy way to group a type and an optional annotation type or instance.
|
||||
// Note: We use valueTypeAndAnnotation effectively as a {@code Pair<TypeLiteral,
|
||||
// Annotation|Class>} since it's an easy way to group a type and an optional annotation type or
|
||||
// instance.
|
||||
static <K, V> RealMapBinder<K, V> newRealMapBinder(
|
||||
Binder binder, TypeLiteral<K> keyType, Key<V> valueTypeAndAnnotation) {
|
||||
binder = binder.skipSources(RealMapBinder.class);
|
||||
|
||||
@@ -214,8 +214,8 @@ public final class RealMultibinder<T> implements Module {
|
||||
|
||||
/**
|
||||
* Provider instance implementation that provides the actual set of values. This is parameterized
|
||||
* so it can be used to supply a Set<T> and Set<? extends T>, the latter being useful for Kotlin
|
||||
* support.
|
||||
* so it can be used to supply a {@code Set<T>} and {@code Set<? extends T>}, the latter being
|
||||
* useful for Kotlin support.
|
||||
*/
|
||||
private static final class RealMultibinderProvider<T> extends BaseFactory<T, Set<T>> {
|
||||
List<Binding<T>> bindings;
|
||||
|
||||
@@ -236,7 +236,7 @@ public final class RealOptionalBinder<T> implements Module {
|
||||
.toProvider(new JavaOptionalProvider<>(bindingSelection, javaOptionalKey));
|
||||
}
|
||||
|
||||
/** Provides the binding for java.util.Optional<T>. */
|
||||
/** Provides the binding for {@code java.util.Optional<T>}. */
|
||||
private static final class JavaOptionalProvider<T>
|
||||
extends RealOptionalBinderProviderWithDependencies<T, java.util.Optional<T>>
|
||||
implements ProviderWithExtensionVisitor<java.util.Optional<T>>,
|
||||
@@ -328,7 +328,7 @@ public final class RealOptionalBinder<T> implements Module {
|
||||
}
|
||||
}
|
||||
|
||||
/** Provides the binding for java.util.Optional<Provider<T>>. */
|
||||
/** Provides the binding for {@code java.util.Optional<Provider<T>>}. */
|
||||
private static final class JavaOptionalProviderProvider<T>
|
||||
extends RealOptionalBinderProviderWithDependencies<T, java.util.Optional<Provider<T>>> {
|
||||
private java.util.Optional<Provider<T>> value;
|
||||
@@ -394,7 +394,7 @@ public final class RealOptionalBinder<T> implements Module {
|
||||
}
|
||||
}
|
||||
|
||||
/** Provides the binding for Optional<Provider<T>>. */
|
||||
/** Provides the binding for {@code Optional<Provider<T>>}. */
|
||||
private static final class RealOptionalProviderProvider<T>
|
||||
extends RealOptionalBinderProviderWithDependencies<T, Optional<Provider<T>>> {
|
||||
private Optional<Provider<T>> value;
|
||||
@@ -423,7 +423,7 @@ public final class RealOptionalBinder<T> implements Module {
|
||||
}
|
||||
}
|
||||
|
||||
/** Provides the binding for Optional<T>. */
|
||||
/** Provides the binding for {@code Optional<T>}. */
|
||||
private static final class RealOptionalKeyProvider<T>
|
||||
extends RealOptionalBinderProviderWithDependencies<T, Optional<T>>
|
||||
implements ProviderWithExtensionVisitor<Optional<T>>, OptionalBinderBinding<Optional<T>> {
|
||||
|
||||
@@ -31,8 +31,8 @@ import java.util.Set;
|
||||
* <p>Although MapBinders may be injected through a variety of generic types ({@code Map<K, V>},
|
||||
* {@code Map<K, ? extends V>}, {@code Map<K, Provider<V>>}, {@code Map<K, Set<V>>}, {@code Map<K,
|
||||
* Set<Provider<V>>}, and even {@code Set<Map.Entry<K, Provider<V>>}), a MapBinderBinding exists
|
||||
* only on the Binding associated with the Map<K, V> key. Injectable map types can be discovered
|
||||
* using {@link #getMapKey} (which will return the {@code Map<K, V>} key), or{@link
|
||||
* only on the Binding associated with the {@code Map<K, V> key}. Injectable map types can be
|
||||
* discovered using {@link #getMapKey} (which will return the {@code Map<K, V>} key), or{@link
|
||||
* #getAlternateMapKeys} (which will return the other keys that can inject this data). Other
|
||||
* bindings can be validated to be derived from this MapBinderBinding using {@link
|
||||
* #containsElement(Element)}.
|
||||
@@ -62,8 +62,8 @@ public interface MapBinderBinding<T> {
|
||||
* Returns the TypeLiteral describing the keys of the map.
|
||||
*
|
||||
* <p>The TypeLiteral will always match the type Map's generic type. For example, if getMapKey
|
||||
* returns a key of <code>Map<String, Snack></code>, then this will always return a <code>
|
||||
* TypeLiteral<String></code>.
|
||||
* returns a key of {@code Map<String, Snack>}, then this will always return a {@code
|
||||
* TypeLiteral<String>}.
|
||||
*/
|
||||
TypeLiteral<?> getKeyTypeLiteral();
|
||||
|
||||
@@ -71,8 +71,8 @@ public interface MapBinderBinding<T> {
|
||||
* Returns the TypeLiteral describing the values of the map.
|
||||
*
|
||||
* <p>The TypeLiteral will always match the type Map's generic type. For example, if getMapKey
|
||||
* returns a key of <code>Map<String, Snack></code>, then this will always return a <code>
|
||||
* TypeLiteral<Snack></code>.
|
||||
* returns a key of {@code Map<String, Snack>}, then this will always return a {@code
|
||||
* TypeLiteral<Snack>}.
|
||||
*/
|
||||
TypeLiteral<?> getValueTypeLiteral();
|
||||
|
||||
@@ -84,8 +84,8 @@ public interface MapBinderBinding<T> {
|
||||
* Elements#getElements}.
|
||||
*
|
||||
* <p>The elements will always match the type Map's generic type. For example, if getMapKey
|
||||
* returns a key of <code>Map<String, Snack></code>, then this will always return a list of
|
||||
* type <code>List<Map.Entry<String, Binding<Snack>>></code>.
|
||||
* returns a key of {@code Map<String, Snack>}, then this will always return a list of type {@code
|
||||
* List<Map.Entry<String, Binding<Snack>>>}.
|
||||
*/
|
||||
List<Map.Entry<?, Binding<?>>> getEntries();
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ public interface MultibinderBinding<T> {
|
||||
* Returns the TypeLiteral that describes the type of elements in the set.
|
||||
*
|
||||
* <p>The elements will always match the type Set's generic type. For example, if getSetKey
|
||||
* returns a key of <code>Set<String></code>, then this will always return a <code>
|
||||
* TypeLiteral<String></code>.
|
||||
* returns a key of {@code Set<String>}, then this will always return a {@code
|
||||
* TypeLiteral<String>}.
|
||||
*/
|
||||
TypeLiteral<?> getElementTypeLiteral();
|
||||
|
||||
@@ -68,8 +68,8 @@ public interface MultibinderBinding<T> {
|
||||
* retrieved from {@link Elements#getElements}.
|
||||
*
|
||||
* <p>The elements will always match the type Set's generic type. For example, if getSetKey
|
||||
* returns a key of <code>Set<String></code>, then this will always return a list of type
|
||||
* <code>List<Binding<String>></code>.
|
||||
* returns a key of {@code Set<String>}, then this will always return a list of type {@code
|
||||
* List<Binding<String>>}.
|
||||
*/
|
||||
List<Binding<?>> getElements();
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ public interface OptionalBinderBinding<T> {
|
||||
* called on an element retrieved from {@link Elements#getElements}.
|
||||
*
|
||||
* <p>The Binding's type will always match the type Optional's generic type. For example, if
|
||||
* getKey returns a key of <code>Optional<String></code>, then this will always return a <code>
|
||||
* Binding<String></code>.
|
||||
* getKey returns a key of {@code Optional<String>}, then this will always return a {@code
|
||||
* Binding<String>}.
|
||||
*/
|
||||
Binding<?> getDefaultBinding();
|
||||
|
||||
@@ -68,8 +68,8 @@ public interface OptionalBinderBinding<T> {
|
||||
* {@link Elements#getElements}.
|
||||
*
|
||||
* <p>The Binding's type will always match the type Optional's generic type. For example, if
|
||||
* getKey returns a key of <code>Optional<String></code>, then this will always return a <code>
|
||||
* Binding<String></code>.
|
||||
* getKey returns a key of {@code Optional<String>}, then this will always return a {@code
|
||||
* Binding<String>}.
|
||||
*/
|
||||
Binding<?> getActualBinding();
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public abstract class ErrorDetail<SelfT extends ErrorDetail<SelfT>> implements S
|
||||
* <li>Details about the error such as the source of the error
|
||||
* <li>Hints for fixing the error if available
|
||||
* <li>Link to the documentation on this error in greater detail
|
||||
* </ul>
|
||||
*
|
||||
* @param index index for this error
|
||||
* @param mergeableErrors list of errors that are mergeable with this error
|
||||
|
||||
@@ -814,8 +814,8 @@ public final class InjectionPoint {
|
||||
/**
|
||||
* Returns true if the method is eligible to be injected. This is different than {@link
|
||||
* #isValidMethod}, because ineligibility will not drop a method from being injected if a
|
||||
* superclass was eligible & valid. Bridge & synthetic methods are excluded from eligibility for
|
||||
* two reasons:
|
||||
* superclass was eligible and valid. Bridge and synthetic methods are excluded from eligibility
|
||||
* for two reasons:
|
||||
*
|
||||
* <p>Prior to Java8, javac would generate these methods in subclasses without annotations, which
|
||||
* means this would accidentally stop injecting a method annotated with {@link
|
||||
|
||||
@@ -27,13 +27,16 @@ import com.google.inject.Provider;
|
||||
* custom visitor designed for that extension. A typical implementation within the extension would
|
||||
* look like
|
||||
*
|
||||
* <pre>
|
||||
* <V, B> V acceptExtensionVisitor(BindingTargetVisitor<B, V> visitor, ProviderInstanceBinding<? extends B> binding) {
|
||||
* <pre>{@code
|
||||
* <V, B> V acceptExtensionVisitor(
|
||||
* BindingTargetVisitor<B, V> visitor, ProviderInstanceBinding<? extends B> binding) {
|
||||
* if(visitor instanceof MyCustomExtensionVisitor) {
|
||||
* return ((MyCustomExtensionVisitor<B, V>)visitor).visitCustomExtension(customProperties, binding);
|
||||
* return ((MyCustomExtensionVisitor<B, V>)visitor)
|
||||
* .visitCustomExtension(customProperties, binding);
|
||||
* } else {
|
||||
* return visitor.visit(binding);
|
||||
* }
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* 'MyCustomExtensionVisitor' in the example above would be an interface the extension provides that
|
||||
|
||||
@@ -24,8 +24,9 @@ import com.google.inject.matcher.Matcher;
|
||||
* Binds types (picked using a Matcher) to an type listener. Registrations are created explicitly in
|
||||
* a module using {@link com.google.inject.Binder#bindListener(Matcher, TypeListener)} statements:
|
||||
*
|
||||
* <pre>
|
||||
* register(only(new TypeLiteral<PaymentService<CreditCard>>() {}), listener);</pre>
|
||||
* <pre>{@code
|
||||
* register(only(new TypeLiteral<PaymentService<CreditCard>>() {}), listener);
|
||||
* }</pre>
|
||||
*
|
||||
* @author jessewilson@google.com (Jesse Wilson)
|
||||
* @since 2.0
|
||||
|
||||
@@ -122,7 +122,7 @@ public class ImplicitBindingTest extends TestCase {
|
||||
* 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.
|
||||
*
|
||||
* <p>The test loops through linked bindings & bindings with constructor & member injections, to
|
||||
* <p>The test loops through linked bindings & bindings with constructor and member injections, to
|
||||
* make sure that all are cleaned up and traversed. It also makes sure we don't touch explicit
|
||||
* bindings.
|
||||
*/
|
||||
|
||||
@@ -82,7 +82,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Utilities for testing the Multibinder & MapBinder extension SPI.
|
||||
* Utilities for testing the Multibinder and MapBinder extension SPI.
|
||||
*
|
||||
* @author sameb@google.com (Sam Berlin)
|
||||
*/
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ import java.lang.invoke.MethodHandles;
|
||||
* // excluding .implement for Shipment means the implementation class
|
||||
* // will be 'Shipment' itself, which is legal if it's not an interface.
|
||||
* .implement(Receipt.class, RealReceipt.class)
|
||||
* .build(OrderFactory.class));</pre>
|
||||
* .build(OrderFactory.class));
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
||||
+1
-1
@@ -702,7 +702,7 @@ final class FactoryProvider2<F>
|
||||
|
||||
/**
|
||||
* Returns true if all dependencies are suitable for the optimized version of AssistedInject. The
|
||||
* optimized version caches the binding & uses a ThreadLocal Provider, so can only be applied if
|
||||
* optimized version caches the binding and uses a ThreadLocal Provider, so can only be applied if
|
||||
* the assisted bindings are immediately provided. This looks for hints that the values may be
|
||||
* lazily retrieved, by looking for injections of Injector or a Provider for the assisted values.
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Adapts classes annotated with {@link @dagger.Module} such that their {@link @dagger.Provides}
|
||||
* Adapts classes annotated with {@code @dagger.Module} such that their {@code @dagger.Provides}
|
||||
* methods can be properly invoked by Guice to perform their provision operations.
|
||||
*
|
||||
* <p>Simple example:
|
||||
@@ -57,7 +57,7 @@ import java.util.Set;
|
||||
* <p>For modules with no instance binding methods, prefer using a class literal. If there are
|
||||
* instance binding methods, an instance of the module must be passed.
|
||||
*
|
||||
* <p>Any class literals specified by {@code dagger.Module(includes = ...)} transitively will be
|
||||
* <p>Any class literals specified by {@code @dagger.Module(includes = ...)} transitively will be
|
||||
* included. Modules are de-duplicated, though multiple module instances of the same type is an
|
||||
* error. Specifying a module instance and a class literal is also an error.
|
||||
*
|
||||
@@ -69,7 +69,7 @@ import java.util.Set;
|
||||
* be recreated on-demand with new Module instances), Guice typically has a single injector
|
||||
* with a long lifetime, so your module instance will be used throughout the lifetime of the
|
||||
* entire app.
|
||||
* <li>Dagger 1.x uses {@link @Singleton} for all scopes, including shorter-lived scopes like
|
||||
* <li>Dagger 1.x uses {@code @Singleton} for all scopes, including shorter-lived scopes like
|
||||
* per-request or per-activity. Using modules written with Dagger 1.x usage in mind may result
|
||||
* in mis-scoped objects.
|
||||
* <li>Dagger 2.x supports custom scope annotations, but for use in Guice, a custom scope
|
||||
@@ -101,13 +101,13 @@ public final class DaggerAdapter {
|
||||
private final ImmutableList.Builder<Object> modules = ImmutableList.builder();
|
||||
private Predicate<Method> predicate = Predicates.alwaysTrue();
|
||||
|
||||
/** Returns a module that will configure bindings based on the modules & scanners. */
|
||||
/** Returns a module that will configure bindings based on the modules and scanners. */
|
||||
public Module build() {
|
||||
return new DaggerCompatibilityModule(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds modules (which can be classes annotated with {@link dagger.Module}, or instances of
|
||||
* Adds modules (which can be classes annotated with {@code @dagger.Module}, or instances of
|
||||
* those classes) which will be scanned for bindings.
|
||||
*/
|
||||
public Builder addModules(Iterable<Object> daggerModuleObjects) {
|
||||
@@ -116,7 +116,7 @@ public final class DaggerAdapter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit the adapter to a subset of {@code methods} from {@link @dagger.Module} annotated
|
||||
* Limit the adapter to a subset of {@code methods} from {@code @dagger.Module} annotated
|
||||
* classes which satisfy the {@code predicate}. Defaults to allowing all.
|
||||
*/
|
||||
public Builder filter(Predicate<Method> predicate) {
|
||||
|
||||
@@ -48,7 +48,7 @@ public @interface Transactional {
|
||||
Class<? extends Exception>[] rollbackOn() default RuntimeException.class;
|
||||
|
||||
/**
|
||||
* A list of exceptions to <b>not<b> rollback on. A caveat to the rollbackOn clause. The
|
||||
* A list of exceptions to <b>not</b> rollback on. A caveat to the rollbackOn clause. The
|
||||
* disjunction of rollbackOn and ignore represents the list of exceptions that will trigger a
|
||||
* rollback. The complement of rollbackOn and the universal set plus any exceptions in the ignore
|
||||
* set represents the list of exceptions that will trigger a commit. Note that ignore exceptions
|
||||
|
||||
@@ -76,10 +76,10 @@ import java.lang.reflect.Type;
|
||||
*
|
||||
* <p>Example use:
|
||||
*
|
||||
* <pre><code>
|
||||
* <pre>{@code
|
||||
* public class TestFoo {
|
||||
* // bind(new TypeLiteral{@code <List<Object>>}() {}).toInstance(listOfObjects);
|
||||
* {@literal @}Bind private List{@code <Object>} listOfObjects = Lists.of();
|
||||
* // bind(new TypeLiteral<List<Object>>() {}).toInstance(listOfObjects);
|
||||
* {@literal @}Bind private List<Object> listOfObjects = Lists.of();
|
||||
*
|
||||
* // private String userName = "string_that_changes_over_time";
|
||||
* // bind(String.class).toProvider(new Provider() { public String get() { return userName; }});
|
||||
@@ -94,13 +94,13 @@ import java.lang.reflect.Type;
|
||||
* private String myString = "hello";
|
||||
*
|
||||
* // bind(Object.class).toProvider(myProvider);
|
||||
* {@literal @}Bind private Provider{@code <Object>} myProvider = getProvider();
|
||||
* {@literal @}Bind private Provider<Object> myProvider = getProvider();
|
||||
*
|
||||
* {@literal @}Before public void setUp() {
|
||||
* Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
|
||||
* }
|
||||
* }
|
||||
* </code></pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @see Bind
|
||||
* @author eatnumber1@google.com (Russ Harmon)
|
||||
@@ -129,7 +129,7 @@ public final class BoundFieldModule implements Module {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper of BoundFieldModule which enables attaching {@link @RestrictedBindingSource} permits to
|
||||
* Wrapper of BoundFieldModule which enables attaching {@code @RestrictedBindingSource} permits to
|
||||
* instances of it.
|
||||
*
|
||||
* <p>To create an instance of BoundFieldModule with permits (to enable it to bind restricted
|
||||
|
||||
@@ -120,6 +120,7 @@ See the Apache License Version 2.0 for the specific language governing permissio
|
||||
| The last stable release version id, used for generating API diffs between released versions
|
||||
-->
|
||||
<guice.lastStableRelease>5.1.0</guice.lastStableRelease>
|
||||
<guice.skipTests>false</guice.skipTests>
|
||||
<gpg.skip>true</gpg.skip>
|
||||
</properties>
|
||||
|
||||
@@ -302,6 +303,7 @@ See the Apache License Version 2.0 for the specific language governing permissio
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<configuration>
|
||||
<skipTests>${guice.skipTests}</skipTests>
|
||||
<redirectTestOutputToFile>true</redirectTestOutputToFile>
|
||||
<!--<argLine>-Dguice_include_stack_traces=OFF</argLine>-->
|
||||
</configuration>
|
||||
@@ -388,6 +390,7 @@ See the Apache License Version 2.0 for the specific language governing permissio
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<doclint>html,syntax</doclint>
|
||||
<source>8</source>
|
||||
<author>false</author>
|
||||
<protected>true</protected>
|
||||
|
||||
@@ -1,24 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
echo -e "Generating latest javadoc & JDiff...\n"
|
||||
|
||||
if [-d "build/docs"]; then
|
||||
if [[ -d "build/docs" ]]; then
|
||||
rm -r build/docs
|
||||
fi
|
||||
|
||||
mkdir -p build/docs/{javadoc,api-diffs}
|
||||
|
||||
mvn clean install
|
||||
mvn javadoc:aggregate
|
||||
mvn clean install -Dguice.skipTests=true
|
||||
mvn javadoc:aggregate -Dguice.skipTests=true
|
||||
cp -r target/site/apidocs/* build/docs/javadoc
|
||||
|
||||
cp util/api-diffs.index.html build/docs/api-diffs/index.html
|
||||
|
||||
mvn spf4j-jdiff:jdiff -pl core
|
||||
mvn spf4j-jdiff:jdiff -pl core -Dguice.skipTests=true
|
||||
cp -r core/target/site/api-diffs/* build/docs/api-diffs/
|
||||
|
||||
for EXT in assistedinject dagger-adapter grapher jmx jndi persist servlet spring struts2 testlib throwingproviders
|
||||
EXTENSIONS=( $(ls -1 $(dirname $0)/../extensions) )
|
||||
for ext in "${EXTENSIONS[@]}"
|
||||
do
|
||||
mvn spf4j-jdiff:jdiff -pl extensions/$EXT
|
||||
cp -r extensions/$EXT/target/site/api-diffs/* build/docs/api-diffs/
|
||||
if [[ -f extensions/$ext/pom.xml ]]; then
|
||||
echo -e "Generating latest API diff for extension ${ext}\n"
|
||||
mvn spf4j-jdiff:jdiff -pl extensions/$ext -Dguice.skipTests=true
|
||||
cp -r extensions/$ext/target/site/api-diffs/* build/docs/api-diffs/
|
||||
fi
|
||||
done
|
||||
|
||||
# Hacky way to remove the ugly blue background on jdiff reports
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
bash -e util/generate-latest-docs.sh
|
||||
set -eu
|
||||
|
||||
bash $(dirname $0)/generate-latest-docs.sh
|
||||
|
||||
echo -e "Publishing javadoc & JDiff...\n"
|
||||
mkdir -p $HOME/guice-docs/latest
|
||||
cp -R build/docs/* $HOME/guice-docs/latest/
|
||||
|
||||
Reference in New Issue
Block a user