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

DeserializedTypeAliasDescriptor does not support ArrayList type‘s property #181

Closed
oooplz opened this issue Dec 4, 2020 · 3 comments
Closed

Comments

@oooplz
Copy link

oooplz commented Dec 4, 2020

example:

class FooProcessor : SymbolProcessor {

    private lateinit var logger: KSPLogger

    override fun init(options: Map<String, String>, kotlinVersion: KotlinVersion, codeGenerator: CodeGenerator, logger: KSPLogger) {
        this.logger = logger
    }

    override fun process(resolver: Resolver) {
        resolver
            .getSymbolsWithAnnotation(Foo::class.qualifiedName!!)
            .filterIsInstance<KSClassDeclaration>()
            .forEach {
                it
                    .getAllProperties()
                    .forEach {property ->
                        property.type.resolve().declaration.qualifiedName
                    }
            }
    }

    override fun finish() {}

}

annotation class Foo

@Foo
class Employee(
    // ok
    val property1: List<String>,

    // error
    val property2: ArrayList<String>
)

when resolve property2 will throw:

java.lang.IllegalStateException: Unexpected descriptor type: class org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedTypeAliasDescriptor, please file a bug at https://github.com/google/ksp/issues/new
@oooplz oooplz changed the title DeserializedTypeAliasDescriptor does not support List subclass DeserializedTypeAliasDescriptor does not support ArrayList class Dec 4, 2020
@oooplz oooplz changed the title DeserializedTypeAliasDescriptor does not support ArrayList class DeserializedTypeAliasDescriptor does not support ArrayList type‘s property Dec 4, 2020
@neetopia
Copy link
Contributor

neetopia commented Dec 4, 2020

Descriptor based implementation for type alias is missing, need to add it.

@neetopia
Copy link
Contributor

neetopia commented Dec 4, 2020

a potential mitigation is to import ArrayList explicitly, it works for #173

@neetopia
Copy link
Contributor

neetopia commented Dec 4, 2020

#182 fixes this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants