Skip to content
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

[GIB-TEST] Handle default package name when generating class names Fixes #13540 #13543

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ private String generateImplementation(ClassInfo defaultBundleInterface, String d
}

String targetPackage = DotNames.packageName(bundleInterface.name());
String generatedName = targetPackage.replace('.', '/') + "/" + baseName + SUFFIX;
String generatedName = (targetPackage.isEmpty() ? "" : targetPackage.replace('.', '/') + "/") + baseName + SUFFIX;

// MyMessages_Bundle implements MyMessages, Resolver
Builder builder = ClassCreator.builder().classOutput(classOutput).className(generatedName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ private String generateInvoker(ScheduledBusinessMethodItem scheduledMethod, Clas
sigBuilder.append(i.name().toString());
}
String targetPackage = DotNames.packageName(bean.getImplClazz().name());
String generatedName = targetPackage.replace('.', '/') + "/" + baseName + INVOKER_SUFFIX + "_" + method.name() + "_"
String generatedName = (targetPackage.isEmpty() ? "" : targetPackage.replace('.', '/') + "/") + baseName
+ INVOKER_SUFFIX + "_" + method.name() + "_"
+ HashUtil.sha1(sigBuilder.toString());

ClassCreator invokerCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,8 @@ private String generateHandler(HandlerDescriptor desc, BeanInfo bean, MethodInfo
for (Type i : method.parameters()) {
sigBuilder.append(i.name().toString());
}
String generatedName = targetPackage.replace('.', '/') + "/" + baseName + HANDLER_SUFFIX + "_" + method.name() + "_"
String generatedName = (targetPackage.isEmpty() ? "" : targetPackage.replace('.', '/') + "/") + baseName
+ HANDLER_SUFFIX + "_" + method.name() + "_"
+ HashUtil.sha1(sigBuilder.toString() + hashSuffix);

ClassCreator invokerCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ static String generateInvoker(BeanInfo bean, MethodInfo method,
for (Type i : method.parameters()) {
sigBuilder.append(i.name().toString());
}
String generatedName = targetPackage.replace('.', '/') + "/" + baseName + INVOKER_SUFFIX + "_" + method.name() + "_"
String generatedName = (targetPackage.isEmpty() ? "" : targetPackage.replace('.', '/') + "/") + baseName
+ INVOKER_SUFFIX + "_" + method.name() + "_"
+ HashUtil.sha1(sigBuilder.toString());

ClassCreator invokerCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static String generatedNameFromTarget(String targetPackage, String baseName, Str
if (targetPackage == null || targetPackage.isEmpty()) {
return baseName + suffix;
} else {
return targetPackage.replace('.', '/') + "/" + baseName + suffix;
return (targetPackage.isEmpty() ? "" : targetPackage.replace('.', '/') + "/") + baseName + suffix;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ static String generatedNameFromTarget(String targetPackage, String baseName, Str
} else if (targetPackage.startsWith("java")) {
return "io/quarkus/qute" + "/" + baseName + suffix;
} else {
return targetPackage.replace('.', '/') + "/" + baseName + suffix;
return (targetPackage.isEmpty() ? "" : targetPackage.replace('.', '/') + "/") + baseName + suffix;
}
}

Expand Down