Skip to content
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

[KSP2] NPE when getting annotation arguments on non-Jvm targets #1823

Closed
DennisTsar opened this issue Apr 7, 2024 · 3 comments · Fixed by #2103
Closed

[KSP2] NPE when getting annotation arguments on non-Jvm targets #1823

DennisTsar opened this issue Apr 7, 2024 · 3 comments · Fixed by #2103
Labels
bug Something isn't working P2 affects usability but not blocks users
Milestone

Comments

@DennisTsar
Copy link
Contributor

Calling KSAnnotation.arguments for an annotation with arguments fails with KSP2 on non-Jvm targets with the following error:

java.lang.NullPointerException: null cannot be cast to non-null type org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl
	at com.google.devtools.ksp.impl.symbol.kotlin.UtilKt.getDefaultValue(util.kt:430)
	at com.google.devtools.ksp.impl.symbol.kotlin.KSAnnotationImpl$defaultArguments$2.invoke(KSAnnotationImpl.kt:88)
	at com.google.devtools.ksp.impl.symbol.kotlin.KSAnnotationImpl$defaultArguments$2.invoke(KSAnnotationImpl.kt:71)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at com.google.devtools.ksp.impl.symbol.kotlin.KSAnnotationImpl.getDefaultArguments(KSAnnotationImpl.kt:71)
	at com.google.devtools.ksp.impl.symbol.kotlin.KSAnnotationImpl$arguments$2.invoke(KSAnnotationImpl.kt:65)
	at com.google.devtools.ksp.impl.symbol.kotlin.KSAnnotationImpl$arguments$2.invoke(KSAnnotationImpl.kt:62)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at com.google.devtools.ksp.impl.symbol.kotlin.KSAnnotationImpl.getArguments(KSAnnotationImpl.kt:62)

Repro: DennisTsar@8449e19
This seems similar to #1798 , but does not involve Java in any way.

@ting-yuan ting-yuan added bug Something isn't working P1 major features or blocking bugs labels Apr 24, 2024
@ting-yuan ting-yuan added this to the 2.0 milestone Apr 24, 2024
@neetopia neetopia added P2 affects usability but not blocks users and removed P1 major features or blocking bugs labels May 7, 2024
@neetopia
Copy link
Contributor

neetopia commented May 7, 2024

This likely requires an upstream fix for metadata for klib.

@sureshmaidaragi1919
Copy link

Any timeline for this bug fix?

@neetopia
Copy link
Contributor

The dependent upstream issue is targeting Kotlin 2.1, we will likely have to wait until then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2 affects usability but not blocks users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants