Skip to content

Conversation

@nbauma109
Copy link
Contributor

This PR aligns the API of RecordComponentInfo on the API of JavaClass / FieldOrMethod.

Same as we would do :

Annotations visibles = javaClass.getAttribute(Const.ATTR_RUNTIME_VISIBLE_ANNOTATIONS);
Annotations invisibles = javaClass.getAttribute(Const.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS);

or :

Annotations visibles = fieldOrMethod.getAttribute(Const.ATTR_RUNTIME_VISIBLE_ANNOTATIONS);
Annotations invisibles = fieldOrMethod.getAttribute(Const.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS);

add the possibility to do :

Annotations visibles = recordComponentInfo.getAttribute(Const.ATTR_RUNTIME_VISIBLE_ANNOTATIONS);
Annotations invisibles = recordComponentInfo.getAttribute(Const.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS);

instead of less readable syntax :

Annotations visibles = (Annotations) Stream.of(recordComponentInfo.getAttributes()).filter(RuntimeVisibleAnnotations.class::isInstance).findAny().orElse(null);
Annotations invisibles = (Annotations) Stream.of(recordComponentInfo.getAttributes()).filter(RuntimeInvisibleAnnotations.class::isInstance).findAny().orElse(null);

Copy link
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @nbauma109

Please create a new test for this new method instead of making an existing test more complex.

@garydgregory garydgregory merged commit a67d64a into apache:master Feb 1, 2026
19 checks passed
@garydgregory garydgregory changed the title Add getAttribute(final byte tag) to RecordComponentInfo Add RecordComponentInfo.getAttribute(final byte tag) Feb 1, 2026
@garydgregory garydgregory changed the title Add RecordComponentInfo.getAttribute(final byte tag) Add RecordComponentInfo.getAttribute(byte tag) Feb 1, 2026
@garydgregory
Copy link
Member

Thank you @nbauma109.

PR merged 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants