You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "essobedo (via GitHub)" <gi...@apache.org> on 2023/03/31 07:26:48 UTC

[GitHub] [camel-quarkus] essobedo opened a new pull request, #4726: Ref #4716: java-joor-dsl - Add RegisterForReflection support

essobedo opened a new pull request, #4726:
URL: https://github.com/apache/camel-quarkus/pull/4726

   fixes #4716 
   
   ## Motivation
   
   All the annotations added to a class managed by the extension `java-joor-dsl` are not considered by Quarkus since it is not part of the Jandex index. 
   
   This change aims to support the annotation `RegisterForReflection` to easily configure the reflection in Camel-K.
   
   ## Modifications:
   
   * Produce the corresponding `ReflectiveClassBuildItem` and  `LambdaCapturingTypeBuildItem` if a `RouteBuilder` is annotated with `RegisterForReflection`.
   * Add a unit test to ensure that it works as expected


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] aldettinger commented on a diff in pull request #4726: Ref #4716: java-joor-dsl - Add RegisterForReflection support

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #4726:
URL: https://github.com/apache/camel-quarkus/pull/4726#discussion_r1154666301


##########
extensions/java-joor-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/java/joor/deployment/JavaJoorDslProcessor.java:
##########
@@ -96,6 +100,62 @@ void compileClassesAOT(BuildProducer<JavaJoorGeneratedClassBuildItem> generatedC
             generatedClass
                     .produce(new JavaJoorGeneratedClassBuildItem(className, nameToResource.get(className).getLocation(),
                             result.getByteCode(className)));
+            registerForReflection(reflectiveClass, lambdaCapturingTypeProducer,
+                    result.getClass(className).getAnnotation(RegisterForReflection.class));
+        }
+    }
+
+    private void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
+            BuildProducer<LambdaCapturingTypeBuildItem> lambdaCapturingTypeProducer,
+            RegisterForReflection annotation) {
+        if (annotation == null) {
+            return;
+        }
+
+        for (String lambdaCapturingType : annotation.lambdaCapturingTypes()) {
+            lambdaCapturingTypeProducer.produce(new LambdaCapturingTypeBuildItem(lambdaCapturingType));
+        }
+        boolean methods = annotation.methods();
+        boolean fields = annotation.fields();
+        boolean ignoreNested = annotation.ignoreNested();
+        boolean serialization = annotation.serialization();
+        boolean unsafeAllocated = annotation.unsafeAllocated();
+
+        if (annotation.registerFullHierarchy()) {
+            LOG.warn(
+                    "The element 'registerFullHierarchy' of the annotation 'RegisterForReflection' is not supported by the extension Camel Java DSL");

Review Comment:
   "not supported by Camel Java DSL" ?
   
   Isn't it maybe "not supported by Camel Java Joor DSL" ?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] essobedo merged pull request #4726: Ref #4716: java-joor-dsl - Add RegisterForReflection support

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo merged PR #4726:
URL: https://github.com/apache/camel-quarkus/pull/4726


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] essobedo commented on pull request #4726: Ref #4716: java-joor-dsl - Add RegisterForReflection support

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on PR #4726:
URL: https://github.com/apache/camel-quarkus/pull/4726#issuecomment-1492242088

   > Just a nitpick question, beyond Will Smith PR looks good to me ;)
   
   I'm still a great fan of Will Smith, sorry for that 😅 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org