You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The config metadata processor fails to recognize the HealthSupport.Builder class as a builder. This is because that class does not declare implements io.helidon.common.Builder but rather extends HelidonRestServiceSupport.Builder<Builder, HealthSupport> which does implement that interface.
Further, adding an explicit implements to work around that problem shows that ConfigMetadataHandler#isBuilderMethod fails to correctly identify inherited builder methods.
Steps to reproduce
cd helidon/health/health
mvn clean install
cat target/classes/META-INF/helidon/config-metadata.json
Then, explicitly add implements io.helidon.common.Builder<HealthSupport.Builder, HealthSupport> to the HealthSupport.Builder declaration and rebuild. The JSON output contains this:
Because the superclass declares the implements clause (using type parameters) that should be sufficient for the config metadata processor to identify the subclass as a builder; I should not have to add the implements clause redundantly to the subclass.
Note that the output does not include the inherited builder methods. Potential problems (illustrated by HealthSupport.Builder):
ConfigMetadataHandler#processBuilderType restricts its scan using isMine but that seems to ignore inherited methods which, contrary to the comment, have not already been handled. At least they did not seem to be when I stepped through the code.
The comparison of the return type of candidate builder methods to the type of the class being analyzed fails when the builder method is inherited. For example, a superclass builder method returns B (the type parameter) which does not match the type of the concrete inheriting builder class. A workaround would be to add @ConfiguredOption to such methods but that should not be needed.
HealthSupport.Builder extends HelidonRestServiceSupport.Builder which has (among others) the crossOriginConfig method annotated with @ConfiguredOption (to work around item 2 above). But in trying to decide if that method is a builder method the findAnnotation method sees no annotation mirrors in the ExecutableElement for that method. So it does not recognize the method as a builder method and excludes the config information.
The text was updated successfully, but these errors were encountered:
tjquinno
changed the title
Config metadata processor does not recognize builder
Config metadata processor does not recognize builder and inherited builder methods
Jun 14, 2022
Environment Details
Problem Description
The config metadata processor fails to recognize the
HealthSupport.Builder
class as a builder. This is because that class does not declareimplements io.helidon.common.Builder
but rather extendsHelidonRestServiceSupport.Builder<Builder, HealthSupport>
which does implement that interface.Further, adding an explicit
implements
to work around that problem shows thatConfigMetadataHandler#isBuilderMethod
fails to correctly identify inherited builder methods.Steps to reproduce
cd helidon/health/health mvn clean install cat target/classes/META-INF/helidon/config-metadata.json
and you see (in part)
Then, explicitly add
implements io.helidon.common.Builder<HealthSupport.Builder, HealthSupport>
to theHealthSupport.Builder
declaration and rebuild. The JSON output contains this:Because the superclass declares the
implements
clause (using type parameters) that should be sufficient for the config metadata processor to identify the subclass as a builder; I should not have to add theimplements
clause redundantly to the subclass.Note that the output does not include the inherited builder methods. Potential problems (illustrated by
HealthSupport.Builder
):ConfigMetadataHandler#processBuilderType
restricts its scan usingisMine
but that seems to ignore inherited methods which, contrary to the comment, have not already been handled. At least they did not seem to be when I stepped through the code.B
(the type parameter) which does not match the type of the concrete inheriting builder class. A workaround would be to add@ConfiguredOption
to such methods but that should not be needed.HealthSupport.Builder
extendsHelidonRestServiceSupport.Builder
which has (among others) thecrossOriginConfig
method annotated with@ConfiguredOption
(to work around item 2 above). But in trying to decide if that method is a builder method thefindAnnotation
method sees no annotation mirrors in theExecutableElement
for that method. So it does not recognize the method as a builder method and excludes the config information.The text was updated successfully, but these errors were encountered: