spring-io / initializr

A quickstart generator for Spring projects
https://start.spring.io
Apache License 2.0
3.45k stars 1.74k forks source link

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

Closed Ant00000ny closed 3 months ago

Ant00000ny commented 4 months ago

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
mhalbritter commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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

mhalbritter commented 3 months ago

Superseded by https://github.com/spring-io/initializr/pull/1555. Thanks @Ant00000ny!