Skip to content

Commit 6e8813b

Browse files
authored
Fix error messages in validation task of builder processor. (#7070)
1 parent 5ccca37 commit 6e8813b

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

builder/processor/src/main/java/io/helidon/builder/processor/ValidationTask.java

+20-8
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ private static void validateFactoryMethod(Errors.Collector errors,
7575
/**
7676
* Validate runtime object that is configured by a prototype.
7777
* <p>
78-
* If annotated by @ConfiguredBy
78+
* If annotated by {@value io.helidon.builder.processor.Types#RUNTIME_PROTOTYPE}
7979
* - RuntimeType must have "static RuntimeType create(ConfigObject)"
8080
* - RuntimeType must have "static RuntimeType create(Consumer<ConfigObject.Builder>)
81-
* - must implement ConfiguredType
81+
* - must implement {@value io.helidon.builder.processor.Types#RUNTIME_OBJECT}
8282
*/
8383
static class ValidateConfiguredType extends ValidationTask {
8484
private final TypeInfo runtimeTypeInfo;
@@ -101,8 +101,12 @@ static class ValidateConfiguredType extends ValidationTask {
101101
new ValidateCreateWithConsumerMethod(configObjectWithTypeParams, runtimeTypeInfo),
102102
new ValidateImplements(runtimeTypeInfo,
103103
configuredTypeInterface,
104-
"Type annotated with @ConfiguredBy(" + configObjectType.className()
105-
+ ".class) must implement ConfiguredType<"
104+
"Type annotated with @"
105+
+ RUNTIME_PROTOTYPE_TYPE.classNameWithEnclosingNames()
106+
+ "(" + configObjectType.className()
107+
+ ".class) must implement "
108+
+ RUNTIME_OBJECT_TYPE.classNameWithEnclosingNames()
109+
+ "<"
106110
+ configObjectWithTypeParams.classNameWithTypes() + ">")
107111
);
108112
}
@@ -223,7 +227,9 @@ public void validate(Errors.Collector errors) {
223227
TypeName.builder(RUNTIME_OBJECT_TYPE)
224228
.addTypeArgument(configObjectType.boxed())
225229
.build(),
226-
"As " + blueprintInfo.typeName().fqName() + " implements Factory<"
230+
"As " + blueprintInfo.typeName().fqName() + " implements "
231+
+ Types.PROTOTYPE_FACTORY_TYPE.classNameWithEnclosingNames()
232+
+ "<"
227233
+ runtimeTypeInfo.typeName().fqName() + ">, the runtime type must implement(or extend) "
228234
+ "interface " + RUNTIME_OBJECT_TYPE.fqName() + "<" + configObjectType.className() + ">"
229235
);
@@ -300,7 +306,9 @@ public void validate(Errors.Collector errors) {
300306
runtimeTypeInfo.typeName(),
301307
"create",
302308
configObjectType,
303-
"As " + fqName + " is annotated with @RuntimeType.PrototypedBy("
309+
"As " + fqName + " is annotated with @"
310+
+ RUNTIME_PROTOTYPE_TYPE.classNameWithEnclosingNames()
311+
+ "("
304312
+ configObjectType.className()
305313
+ "), the type must implement the following "
306314
+ "method:\n"
@@ -340,7 +348,9 @@ public void validate(Errors.Collector errors) {
340348
runtimeTypeInfo.typeName(),
341349
"create",
342350
consumerArgument,
343-
"As " + configObjectType.fqName() + " implements Factory<"
351+
"As " + configObjectType.fqName() + " implements "
352+
+ Types.PROTOTYPE_FACTORY_TYPE.classNameWithEnclosingNames()
353+
+ "<"
344354
+ runtimeTypeInfo.typeName()
345355
.fqName() + ">, the type " + runtimeTypeInfo.typeName().className()
346356
+ " must implement the following "
@@ -384,7 +394,9 @@ public void validate(Errors.Collector errors) {
384394
configObjectBuilder,
385395
"builder",
386396
null,
387-
"As " + configObjectType.fqName() + " implements Factory<"
397+
"As " + configObjectType.fqName() + " implements "
398+
+ Types.PROTOTYPE_FACTORY_TYPE.classNameWithEnclosingNames()
399+
+ "<"
388400
+ runtimeTypeInfo.typeName()
389401
.fqName() + ">, the runtime type must implement the following "
390402
+ "method:\n"

0 commit comments

Comments
 (0)