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

Generating a Kotlin project with a package name containing keywords will result in an unusable project #1550

Closed
Ant00000ny opened this issue Jul 2, 2024 · 4 comments

Comments

@Ant00000ny
Copy link
Contributor

For example if package name is fun.fantasea.demo, generated project files are like below:

image image

Correct package name should be

`fun`.fantasea.demo
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 2, 2024
@mhalbritter mhalbritter changed the title Generating a Kotlin project with a package name containing 'fun' will result in a syntax error. Generating a Kotlin project with a package name containing keywords will result in an unusable project Jul 3, 2024
@mhalbritter mhalbritter added type: bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 3, 2024
@mhalbritter
Copy link
Contributor

mhalbritter commented Jul 3, 2024

For (Java) projects, we use io.spring.initializr.metadata.InitializrConfiguration#hasReservedKeyword to check for reserved keywords. We should do something similar for Kotlin. It could even be that Kotlin generated projects are checked against Java keywords, which might be another bug.

Not sure if there's a list in the Kotlin source usable somewhere, but the keywords are documented here.

@Ant00000ny
Copy link
Contributor Author

Ant00000ny commented Jul 3, 2024

Maybe we can use kotlin.reflect.jvm.internal.impl.renderer.KeywordStringsGenerated#KEYWORDS for this? Didn't find any documentation explaining its purpose, but the list matches the hard keywords in the documentation though.

@mhalbritter
Copy link
Contributor

Maybe. jvm.internal.impl doesn't sound like public API, though.

@mhalbritter
Copy link
Contributor

Superseded by #1555. Thanks @Ant00000ny!

@mhalbritter mhalbritter closed this as not planned Won't fix, can't repro, duplicate, stale Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants