From 7e7ac3e60205acd29c5a1116143767e6273d2cf3 Mon Sep 17 00:00:00 2001 From: sameb Date: Thu, 4 Apr 2019 09:50:51 -0700 Subject: [PATCH] Add a note in isTransparentProvider that folks who trace through the code & detect that their binding isn't working because of this call should use @Bind(lazy=true) instead. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=241948208 --- .../google/inject/testing/fieldbinder/BoundFieldModule.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions/testlib/src/com/google/inject/testing/fieldbinder/BoundFieldModule.java b/extensions/testlib/src/com/google/inject/testing/fieldbinder/BoundFieldModule.java index b1eef16a6f..abaeb331db 100644 --- a/extensions/testlib/src/com/google/inject/testing/fieldbinder/BoundFieldModule.java +++ b/extensions/testlib/src/com/google/inject/testing/fieldbinder/BoundFieldModule.java @@ -387,6 +387,10 @@ private static boolean hasInject(Field field) { /** * Determines if {@code clazz} is a "transparent provider". * + *

If you have traced through the code and found that what you want to do is failing because of + * this check, try using {@code @Bind(lazy=true) MyType myField} and lazily assign myField + * instead. + * *

A transparent provider is a {@link com.google.inject.Provider} or {@link * javax.inject.Provider} which binds to it's parameterized type when used as the argument to * {@link Binder#bind}.