Skip to content

Commit

Permalink
Fix error messages in validation task of builder processor. (#7070)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-langer authored Jun 23, 2023
1 parent 5ccca37 commit 6e8813b
Showing 1 changed file with 20 additions and 8 deletions.
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

0 comments on commit 6e8813b

Please sign in to comment.