-
Notifications
You must be signed in to change notification settings - Fork 340
Java class and record generators and friends side-by-side #970
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
base: main
Are you sure you want to change the base?
Changes from all commits
3a3916e
baec91e
c4374b1
b9d9af6
986a98a
305b251
e594176
e75aa3c
f5a883d
329257a
fe09e8c
0930f75
145eea4
8c855b6
edc5d82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,21 +77,37 @@ data class CliJavaCodeGeneratorOptions( | |
| * Pkl module name, and the value is the desired replacement. | ||
| */ | ||
| val renames: Map<String, String> = emptyMap(), | ||
|
|
||
| /** | ||
| * Whether to generate Java records and the related interfaces. | ||
| * | ||
| * This overrides any Java class generation related options! | ||
| */ | ||
| val generateRecords: Boolean = false, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should just flip this around and have a flag called By default, the code generator should be generating records whenever it can (all Pkl users are on Java 17).
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding flipping
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that's okay; for users that want minimal breakage, they can add
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we follow the industry practice of deprecation, keep things as compatible as possible for one, two releases before make it the breaking change? I guess, until Pkl goes 1.0.0 we could've followed Kotlin's model of making such breaking changes after a couple of minor releases, especially when it doesn't change the Pkl itself?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The downside of that is: it is harder for new users that are adopting Pkl (the code generator has less sensible defaults). We usually try to minimize breaking changes, but this one feels quite tolerable to me. I'm also okay with already making the |
||
|
|
||
| /** Whether to generate JEP 468 like withers for records. */ | ||
| val useWithers: Boolean = false, | ||
|
|
||
| /** Whether to generate Lombok Builders for records. */ | ||
| val useLombokBuilders: Boolean = false, | ||
| ) { | ||
| @Suppress("DeprecatedCallableAddReplaceWith") | ||
| @Deprecated("deprecated without replacement") | ||
| fun toJavaCodegenOptions() = toJavaCodeGeneratorOptions() | ||
|
|
||
| internal fun toJavaCodeGeneratorOptions() = | ||
| JavaCodeGeneratorOptions( | ||
| indent, | ||
| addGeneratedAnnotation, | ||
| generateGetters, | ||
| generateJavadoc, | ||
| generateSpringBootConfig, | ||
| paramsAnnotation, | ||
| nonNullAnnotation, | ||
| implementSerializable, | ||
| renames, | ||
| indent = indent, | ||
| addGeneratedAnnotation = addGeneratedAnnotation, | ||
| generateGetters = generateGetters, | ||
| generateJavadoc = generateJavadoc, | ||
| generateSpringBootConfig = generateSpringBootConfig, | ||
| paramsAnnotation = paramsAnnotation, | ||
| nonNullAnnotation = nonNullAnnotation, | ||
| implementSerializable = implementSerializable, | ||
| renames = renames, | ||
| generateRecords = generateRecords, | ||
| useWithers = useWithers, | ||
| useLombokBuilders = useLombokBuilders, | ||
| ) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.