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

Don't map Java types in annotation parameters #703

Merged
merged 1 commit into from
Oct 28, 2021

Conversation

ting-yuan
Copy link
Collaborator

Users may specify Java types explicitly by instances of Class<T>.
The situation is similar to getClassDeclarationByName where we have
decided to keep those Java types not mapped.

It would be troublesome if users try to use reflection on types that
were mapped to Kotlin builtins, becuase some of those builtins don't
even exist in classpath.

Users may specify Java types explicitly by instances of `Class<T>`.
The situation is similar to `getClassDeclarationByName` where we have
decided to keep those Java types not mapped.

It would be troublesome if users try to use reflection on types that
were mapped to Kotlin builtins, becuase some of those builtins don't
even exist in classpath.
val componentType = resolveJavaTypeSimple(psiType.componentType)
val componentTypeRef = ResolverImpl.instance.createKSTypeReferenceFromKSType(componentType)
val typeArgs = listOf(ResolverImpl.instance.getTypeArgument(componentTypeRef, Variance.INVARIANT))
ResolverImpl.instance.builtIns.arrayType.replace(typeArgs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The array type in builtins are also kotlin.Array, which still looks like a Kotlin type to me?

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

Successfully merging this pull request may close these issues.

None yet

2 participants