[jOOQ/jOOQ#17247] Log warnings when Java record constructor has more than 254 parameters

This commit is contained in:
Lukas Eder 2024-09-16 13:22:39 +02:00
parent c8c567348a
commit 54a336685d

View File

@ -5965,6 +5965,28 @@ public class JavaGenerator extends AbstractGenerator {
});
out.println(")[[before= implements ][%s]] {", interfaces);
if (replacingEmbeddablesAndUnreplacedColumns.size() >= 255)
log.warn(
"""
{object} has more than 254 {elements}. There's no workaround that the code generator could implement out of the box.
Workarounds that could be implemented in your configuration include:
- Excluding the object from the code generation
- Switching to a different POJO style that doesn't require mandatory canonical constructors
- Use replacing embeddables to reduce the column number: https://www.jooq.org/doc/latest/manual/code-generation/codegen-embeddable-types/codegen-embeddable-types-replacing-fields/
""".replace("{object}",
tableUdtOrEmbeddable instanceof EmbeddableDefinition
? "Embeddable " + tableUdtOrEmbeddable
: tableUdtOrEmbeddable instanceof UDTDefinition
? "UDT " + tableUdtOrEmbeddable
: "Table " + tableUdtOrEmbeddable
).replace("{elements}",
tableUdtOrEmbeddable instanceof UDTDefinition
? "attributes"
: "columns"
));
}
else {
out.println("%s%sclass %s[[before= extends ][%s]][[before= implements ][%s]] {", visibility(), abstract_, className, list(superName), interfaces);