@BindValue fields cannot be private.
See original GitHub issueHilt is generating my public @BindValue kotlin properties as private and complaining about it:
@HiltAndroidTest
@UninstallModules(
AuthenticationStorageModule::class,
)
@RunWith(AndroidJUnit4::class)
//@Config(application = HiltTestApplication::class) // For Robolectric tests
class MainActivityInstrumentedTest {
@get:Rule(order = 0) var hiltRule = HiltAndroidRule(this)
@get:Rule(order = 1) var activityScenarioRule = activityScenarioRule<MainActivity>(null)
@Before fun init() = hiltRule.inject()
@BindValue
val ftueData = object : FirstTimeUserExperienceData {
override var hasOnboardingBeenCompleted = false
override var hasNotificationAllowed = false
override var hasFindMyDeviceCompleted = false
}
@BindValue
val authenticationData = object : AuthenticationData {
override var name = ""
override var emailAdress = ""
}
@Test fun test() = runBlockingTest { }
}
below is the error from Hilt:
.../build/tmp/kapt3/stubs/debugAndroidTest/com/my/app/MainActivityInstrumentedTest.java:31: error: [Hilt]
private final com.my.app.storage.FirstTimeUserExperienceData ftueData = null;
^
@BindValue fields cannot be private. Found: ftueData
[Hilt] Processing did not complete. See error above for details.warning: File for type
'com.my.app.MainActivityInstrumentedTest_HiltComponents' created in the last round will not be subject to annotation processing.
warning: File for type 'com.my.app.MainActivityInstrumentedTest_ComponentDataHolder' created in the last round will not be subject to annotation processing.
warning: File for type 'dagger.hilt.android.internal.testing.TestComponentDataSupplierImpl' created in the last round will not be subject to annotation processing.
warning: The following options were not recognized by any processor: '[dagger.fastInit, dagger.hilt.android.internal.disableAndroidSuperclassValidation, kapt.kotlin.generated]'
[WARN] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: android.databinding.annotationprocessor.ProcessDataBinding (DYNAMIC).
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
Impossible to use BindValue in the SELECT field names?
It seems bindValue is adding quotes to my variable, which is fine in the ORDER BY, but creates problems in the fields i...
Read more >PDOStatement::bindParam - Manual - PHP
Binds a PHP variable to a corresponding named or question mark placeholder in the SQL statement that was used to prepare the statement....
Read more >Text Field - MudBlazor - Blazor Component Library
When you bind value types, the text field will not be empty even if the user hasn't entered a value yet because a...
Read more >ASP.NET Core Blazor data binding - Microsoft Learn
Razor components provide data binding features with the @bind Razor directive attribute with a field, property, or Razor expression value.
Read more >How do you use bind-value and bind-value:event on a custom ...
Couldn't find the FAQs you're looking for? Please submit your question and answer. Platform.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Computr0n , for now I think either
@BindValue lateinit var
or@BindValue @JvmField val
will work.We do have plans to make this work with just
@BindValue var
, but we haven’t gotten to this yet.Thanks for the heads up on the documentation! That should be fixed now.