spring-io/initializr

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

Ant00000ny opened this issue · 4 comments

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

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.

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.

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

Superseded by #1555. Thanks @Ant00000ny!