David Herman
05/08/2024, 1:07 AMkotlin.Any
as a type while return true for anotherType.isAssignableFrom(typeThatIsInThisCaseDynamic)
David Herman
05/08/2024, 1:08 AMAny
types in my codebase as a workaround, but wondering if there's something cleaner (especially since dynamic
is a JS only concept I believe)David Herman
05/08/2024, 1:31 AMKSDynamicReference
class but when I try to check property.type.element
to see if it's dynamic, it is null instead.
If I could write if (property.type.element is KSDyanimicReference)
I would be happy with that 🙂Jiaxiang
05/08/2024, 4:55 PMDavid Herman
05/08/2024, 5:21 PMkp.useKSP2=true
and I'm getting an NPE in KSP
Caused by: 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)
at com.google.devtools.ksp.impl.symbol.kotlin.KSPropertyDeclarationImpl$annotations$2$4.invoke(KSPropertyDeclarationImpl.kt:71)
at com.google.devtools.ksp.impl.symbol.kotlin.KSPropertyDeclarationImpl$annotations$2$4.invoke(KSPropertyDeclarationImpl.kt:67)
at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:171)
at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:316)
at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303)
at kotlin.sequences.SequencesKt___SequencesKt.any(_Sequences.kt:1236)
at com.google.devtools.ksp.common.visitor.CollectAnnotatedSymbolsVisitor.visitAnnotated(CollectAnnotatedSymbolsVisitor.kt:37)
at com.google.devtools.ksp.common.visitor.CollectAnnotatedSymbolsVisitor.visitPropertyDeclaration(CollectAnnotatedSymbolsVisitor.kt:82)
at com.google.devtools.ksp.common.visitor.CollectAnnotatedSymbolsVisitor.visitPropertyDeclaration(CollectAnnotatedSymbolsVisitor.kt:33)
at com.google.devtools.ksp.impl.symbol.kotlin.KSPropertyDeclarationImpl.accept(KSPropertyDeclarationImpl.kt:168)
at com.google.devtools.ksp.common.visitor.CollectAnnotatedSymbolsVisitor.visitFile(CollectAnnotatedSymbolsVisitor.kt:43)
at com.google.devtools.ksp.common.visitor.CollectAnnotatedSymbolsVisitor.visitFile(CollectAnnotatedSymbolsVisitor.kt:33)
at com.google.devtools.ksp.impl.symbol.kotlin.KSFileImpl.accept(KSFileImpl.kt:84)
at com.google.devtools.ksp.impl.ResolverAAImpl.collectAnnotatedSymbols(ResolverAAImpl.kt:578)
at com.google.devtools.ksp.impl.ResolverAAImpl.access$collectAnnotatedSymbols(ResolverAAImpl.kt:81)
at com.google.devtools.ksp.impl.ResolverAAImpl$newAnnotatedSymbols$2.invoke(ResolverAAImpl.kt:589)
at com.google.devtools.ksp.impl.ResolverAAImpl$newAnnotatedSymbols$2.invoke(ResolverAAImpl.kt:588)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.google.devtools.ksp.impl.ResolverAAImpl.getNewAnnotatedSymbols(ResolverAAImpl.kt:588)
at com.google.devtools.ksp.impl.ResolverAAImpl.getSymbolsWithAnnotation(ResolverAAImpl.kt:570)
at com.google.devtools.ksp.processing.Resolver.getSymbolsWithAnnotation$default(Resolver.kt:48)
at com.varabyte.kobweb.ksp.frontend.FrontendProcessor.process(FrontendProcessor.kt:80)
where FrontendProcessor#80 in my code looks like:
resolver.getSymbolsWithAnnotation(INIT_KOBWEB_FQN).map { annotatedFun ->
Don't have a lot of time to look into this right now unfortunatelyDavid Herman
05/08/2024, 5:22 PMksp = "1.9.23-1.0.20"
in case that's the problem)Jiaxiang
05/08/2024, 5:23 PMDavid Herman
05/08/2024, 5:23 PMval jsTest = js("2 + 2")
and then check yourself if override fun visitPropertyDeclaration(property: KSPropertyDeclaration, data: Unit)
gives you a property with a dynamic type element.David Herman
05/08/2024, 5:24 PMJiaxiang
05/08/2024, 5:25 PMDavid Herman
05/08/2024, 5:25 PMTing-Yuan Huang
05/09/2024, 6:17 PMTing-Yuan Huang
05/09/2024, 6:21 PMKSType
is dynamic or not. KSDyanimicReference
is a thing at the reference site. After resolving to a KSType
, the reference site information is gone.Ting-Yuan Huang
05/09/2024, 6:26 PMproperty.type.element
is null because there is no explicit type mentioned in the source.David Herman
05/09/2024, 6:27 PMAny
type, I don't ever want to support it anyway.David Herman
05/09/2024, 6:28 PMIn your test case,is null because there is no explicit type mentioned in the source.property.type.element
Ah got it!
Ting-Yuan Huang
05/09/2024, 6:29 PMDavid Herman
05/09/2024, 6:30 PMRohit
05/27/2024, 5:47 AM#ksp
ksp.useKSP2=true
id("com.google.devtools.ksp") version "2.0.0-1.0.21"
* What went wrong:
Execution failed for task ':pitaraShared:kspKotlinIosSimulatorArm64'.
> A failure occurred while executing com.google.devtools.ksp.gradle.KspAAWorkerAction
> null cannot be cast to non-null type org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl