Internal change.

PiperOrigin-RevId: 531069248
This commit is contained in:
Sam Berlin
2023-05-10 19:42:14 -07:00
committed by Guice Team
parent bee813b7cc
commit 654032a954
4 changed files with 29 additions and 23 deletions
@@ -48,7 +48,7 @@ public final class InternalFlags {
public enum IncludeStackTraceOption {
/** No stack trace collection */
OFF,
/** Minimum stack trace collection (Default) */
/** Minimum stack trace collection (Default) */
ONLY_FOR_DECLARING_SOURCE,
}
@@ -197,8 +197,13 @@ public final class InternalFlags {
} catch (SecurityException e) {
return secureValue;
} catch (IllegalArgumentException e) {
logger.warning(value + " is not a valid flag value for " + name + ". "
+ " Values must be one of " + Arrays.asList(enumType.getEnumConstants()));
logger.warning(
value
+ " is not a valid flag value for "
+ name
+ ". "
+ " Values must be one of "
+ Arrays.asList(enumType.getEnumConstants()));
return defaultValue;
}
}
@@ -303,9 +303,9 @@ public final class RealMapBinder<K, V> implements Module {
// The map this exposes is internally an ImmutableMap, so it's OK to massage
// the guice Provider to jakarta Provider in the value (since Guice provider
// implements jakarta Provider).
binder
.bind(bindingSelection.getJakartaProviderMapKey())
.to((Key) bindingSelection.getProviderMapKey());
binder
.bind(bindingSelection.getJakartaProviderMapKey())
.to((Key) bindingSelection.getProviderMapKey());
// Bind Map<K, V> to the provider w/ extension support.
binder
@@ -318,9 +318,9 @@ public final class RealMapBinder<K, V> implements Module {
// The Map.Entries are all ProviderMapEntry instances which do not allow setValue, so it is
// safe to massage the return type like this
binder
.bind(bindingSelection.getEntrySetJakartaProviderKey())
.to((Key) bindingSelection.getEntrySetBinder().getSetKey());
binder
.bind(bindingSelection.getEntrySetJakartaProviderKey())
.to((Key) bindingSelection.getEntrySetBinder().getSetKey());
}
@Override
@@ -1021,17 +1021,17 @@ public final class RealMapBinder<K, V> implements Module {
// The collection this exposes is internally an ImmutableMap, so it's OK to massage
// the guice Provider to jakarta Provider in the value (since the guice Provider implements
// jakarta Provider).
binder
.bind(bindingSelection.getJakartaProviderSetMultimapKey())
.to((Key) bindingSelection.getProviderSetMultimapKey());
binder
.bind(bindingSelection.getJakartaProviderSetMultimapKey())
.to((Key) bindingSelection.getProviderSetMultimapKey());
binder
.bind(bindingSelection.getProviderCollectionMultimapKey())
.to((Key) bindingSelection.getProviderSetMultimapKey());
binder
.bind(bindingSelection.getJakartaProviderCollectionMultimapKey())
.to((Key) bindingSelection.getProviderSetMultimapKey());
binder
.bind(bindingSelection.getJakartaProviderCollectionMultimapKey())
.to((Key) bindingSelection.getProviderSetMultimapKey());
// Binds a Map<K, Set<V>>
binder
@@ -114,9 +114,9 @@ public final class RealMultibinder<T> implements Module {
// The collection this exposes is internally an ImmutableList, so it's OK to massage
// the guice Provider to jakarta Provider in the value (since the guice Provider implements
// jakarta Provider).
binder
.bind(bindingSelection.getCollectionOfJakartaProvidersKey())
.to((Key) bindingSelection.getCollectionOfProvidersKey());
binder
.bind(bindingSelection.getCollectionOfJakartaProvidersKey())
.to((Key) bindingSelection.getCollectionOfProvidersKey());
}
public void permitDuplicates() {
@@ -274,6 +274,7 @@ public final class RealMultibinder<T> implements Module {
bindingSelection.getSetKey(), bindings, values, ImmutableList.of(getSource())));
return new InternalProvisionException(message);
}
@SuppressWarnings("unchecked")
@Override
public <B, V> V acceptExtensionVisitor(
@@ -211,11 +211,11 @@ public final class RealOptionalBinder<T> implements Module {
// Provider is assignable to jakarta.inject.Provider and the provider that the factory contains
// cannot be modified so we can use some rawtypes hackery to share the same implementation.
// cgcb.Optional<jakarta.inject.Provider<T>>
binder.bind(key.ofType(optionalOfJakartaProvider(typeLiteral))).to((Key) guavaOptProviderKey);
// ju.Optional<jakarta.inject.Provider<T>>
binder
.bind(key.ofType(javaOptionalOfJakartaProvider(typeLiteral)))
.to((Key) javaOptProviderKey);
binder.bind(key.ofType(optionalOfJakartaProvider(typeLiteral))).to((Key) guavaOptProviderKey);
// ju.Optional<jakarta.inject.Provider<T>>
binder
.bind(key.ofType(javaOptionalOfJakartaProvider(typeLiteral)))
.to((Key) javaOptProviderKey);
// cgcb.Optional<T>
Key<Optional<T>> guavaOptKey = key.ofType(optionalOf(typeLiteral));