Skip to content

Commit

Permalink
Handle default package name when generating class names
Browse files Browse the repository at this point in the history
Fixes #13540
  • Loading branch information
maxandersen committed Nov 29, 2020
1 parent 3a7f715 commit db09061
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
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

0 comments on commit db09061

Please sign in to comment.