-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.30] NoSuchElementException in KotlinMetadata.java #2190
Comments
The same for me |
Thanks for reporting this. What Kotlin version are you on? Do you also happen to have KAPT's The likely cause of this issue is a 'weird' (possibly a delegate) property in a member injected class for which its type is generated. Something like this:
For these cases we have a workaround to a KAPT bug that seems to not be working for all cases: https://github.com/google/dagger/blob/master/java/dagger/internal/codegen/kotlin/KotlinMetadata.java#L257 We might need a bit more time to hunt this issue down, I don't think we'll have a patch release until next week, sorry. |
We are on Kotlin 1.4.10. We do have correctErrorTypes = true
mapDiagnosticLocations = true
useBuildCache = true
I will try with |
This is a bit of a stretch too but you can find out the class with the 'faulty' property if you attach a debugger, (we really need to publish instructions on how to do this), but basically you run a very big Gradle command:
Then in the IDE add a new run configuration of the 'Remote' category and when the command above start click the 'attach debug' icon. There are more instructions (with screenshots) in this comment. If you put a non-suspending breakpoint in |
Same stack trace with |
Hi, In our activity, we inject
Factory is used in a by viewModel delegation but removing delegation didn't have any effect. Without ViewModelFactory class
|
By any chance do you use Kotlin's Android extensions ( |
Yes, our module has |
I'll complement this answer with androidExtensions .kts version:
Just a small not also: |
I'm using When I set The error was not there in Dagger 2.29.1, it's just in 2.30. I tried debugging, but no luck getting any additional information so far. EDIT: Just saw @GuilhE's answer. Will try that out. EDIT2: Replacing |
Dagger matches fields with Kotlin property metadata to generate code that uses property getter methods and/or retrieve qualifier annotations. This CL makes it so that the matching is done lazily and only on fields Dagger is interested on (annotated with @Inject, @BindValue, etc) instead of attempting to match all fields of the TypeElement being processed. This makes it so that the strict requirement of a fields having property metadata is only enforced on relevant fields and other fields, such as those generated by compiler extensions and without metadata get ignored. Fixes: #2190 RELNOTES=Fix a bug where Dagger was unnecessarily inspecting all fields of a class and attempting to find their Kotlin metadata, failing to do so sometimes and crashing the processor. PiperOrigin-RevId: 343674753
Dagger matches fields with Kotlin property metadata to generate code that uses property getter methods and/or retrieve qualifier annotations. This CL makes it so that the matching is done lazily and only on fields Dagger is interested on (annotated with @Inject, @BindValue, etc) instead of attempting to match all fields of the TypeElement being processed. This makes it so that the strict requirement of a fields having property metadata is only enforced on relevant fields and other fields, such as those generated by compiler extensions and without metadata get ignored. Fixes: #2190 RELNOTES=Fix a bug where Dagger was unnecessarily inspecting all fields of a class and attempting to find their Kotlin metadata, failing to do so sometimes and crashing the processor. PiperOrigin-RevId: 343674753
Dagger matches fields with Kotlin property metadata to generate code that uses property getter methods and/or retrieve qualifier annotations. This CL makes it so that the matching is done lazily and only on fields Dagger is interested on (annotated with @Inject, @BindValue, etc) instead of attempting to match all fields of the TypeElement being processed. This makes it so that the strict requirement of a fields having property metadata is only enforced on relevant fields and other fields, such as those generated by compiler extensions and without metadata get ignored. Fixes: #2190 RELNOTES=Fix a bug where Dagger was unnecessarily inspecting all fields of a class and attempting to find their Kotlin metadata, failing to do so sometimes and crashing the processor. PiperOrigin-RevId: 343674753
Dagger matches fields with Kotlin property metadata to generate code that uses property getter methods and/or retrieve qualifier annotations. This CL makes it so that the matching is done lazily and only on fields Dagger is interested on (annotated with @Inject, @BindValue, etc) instead of attempting to match all fields of the TypeElement being processed. This makes it so that the strict requirement of a fields having property metadata is only enforced on relevant fields and other fields, such as those generated by compiler extensions and without metadata get ignored. Fixes: #2190 RELNOTES=Fix a bug where Dagger was unnecessarily inspecting all fields of a class and attempting to find their Kotlin metadata, failing to do so sometimes and crashing the processor. PiperOrigin-RevId: 343674753
Since updating to 2.30, compiling is failing during the
kapt
step. Here's the bottom of the stacktrace. Unfortunately I can't tell from this error where the problem occurs.The text was updated successfully, but these errors were encountered: