MCPcopy Create free account
hub / github.com/google/guice / withTrustedSource

Method withTrustedSource

core/src/com/google/inject/spi/Elements.java:136–144  ·  view source on GitHub ↗

Internal version of Binder.withSource for establishing a trusted ElementSource chain for source-restricting bindings that are re-written using Element#applyTo. Using Binder.withSource is not trustworthy because it's a public API that external users can use to spoof the original ElementSo

(
      GuiceInternal guiceInternal, Binder binder, Object source)

Source from the content-addressed store, hash-verified

134 * @since 5.0
135 */
136 public static Binder withTrustedSource(
137 GuiceInternal guiceInternal, Binder binder, Object source) {
138 checkNotNull(guiceInternal);
139 if (binder instanceof RecordingBinder) {
140 return ((RecordingBinder) binder).withTrustedSource(source);
141 }
142 // Preserve existing (untrusted) behavior for non-standard Binder implementations.
143 return binder.withSource(source);
144 }
145
146 private static class ElementsAsModule implements Module {
147 private final Iterable<? extends Element> elements;

Callers 6

applyToMethod · 0.45
applyToMethod · 0.45
applyToMethod · 0.45
applyToMethod · 0.45
applyToMethod · 0.45
applyToMethod · 0.45

Calls 2

checkNotNullMethod · 0.80
withSourceMethod · 0.65

Tested by

no test coverage detected