[jOOQ/jOOQ#13718] Log warning should show jOOQ-meta type to help
disambiguate objects that share the same name
This commit is contained in:
parent
219e1604c2
commit
e08f2bf365
@ -729,9 +729,11 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
log.info("");
|
||||
}
|
||||
|
||||
private static final record Included(String name, Definition definition) {}
|
||||
|
||||
private class AvoidAmbiguousClassesFilter implements Database.Filter {
|
||||
|
||||
private Map<String, String> included = new HashMap<>();
|
||||
private Map<String, Included> included = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public boolean exclude(Definition definition) {
|
||||
@ -745,12 +747,20 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
// Check if we've previously encountered a Java type of the same case-insensitive, fully-qualified name.
|
||||
String name = getStrategy().getFullJavaClassName(definition);
|
||||
String nameLC = name.toLowerCase(getStrategy().getTargetLocale());
|
||||
String existing = included.put(nameLC, name);
|
||||
Included existing = included.put(nameLC, new Included(name, definition));
|
||||
|
||||
if (existing == null)
|
||||
return false;
|
||||
|
||||
log.warn("Ambiguous type name", "The object " + definition.getQualifiedOutputName() + " generates a type " + name + " which conflicts with the existing type " + existing + " on some operating systems. Use a custom generator strategy to disambiguate the types.");
|
||||
log.warn("Ambiguous type name",
|
||||
"The database object " + definition.getQualifiedOutputName()
|
||||
+ " generates a class " + name + " (" + definition.getClass() + ")"
|
||||
+ " which conflicts with the previously generated class " + existing.name() + " (" + existing.definition().getClass() + ")."
|
||||
+ " Use a custom generator strategy to disambiguate the types. More information here:\n"
|
||||
+ " - https://www.jooq.org/doc/latest/manual/code-generation/codegen-generatorstrategy/\n"
|
||||
+ " - https://www.jooq.org/doc/latest/manual/code-generation/codegen-matcherstrategy/"
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user