You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "ArneLimburg (via GitHub)" <gi...@apache.org> on 2026/06/29 17:09:32 UTC

[PR] JOHNZON-431: Fix detection of class level annotations [johnzon]

ArneLimburg opened a new pull request, #141:
URL: https://github.com/apache/johnzon/pull/141

   (no comment)


-- 
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: dev-unsubscribe@johnzon.apache.org

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


Re: [PR] JOHNZON-431: Fix detection of class level annotations [johnzon]

Posted by "ArneLimburg (via GitHub)" <gi...@apache.org>.
ArneLimburg commented on code in PR #141:
URL: https://github.com/apache/johnzon/pull/141#discussion_r3520712599


##########
johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java:
##########
@@ -1051,7 +1051,11 @@ private static <T extends Annotation> T getAnnotation(final Parameter param, fin
         if (annotation != null) {
             return annotation;
         }
-        return Meta.findMeta(param.getAnnotations(), api);
+        final T metaAnnotation = Meta.findMeta(param.getAnnotations(), api);
+        if (metaAnnotation != null) {
+            return metaAnnotation;
+        }
+        return Meta.getAnnotation(param.getType(), api);

Review Comment:
   Now I got your point and directly implemented it. Feel free to have a look



-- 
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: dev-unsubscribe@johnzon.apache.org

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


Re: [PR] JOHNZON-431: Fix detection of class level annotations [johnzon]

Posted by "rmannibucau (via GitHub)" <gi...@apache.org>.
rmannibucau commented on code in PR #141:
URL: https://github.com/apache/johnzon/pull/141#discussion_r3500626660


##########
johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java:
##########
@@ -1051,7 +1051,11 @@ private static <T extends Annotation> T getAnnotation(final Parameter param, fin
         if (annotation != null) {
             return annotation;
         }
-        return Meta.findMeta(param.getAnnotations(), api);
+        final T metaAnnotation = Meta.findMeta(param.getAnnotations(), api);
+        if (metaAnnotation != null) {
+            return metaAnnotation;
+        }
+        return Meta.getAnnotation(param.getType(), api);

Review Comment:
   should we filter api?



-- 
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: dev-unsubscribe@johnzon.apache.org

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


Re: [PR] JOHNZON-431: Fix detection of class level annotations [johnzon]

Posted by "rmannibucau (via GitHub)" <gi...@apache.org>.
rmannibucau commented on code in PR #141:
URL: https://github.com/apache/johnzon/pull/141#discussion_r3520555656


##########
johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java:
##########
@@ -1051,7 +1051,11 @@ private static <T extends Annotation> T getAnnotation(final Parameter param, fin
         if (annotation != null) {
             return annotation;
         }
-        return Meta.findMeta(param.getAnnotations(), api);
+        final T metaAnnotation = Meta.findMeta(param.getAnnotations(), api);
+        if (metaAnnotation != null) {
+            return metaAnnotation;
+        }
+        return Meta.getAnnotation(param.getType(), api);

Review Comment:
   @ArneLimburg not sure what you mean, you mean it is a bug we can't read a `@JsonbProperty` from a type? my point was more to add a method in the spirit of `org.apache.johnzon.mapper.access.Meta#getIndirectAnnotation` which does "read at that location (param) else this one (type)" with meta annotation support and use it only for the annotations allowing it like `JsonbTypeAdapter`, `JsonbDateFormat`, `JsonbNumberFormat` and `JsonbTypeDeserializer` but not `JsonbProperty` and `JohnzonConverter` (they all use the same `getAnnotation`).



-- 
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: dev-unsubscribe@johnzon.apache.org

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


Re: [PR] JOHNZON-431: Fix detection of class level annotations [johnzon]

Posted by "ArneLimburg (via GitHub)" <gi...@apache.org>.
ArneLimburg commented on code in PR #141:
URL: https://github.com/apache/johnzon/pull/141#discussion_r3520330086


##########
johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java:
##########
@@ -1051,7 +1051,11 @@ private static <T extends Annotation> T getAnnotation(final Parameter param, fin
         if (annotation != null) {
             return annotation;
         }
-        return Meta.findMeta(param.getAnnotations(), api);
+        final T metaAnnotation = Meta.findMeta(param.getAnnotations(), api);
+        if (metaAnnotation != null) {
+            return metaAnnotation;
+        }
+        return Meta.getAnnotation(param.getType(), api);

Review Comment:
   Note that the getAnnotation(parameter) is private and just used at that location where the bug is.
   
   So do you mean, I should just rename getAnnotation(...) to getAnnotationOnParameterOrParameterType(...) ?



-- 
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: dev-unsubscribe@johnzon.apache.org

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


Re: [PR] JOHNZON-431: Fix detection of class level annotations [johnzon]

Posted by "rmannibucau (via GitHub)" <gi...@apache.org>.
rmannibucau commented on code in PR #141:
URL: https://github.com/apache/johnzon/pull/141#discussion_r3500626660


##########
johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java:
##########
@@ -1051,7 +1051,11 @@ private static <T extends Annotation> T getAnnotation(final Parameter param, fin
         if (annotation != null) {
             return annotation;
         }
-        return Meta.findMeta(param.getAnnotations(), api);
+        final T metaAnnotation = Meta.findMeta(param.getAnnotations(), api);
+        if (metaAnnotation != null) {
+            return metaAnnotation;
+        }
+        return Meta.getAnnotation(param.getType(), api);

Review Comment:
   should we filter api? this one is more specific for params so guess the fallback should be at higher level



-- 
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: dev-unsubscribe@johnzon.apache.org

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


Re: [PR] JOHNZON-431: Fix detection of class level annotations [johnzon]

Posted by "struberg (via GitHub)" <gi...@apache.org>.
struberg merged PR #141:
URL: https://github.com/apache/johnzon/pull/141


-- 
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: dev-unsubscribe@johnzon.apache.org

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