This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
The following commit(s) were added to refs/heads/master by this push:
new b06de6e3 Add RecordComponentInfo.getAttribute(byte tag)#494.
b06de6e3 is described below
commit b06de6e36ea76f550d34083ccb280a5ad7b8f2d5
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Feb 1 15:58:54 2026 -0500
Add RecordComponentInfo.getAttribute(byte tag)#494.
---
src/changes/changes.xml | 1 +
.../java/org/apache/bcel/classfile/RecordTest.java | 22 +++++++++++-----------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b6a69423..e6c15c9d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -63,6 +63,7 @@ The <action> type attribute can be add,update,fix,remove.
<!-- FIX -->
<action type="update" dev="ggregory"
due-to="nbauma109">Fix constant pool module access test on Java 26 and above
#492.</action>
<action type="update" dev="ggregory" due-to="nbauma109,
Gary Gregory">Add support for permitted subclasses #493.</action>
+ <action type="update" dev="ggregory" due-to="nbauma109,
Gary Gregory">Add RecordComponentInfo.getAttribute(byte tag)#494.</action>
<!-- ADD -->
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Gary
Gregory">Bump org.apache.commons:commons-parent from 95 to 96.</action>
diff --git a/src/test/java/org/apache/bcel/classfile/RecordTest.java
b/src/test/java/org/apache/bcel/classfile/RecordTest.java
index afdd7fe3..aa4c30ae 100644
--- a/src/test/java/org/apache/bcel/classfile/RecordTest.java
+++ b/src/test/java/org/apache/bcel/classfile/RecordTest.java
@@ -92,6 +92,17 @@ class RecordTest extends AbstractTest {
assertFalse(simpleClazz.isRecord(), "Expected SimpleClass class to say
it was not a record - but it didn't !");
}
+ @Test
+ void testRecordComponentGetAttribute() throws ClassFormatException,
IOException {
+ final JavaClass clazz = new
ClassParser("src/test/resources/record/SimpleRecord.class").parse();
+ final Record recordAttribute = (Record) findAttribute("Record",
clazz)[0];
+ final RecordComponentInfo secondComponent =
recordAttribute.getComponents()[1];
+ final RuntimeVisibleAnnotations ann =
secondComponent.getAttribute(Const.ATTR_RUNTIME_VISIBLE_ANNOTATIONS);
+ assertEquals("RuntimeVisibleAnnotations:\n"
+ + " @Ljavax/annotation/Nonnull;", ann.toString());
+
assertNull(secondComponent.getAttribute(Const.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS));
+ }
+
/**
* A simple record with two simple fields, an integer and a String field,
should
* show its content in its string representation.
@@ -119,15 +130,4 @@ class RecordTest extends AbstractTest {
assertEquals(recordAttribute.getConstantPool(),
firstComponent.getConstantPool());
assertEquals("RecordComponentInfo(aNumber,I,0):",
firstComponent.toString());
}
-
- @Test
- void testRecordComponentGetAttribute() throws ClassFormatException,
IOException {
- final JavaClass clazz = new
ClassParser("src/test/resources/record/SimpleRecord.class").parse();
- final Record recordAttribute = (Record) findAttribute("Record",
clazz)[0];
- final RecordComponentInfo secondComponent =
recordAttribute.getComponents()[1];
- final RuntimeVisibleAnnotations ann =
secondComponent.getAttribute(Const.ATTR_RUNTIME_VISIBLE_ANNOTATIONS);
- assertEquals("RuntimeVisibleAnnotations:\n"
- + " @Ljavax/annotation/Nonnull;", ann.toString());
-
assertNull(secondComponent.getAttribute(Const.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS));
- }
}