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

Annotation with backticks in the package name unrecognized #2172

Open
ting-yuan opened this issue Oct 25, 2024 · 1 comment
Open

Annotation with backticks in the package name unrecognized #2172

ting-yuan opened this issue Oct 25, 2024 · 1 comment

Comments

@ting-yuan
Copy link
Collaborator

Reported by Toshihiro Nakamura:

When using KSP2, it seems that the SymbolProcessor does not recognize annotations that contain backticks in the package name. For example, consider the following annotation:

@`org.komapper.annotation`.KomapperEntity
data class Employee(val id: Int)

The annotation is recognized by the SymbolProcessor in version 2.0.21-1.0.25, but it is not recognized in version 2.0.21-1.0.26.

@ting-yuan ting-yuan added this to the 1.0.27 milestone Oct 25, 2024
@ting-yuan ting-yuan removed this from the 1.0.27 milestone Nov 7, 2024
@ting-yuan
Copy link
Collaborator Author

ting-yuan commented Nov 7, 2024

@`com.example`.Anno is probably invalid on JVM according to the Kotlin language spec:

Kotlin supports escaping identifiers by enclosing any sequence of characters into backtick (`) characters, allowing to use any name as an identifier. This allows not only using non-alphanumeric characters (like @ or #) in names, but also using keywords like if or when as identifiers. Actual set of characters that is allowed to be escaped may, however, be a subject to platform restrictions. Consult particular platform sections for details.

Note: for example, the following characters are not allowed in identifiers used as declaration names on the JVM platform even when escaped due to JVM restrictions: ., ;, [, ], /, <, >, :, \ .

At least, I cannot find the definition of the interpretation of the dot inside backtick quotes. Whether `com.example` is illegal or is treated like `com`.`excample` depends on (the underlying Kotlin compiler) implementation.

@`com`.example.Anno and @com.`example`.Anno work fine.

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

1 participant