Skip to content

Fix error messages in validation task of builder processor. #7070

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

Merged
Merged
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 @@ -75,10 +75,10 @@ private static void validateFactoryMethod(Errors.Collector errors,
/**
* Validate runtime object that is configured by a prototype.
* <p>
* If annotated by @ConfiguredBy
* If annotated by {@value io.helidon.builder.processor.Types#RUNTIME_PROTOTYPE}
* - RuntimeType must have "static RuntimeType create(ConfigObject)"
* - RuntimeType must have "static RuntimeType create(Consumer<ConfigObject.Builder>)
* - must implement ConfiguredType
* - must implement {@value io.helidon.builder.processor.Types#RUNTIME_OBJECT}
*/
static class ValidateConfiguredType extends ValidationTask {
private final TypeInfo runtimeTypeInfo;
Expand All @@ -101,8 +101,12 @@ static class ValidateConfiguredType extends ValidationTask {
new ValidateCreateWithConsumerMethod(configObjectWithTypeParams, runtimeTypeInfo),
new ValidateImplements(runtimeTypeInfo,
configuredTypeInterface,
"Type annotated with @ConfiguredBy(" + configObjectType.className()
+ ".class) must implement ConfiguredType<"
"Type annotated with @"
+ RUNTIME_PROTOTYPE_TYPE.classNameWithEnclosingNames()
+ "(" + configObjectType.className()
+ ".class) must implement "
+ RUNTIME_OBJECT_TYPE.classNameWithEnclosingNames()
+ "<"
+ configObjectWithTypeParams.classNameWithTypes() + ">")
);
}
Expand Down Expand Up @@ -223,7 +227,9 @@ public void validate(Errors.Collector errors) {
TypeName.builder(RUNTIME_OBJECT_TYPE)
.addTypeArgument(configObjectType.boxed())
.build(),
"As " + blueprintInfo.typeName().fqName() + " implements Factory<"
"As " + blueprintInfo.typeName().fqName() + " implements "
+ Types.PROTOTYPE_FACTORY_TYPE.classNameWithEnclosingNames()
+ "<"
+ runtimeTypeInfo.typeName().fqName() + ">, the runtime type must implement(or extend) "
+ "interface " + RUNTIME_OBJECT_TYPE.fqName() + "<" + configObjectType.className() + ">"
);
Expand Down Expand Up @@ -300,7 +306,9 @@ public void validate(Errors.Collector errors) {
runtimeTypeInfo.typeName(),
"create",
configObjectType,
"As " + fqName + " is annotated with @RuntimeType.PrototypedBy("
"As " + fqName + " is annotated with @"
+ RUNTIME_PROTOTYPE_TYPE.classNameWithEnclosingNames()
+ "("
+ configObjectType.className()
+ "), the type must implement the following "
+ "method:\n"
Expand Down Expand Up @@ -340,7 +348,9 @@ public void validate(Errors.Collector errors) {
runtimeTypeInfo.typeName(),
"create",
consumerArgument,
"As " + configObjectType.fqName() + " implements Factory<"
"As " + configObjectType.fqName() + " implements "
+ Types.PROTOTYPE_FACTORY_TYPE.classNameWithEnclosingNames()
+ "<"
+ runtimeTypeInfo.typeName()
.fqName() + ">, the type " + runtimeTypeInfo.typeName().className()
+ " must implement the following "
Expand Down Expand Up @@ -384,7 +394,9 @@ public void validate(Errors.Collector errors) {
configObjectBuilder,
"builder",
null,
"As " + configObjectType.fqName() + " implements Factory<"
"As " + configObjectType.fqName() + " implements "
+ Types.PROTOTYPE_FACTORY_TYPE.classNameWithEnclosingNames()
+ "<"
+ runtimeTypeInfo.typeName()
.fqName() + ">, the runtime type must implement the following "
+ "method:\n"
Expand Down