Skip to content

fix: expose raw typed annotation lookup - #3092

Open
mvanhorn wants to merge 1 commit into
google:mainfrom
mvanhorn:fix/1038-bug-classnotfoundexception-but-it-does-exist-in
Open

fix: expose raw typed annotation lookup#3092
mvanhorn wants to merge 1 commit into
google:mainfrom
mvanhorn:fix/1038-bug-classnotfoundexception-but-it-does-exist-in

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Add an experimental getKSAnnotationsByType() utility that reuses the existing short-name and qualified-name matching logic while returning Sequence<KSAnnotation> without constructing annotation proxies. KSAnnotated.getAnnotationsByType() still converts every matching KSAnnotation into a runtime annotation proxy.

A source annotation with one KClass member and an array of KClass members is found through getKSAnnotationsByType(), and the processor reads the expected qualified names from the raw KSType argument values without throwing; Built-in, source-declared, array, and generic array class literals remain distinguishable through the raw values, while the existing typed lookup continues to match the same annotation and retain its established proxy behavior.

Fixes #1038

@jaschdoc

Copy link
Copy Markdown
Collaborator

Hi @mvanhorn, thanks for the PR! Could you add a test for this first in a separate PR? See https://github.com/google/ksp/blob/main/CONTRIBUTING.md for more information :)

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.

Bug: ClassNotFoundException, but it does exist in the project

2 participants