lburgazzoli commented on a change in pull request #647: Fix #518 Rely on 
configurers for Configuration classes instead of using
URL: https://github.com/apache/camel-quarkus/pull/647#discussion_r370090912
 
 

 ##########
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/NativeImageProcessor.java
 ##########
 @@ -68,6 +71,66 @@
                 PropertiesComponent.class,
                 DataFormat.class);
 
+        /**
+         * A list of classes annotated with <code>@UriParams</code> which we 
accept to be registered for reflection
+         * mostly because there are errors when they are removed. TODO: solve 
the underlying problems and remove as
+         * many entries as possible from the list.
+         */
+        private static final Set<String> URI_PARAMS_WHITELIST = new 
HashSet<>(Arrays.asList(
+                "org.apache.camel.support.processor.DefaultExchangeFormatter",
+                "org.apache.camel.component.pdf.PdfConfiguration",
+                "org.apache.camel.component.netty.NettyConfiguration",
+                
"org.apache.camel.component.netty.NettyServerBootstrapConfiguration",
+                
"org.apache.camel.component.fhir.FhirUpdateEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirOperationEndpointConfiguration",
+                "org.apache.camel.component.fhir.FhirConfiguration",
+                
"org.apache.camel.component.fhir.FhirLoadPageEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirSearchEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirTransactionEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirCreateEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirValidateEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirReadEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirCapabilitiesEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirHistoryEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirMetaEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirPatchEndpointConfiguration",
+                
"org.apache.camel.component.fhir.FhirDeleteEndpointConfiguration",
+
+                /* org.apache.camel.component.consul.* can be removed after 
the upgrade to Camel 3.1 */
+                "org.apache.camel.component.consul.ConsulConfiguration",
+                "org.apache.camel.component.consul.ConsulClientConfiguration",
+                
"org.apache.camel.component.consul.health.ConsulHealthCheckRepositoryConfiguration",
+                
"org.apache.camel.component.consul.cloud.ConsulServiceRegistryConfiguration"));
+
+        @BuildStep
+        void bannedReflectiveClasses(
+                CombinedIndexBuildItem combinedIndex,
+                List<ReflectiveClassBuildItem> reflectiveClass,
+                BuildProducer<GeneratedResourceBuildItem> dummy // to force 
the execution of this method
+        ) {
+            final DotName uriParamsDotName = 
DotName.createSimple("org.apache.camel.spi.UriParams");
+
+            final Set<String> bannedClassNames = combinedIndex.getIndex()
+                    .getAnnotations(uriParamsDotName)
+                    .stream()
+                    .filter(ai -> ai.target().kind() == Kind.CLASS)
+                    .map(ai -> ai.target().asClass().name().toString())
+                    .collect(Collectors.toSet());
+
+            Set<String> violations = reflectiveClass.stream()
+                    .map(ReflectiveClassBuildItem::getClassNames)
+                    .flatMap(Collection::stream)
+                    .filter(cl -> !URI_PARAMS_WHITELIST.contains(cl))
+                    .filter(bannedClassNames::contains)
+                    .collect(Collectors.toSet());
+
+            if (!violations.isEmpty()) {
+                throw new IllegalStateException(
 
 Review comment:
   all the camel components have a property that can control if the generated 
configurer have to be used or not so as long as the property is there, I feel 
we should log a warning but I'd rather avoid to fail the build.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to