ppalaga commented on a change in pull request #2342:
URL: https://github.com/apache/camel-quarkus/pull/2342#discussion_r596685435



##########
File path: 
extensions/solr/deployment/src/main/java/org/apache/camel/quarkus/component/solr/deployment/SolrProcessor.java
##########
@@ -35,4 +40,27 @@ FeatureBuildItem feature() {
     ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
         return new ExtensionSslNativeSupportBuildItem(FEATURE);
     }
+
+    @BuildStep
+    void registerForReflection(BuildProducer<ReflectiveClassBuildItem> 
reflectiveClass, CombinedIndexBuildItem combinedIndex) {
+        // Register any classes within the application archive that contain 
the Solr Field annotation
+        combinedIndex.getIndex()
+                .getAnnotations(FIELD_DOT_NAME)
+                .stream()
+                .map(annotationInstance -> {
+                    AnnotationTarget target = annotationInstance.target();
+                    AnnotationTarget.Kind kind = target.kind();
+                    if (kind.equals(AnnotationTarget.Kind.FIELD)) {
+                        ClassInfo classInfo = 
target.asField().declaringClass();
+                        return new ReflectiveClassBuildItem(false, true, 
classInfo.name().toString());
+                    } else if (kind.equals(AnnotationTarget.Kind.METHOD)) {
+                        ClassInfo classInfo = 
target.asMethod().declaringClass();
+                        return new ReflectiveClassBuildItem(true, false, 
classInfo.name().toString());
+                    } else {
+                        throw new RuntimeException(

Review comment:
       You know my general attitude to warnings ;)
   
   In this particular case, as long as 
`org.apache.solr.client.solrj.beans.Field` has `@Target({FIELD, METHOD})`, I 
think it is correct to fail.
   
   If we want to be paranoid, we should IMO (1) keep it failing in 
SolrProcessor and (2) add an assertion to our test that 
`org.apache.solr.client.solrj.beans.Field` 's `@Target` value has not changed 
to anything beyond `{FIELD, METHOD}`. But from a practical point of view, how 
likely it is that will ever change? Would adding a `CLASS` target make any 
conceivable sense? I am not implying any particular answer, I frankly do not 
know.
   
   




----------------------------------------------------------------
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:
[email protected]


Reply via email to