Skip to content

Commit

Permalink
Internal change.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 531069248
  • Loading branch information
sameb authored and Guice Team committed May 11, 2023
1 parent bee813b commit 654032a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 23 deletions.
11 changes: 8 additions & 3 deletions core/src/com/google/inject/internal/InternalFlags.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -197,8 +197,13 @@ public String run() {
} 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;
}
}
Expand Down
24 changes: 12 additions & 12 deletions core/src/com/google/inject/internal/RealMapBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ public void configure(Binder binder) {
// 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
Expand All @@ -318,9 +318,9 @@ public void configure(Binder binder) {

// 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
Expand Down Expand Up @@ -1021,17 +1021,17 @@ public void configure(Binder binder) {
// 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
Expand Down
7 changes: 4 additions & 3 deletions core/src/com/google/inject/internal/RealMultibinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ public void configure(Binder binder) {
// 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() {
Expand Down Expand Up @@ -274,6 +274,7 @@ private InternalProvisionException newDuplicateValuesException(T[] values) {
bindingSelection.getSetKey(), bindings, values, ImmutableList.of(getSource())));
return new InternalProvisionException(message);
}

@SuppressWarnings("unchecked")
@Override
public <B, V> V acceptExtensionVisitor(
Expand Down
10 changes: 5 additions & 5 deletions core/src/com/google/inject/internal/RealOptionalBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ public void configure(Binder binder) {
// 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));
Expand Down

0 comments on commit 654032a

Please sign in to comment.