garydgregory commented on code in PR #290:
URL: https://github.com/apache/commons-bcel/pull/290#discussion_r1539156648


##########
src/main/java/org/apache/bcel/classfile/RecordComponentInfo.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bcel.classfile;
+
+import java.io.DataInput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Const;
+
+/**
+ * Record component info from a record. Instances from this class maps
+ * every component from a given record.
+ *
+ * @see <a 
href="https://docs.oracle.com/javase/specs/jvms/se14/preview/specs/records-jvms.html#jvms-4.7.30";>
+ *      The Java Virtual Machine Specification, Java SE 14 Edition, Records 
(preview)</a>
+ */
+public class RecordComponentInfo implements Node {
+
+    private final int index;
+    private final int descriptorIndex;
+    private final Attribute[] attributes;
+    private final ConstantPool constantPool;
+
+    /**
+     * Constructs object from input stream.
+     *
+     * @param input        Input stream
+     * @param constantPool Array of constants
+     * @throws IOException if an I/O error occurs.
+     */
+    public RecordComponentInfo(final DataInput input, ConstantPool 
constantPool) throws IOException {
+        this.index = input.readUnsignedShort();
+        this.descriptorIndex = input.readUnsignedShort();
+        final int attributesCount = input.readUnsignedShort();
+        this.attributes = new Attribute[attributesCount];
+        for (int j = 0; j < attributesCount; j++) {
+            attributes[j] = Attribute.readAttribute(input, constantPool);
+        }
+        this.constantPool = constantPool;
+    }
+
+    public void dump(DataOutputStream file) throws IOException {
+        file.writeShort(index);
+        file.writeShort(descriptorIndex);
+        file.writeShort(attributes.length);
+        for (final Attribute attribute : attributes) {
+            attribute.dump(file);
+        }
+    }
+
+    @Override
+    public void accept(Visitor v) {
+        v.visitRecordComponent(this);
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public int getDescriptorIndex() {
+        return descriptorIndex;
+    }
+
+    public Attribute[] getAttributes() {

Review Comment:
   Hi @PabloNicolasDiaz 
   This method is neither used or tested, how about removing until it is 
needed? 
   Or, is it used by you in an other app?
   It is also missing a Javadoc.



##########
src/main/java/org/apache/bcel/classfile/Visitor.java:
##########
@@ -207,6 +207,14 @@ default void visitNestMembers(final NestMembers obj) {
         // empty
     }
 
+    /**
+     * @since 6.9.0

Review Comment:
   Hi @PabloNicolasDiaz 
   The Javadoc is missing the first sentence.
   
   



##########
src/main/java/org/apache/bcel/classfile/RecordComponentInfo.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bcel.classfile;
+
+import java.io.DataInput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Const;
+
+/**
+ * Record component info from a record. Instances from this class maps
+ * every component from a given record.
+ *
+ * @see <a 
href="https://docs.oracle.com/javase/specs/jvms/se14/preview/specs/records-jvms.html#jvms-4.7.30";>
+ *      The Java Virtual Machine Specification, Java SE 14 Edition, Records 
(preview)</a>
+ */
+public class RecordComponentInfo implements Node {
+
+    private final int index;
+    private final int descriptorIndex;
+    private final Attribute[] attributes;
+    private final ConstantPool constantPool;
+
+    /**
+     * Constructs object from input stream.
+     *
+     * @param input        Input stream
+     * @param constantPool Array of constants
+     * @throws IOException if an I/O error occurs.
+     */
+    public RecordComponentInfo(final DataInput input, ConstantPool 
constantPool) throws IOException {
+        this.index = input.readUnsignedShort();
+        this.descriptorIndex = input.readUnsignedShort();
+        final int attributesCount = input.readUnsignedShort();
+        this.attributes = new Attribute[attributesCount];
+        for (int j = 0; j < attributesCount; j++) {
+            attributes[j] = Attribute.readAttribute(input, constantPool);
+        }
+        this.constantPool = constantPool;
+    }
+
+    public void dump(DataOutputStream file) throws IOException {
+        file.writeShort(index);
+        file.writeShort(descriptorIndex);
+        file.writeShort(attributes.length);
+        for (final Attribute attribute : attributes) {
+            attribute.dump(file);
+        }
+    }
+
+    @Override
+    public void accept(Visitor v) {
+        v.visitRecordComponent(this);
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public int getDescriptorIndex() {

Review Comment:
   Hi @PabloNicolasDiaz 
   This method is neither used or tested, how about removing until it is 
needed? 
   Or, is it used by you in an other app?
   It is also missing a Javadoc.



##########
src/main/java/org/apache/bcel/classfile/Visitor.java:
##########
@@ -237,4 +245,14 @@ default void visitStackMapType(final StackMapType obj) {
     void visitSynthetic(Synthetic obj);
 
     void visitUnknown(Unknown obj);
+
+    /**
+     * Visits a {@link RecordComponentInfo} object.
+     * @param obj record component to visit
+     * @since 6.9.0
+     */
+    default void visitRecordComponent(RecordComponentInfo obj) {
+

Review Comment:
   Remove blank line or add a comment that says `// noop`.



##########
src/main/java/org/apache/bcel/classfile/RecordComponentInfo.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bcel.classfile;
+
+import java.io.DataInput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Const;
+
+/**
+ * Record component info from a record. Instances from this class maps
+ * every component from a given record.
+ *
+ * @see <a 
href="https://docs.oracle.com/javase/specs/jvms/se14/preview/specs/records-jvms.html#jvms-4.7.30";>
+ *      The Java Virtual Machine Specification, Java SE 14 Edition, Records 
(preview)</a>
+ */
+public class RecordComponentInfo implements Node {
+
+    private final int index;
+    private final int descriptorIndex;
+    private final Attribute[] attributes;
+    private final ConstantPool constantPool;
+
+    /**
+     * Constructs object from input stream.
+     *
+     * @param input        Input stream
+     * @param constantPool Array of constants
+     * @throws IOException if an I/O error occurs.
+     */
+    public RecordComponentInfo(final DataInput input, ConstantPool 
constantPool) throws IOException {
+        this.index = input.readUnsignedShort();
+        this.descriptorIndex = input.readUnsignedShort();
+        final int attributesCount = input.readUnsignedShort();
+        this.attributes = new Attribute[attributesCount];
+        for (int j = 0; j < attributesCount; j++) {
+            attributes[j] = Attribute.readAttribute(input, constantPool);
+        }
+        this.constantPool = constantPool;
+    }
+
+    public void dump(DataOutputStream file) throws IOException {
+        file.writeShort(index);
+        file.writeShort(descriptorIndex);
+        file.writeShort(attributes.length);
+        for (final Attribute attribute : attributes) {
+            attribute.dump(file);
+        }
+    }
+
+    @Override
+    public void accept(Visitor v) {
+        v.visitRecordComponent(this);
+    }
+
+    public int getIndex() {

Review Comment:
   Hi @PabloNicolasDiaz 
   This method is neither used or tested, how about removing until it is 
needed? 
   Or, is it used by you in an other app?
   It is also missing a Javadoc.



##########
src/main/java/org/apache/bcel/classfile/Record.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.bcel.classfile;
+
+import java.io.DataInput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Const;
+import org.apache.bcel.util.Args;
+
+/**
+ * This class is derived from <em>Attribute</em> and records the classes and
+ * interfaces that are authorized to claim membership in the nest hosted by the
+ * current class or interface. There may be at most one Record attribute in a
+ * ClassFile structure.
+ *
+ * @see Attribute
+ * @since 6.9.0
+ */
+public final class Record extends Attribute {
+
+    private static final RecordComponentInfo[] EMPTY_RCI_ARRAY = new 
RecordComponentInfo[] {};
+
+    private RecordComponentInfo[] components;
+
+    /**
+     * Constructs object from input stream.
+     *
+     * @param nameIndex    Index in constant pool
+     * @param length       Content length in bytes
+     * @param input        Input stream
+     * @param constantPool Array of constants
+     * @throws IOException if an I/O error occurs.
+     */
+    Record(final int nameIndex, final int length, final DataInput input, final 
ConstantPool constantPool)
+            throws IOException {
+        this(nameIndex, length, readComponents(input, constantPool), 
constantPool);
+    }
+
+    private static RecordComponentInfo[] readComponents(final DataInput input, 
final ConstantPool constantPool)
+            throws IOException {
+        final int classCount = input.readUnsignedShort();
+        final RecordComponentInfo[] components = new 
RecordComponentInfo[classCount];
+        for (int i = 0; i < classCount; i++) {
+            components[i] = new RecordComponentInfo(input, constantPool);
+        }
+        return components;
+    }
+
+    /**
+     * Construct elements using its components
+     *
+     * @param nameIndex    Index in constant pool
+     * @param length       Content length in bytes
+     * @param classes      Array of Record Component Info elements
+     * @param constantPool Array of constants
+     */
+    public Record(final int nameIndex, final int length, final 
RecordComponentInfo[] classes,
+            final ConstantPool constantPool) {
+        super(Const.ATTR_RECORD, nameIndex, length, constantPool);
+        this.components = classes != null ? classes : EMPTY_RCI_ARRAY;
+        Args.requireU2(this.components.length, "attributes.length");
+    }
+
+    /**
+     * Called by objects that are traversing the nodes of the tree implicitly
+     * defined by the contents of a Java class. I.e., the hierarchy of methods,
+     * fields, attributes, etc. spawns a tree of objects.
+     *
+     * @param v Visitor object
+     */
+    @Override
+    public void accept(final Visitor v) {
+        v.visitRecord(this);
+    }
+
+    /**
+     * @return deep copy of this record attribute

Review Comment:
   Javadoc is missing its first sentence.



##########
src/main/java/org/apache/bcel/classfile/Record.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.bcel.classfile;
+
+import java.io.DataInput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Const;
+import org.apache.bcel.util.Args;
+
+/**
+ * This class is derived from <em>Attribute</em> and records the classes and
+ * interfaces that are authorized to claim membership in the nest hosted by the
+ * current class or interface. There may be at most one Record attribute in a
+ * ClassFile structure.
+ *
+ * @see Attribute
+ * @since 6.9.0
+ */
+public final class Record extends Attribute {
+
+    private static final RecordComponentInfo[] EMPTY_RCI_ARRAY = new 
RecordComponentInfo[] {};
+
+    private RecordComponentInfo[] components;
+
+    /**
+     * Constructs object from input stream.
+     *
+     * @param nameIndex    Index in constant pool
+     * @param length       Content length in bytes
+     * @param input        Input stream
+     * @param constantPool Array of constants
+     * @throws IOException if an I/O error occurs.
+     */
+    Record(final int nameIndex, final int length, final DataInput input, final 
ConstantPool constantPool)
+            throws IOException {
+        this(nameIndex, length, readComponents(input, constantPool), 
constantPool);
+    }
+
+    private static RecordComponentInfo[] readComponents(final DataInput input, 
final ConstantPool constantPool)
+            throws IOException {
+        final int classCount = input.readUnsignedShort();
+        final RecordComponentInfo[] components = new 
RecordComponentInfo[classCount];
+        for (int i = 0; i < classCount; i++) {
+            components[i] = new RecordComponentInfo(input, constantPool);
+        }
+        return components;
+    }
+
+    /**
+     * Construct elements using its components
+     *
+     * @param nameIndex    Index in constant pool
+     * @param length       Content length in bytes
+     * @param classes      Array of Record Component Info elements
+     * @param constantPool Array of constants
+     */
+    public Record(final int nameIndex, final int length, final 
RecordComponentInfo[] classes,
+            final ConstantPool constantPool) {
+        super(Const.ATTR_RECORD, nameIndex, length, constantPool);
+        this.components = classes != null ? classes : EMPTY_RCI_ARRAY;
+        Args.requireU2(this.components.length, "attributes.length");
+    }
+
+    /**
+     * Called by objects that are traversing the nodes of the tree implicitly
+     * defined by the contents of a Java class. I.e., the hierarchy of methods,
+     * fields, attributes, etc. spawns a tree of objects.
+     *
+     * @param v Visitor object
+     */
+    @Override
+    public void accept(final Visitor v) {
+        v.visitRecord(this);
+    }
+
+    /**
+     * @return deep copy of this record attribute
+     */
+    @Override
+    public Attribute copy(final ConstantPool constantPool) {
+        final Record c = (Record) clone();
+        if (components.length > 0) {
+            c.components = components.clone();
+        }
+        c.setConstantPool(constantPool);
+        return c;
+    }
+
+    /**
+     * Dump RecordComponentInfo attribute to file stream in binary format.
+     *
+     * @param file Output file stream
+     * @throws IOException if an I/O error occurs.
+     */
+    @Override
+    public void dump(final DataOutputStream file) throws IOException {
+        super.dump(file);
+        file.writeShort(components.length);
+        for (final RecordComponentInfo component : components) {
+            component.dump(file);
+        }
+    }
+
+    /**
+     * @return array of Record Component Info elements.

Review Comment:
   Javadoc is missing its first sentence.



##########
src/main/java/org/apache/bcel/classfile/RecordComponentInfo.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bcel.classfile;
+
+import java.io.DataInput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Const;
+
+/**
+ * Record component info from a record. Instances from this class maps
+ * every component from a given record.
+ *
+ * @see <a 
href="https://docs.oracle.com/javase/specs/jvms/se14/preview/specs/records-jvms.html#jvms-4.7.30";>
+ *      The Java Virtual Machine Specification, Java SE 14 Edition, Records 
(preview)</a>
+ */
+public class RecordComponentInfo implements Node {
+
+    private final int index;
+    private final int descriptorIndex;
+    private final Attribute[] attributes;
+    private final ConstantPool constantPool;
+
+    /**
+     * Constructs object from input stream.
+     *
+     * @param input        Input stream
+     * @param constantPool Array of constants
+     * @throws IOException if an I/O error occurs.
+     */
+    public RecordComponentInfo(final DataInput input, ConstantPool 
constantPool) throws IOException {
+        this.index = input.readUnsignedShort();
+        this.descriptorIndex = input.readUnsignedShort();
+        final int attributesCount = input.readUnsignedShort();
+        this.attributes = new Attribute[attributesCount];
+        for (int j = 0; j < attributesCount; j++) {
+            attributes[j] = Attribute.readAttribute(input, constantPool);
+        }
+        this.constantPool = constantPool;
+    }
+
+    public void dump(DataOutputStream file) throws IOException {

Review Comment:
   Missing Javadoc
   



##########
src/test/java/org/apache/bcel/classfile/RecordTestCase.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bcel.classfile;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.bcel.AbstractTestCase;
+import org.apache.bcel.util.SyntheticRepository;
+import org.apache.bcel.visitors.CountingVisitor;
+import org.junit.jupiter.api.Test;
+
+public class RecordTestCase extends AbstractTestCase {
+
+    /**
+     * An record type, once compiled, should result in a class file that is 
marked such that we can determine from the

Review Comment:
   `An record` -> `A record`



##########
src/main/java/org/apache/bcel/classfile/Record.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.bcel.classfile;
+
+import java.io.DataInput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Const;
+import org.apache.bcel.util.Args;
+
+/**
+ * This class is derived from <em>Attribute</em> and records the classes and
+ * interfaces that are authorized to claim membership in the nest hosted by the
+ * current class or interface. There may be at most one Record attribute in a
+ * ClassFile structure.
+ *
+ * @see Attribute
+ * @since 6.9.0
+ */
+public final class Record extends Attribute {
+
+    private static final RecordComponentInfo[] EMPTY_RCI_ARRAY = new 
RecordComponentInfo[] {};
+
+    private RecordComponentInfo[] components;
+
+    /**
+     * Constructs object from input stream.
+     *
+     * @param nameIndex    Index in constant pool
+     * @param length       Content length in bytes
+     * @param input        Input stream
+     * @param constantPool Array of constants
+     * @throws IOException if an I/O error occurs.
+     */
+    Record(final int nameIndex, final int length, final DataInput input, final 
ConstantPool constantPool)
+            throws IOException {
+        this(nameIndex, length, readComponents(input, constantPool), 
constantPool);
+    }
+
+    private static RecordComponentInfo[] readComponents(final DataInput input, 
final ConstantPool constantPool)
+            throws IOException {
+        final int classCount = input.readUnsignedShort();
+        final RecordComponentInfo[] components = new 
RecordComponentInfo[classCount];
+        for (int i = 0; i < classCount; i++) {
+            components[i] = new RecordComponentInfo(input, constantPool);
+        }
+        return components;
+    }
+
+    /**
+     * Construct elements using its components
+     *
+     * @param nameIndex    Index in constant pool
+     * @param length       Content length in bytes
+     * @param classes      Array of Record Component Info elements
+     * @param constantPool Array of constants
+     */
+    public Record(final int nameIndex, final int length, final 
RecordComponentInfo[] classes,
+            final ConstantPool constantPool) {
+        super(Const.ATTR_RECORD, nameIndex, length, constantPool);
+        this.components = classes != null ? classes : EMPTY_RCI_ARRAY;
+        Args.requireU2(this.components.length, "attributes.length");
+    }
+
+    /**
+     * Called by objects that are traversing the nodes of the tree implicitly
+     * defined by the contents of a Java class. I.e., the hierarchy of methods,
+     * fields, attributes, etc. spawns a tree of objects.
+     *
+     * @param v Visitor object
+     */
+    @Override
+    public void accept(final Visitor v) {
+        v.visitRecord(this);
+    }
+
+    /**
+     * @return deep copy of this record attribute
+     */
+    @Override
+    public Attribute copy(final ConstantPool constantPool) {
+        final Record c = (Record) clone();
+        if (components.length > 0) {
+            c.components = components.clone();
+        }
+        c.setConstantPool(constantPool);
+        return c;
+    }
+
+    /**
+     * Dump RecordComponentInfo attribute to file stream in binary format.
+     *
+     * @param file Output file stream
+     * @throws IOException if an I/O error occurs.
+     */
+    @Override
+    public void dump(final DataOutputStream file) throws IOException {
+        super.dump(file);
+        file.writeShort(components.length);
+        for (final RecordComponentInfo component : components) {
+            component.dump(file);
+        }
+    }
+
+    /**
+     * @return array of Record Component Info elements.
+     */
+    public RecordComponentInfo[] getComponents() {
+        return components;
+    }
+
+    /**
+     * @return String representation, i.e., a list of classes.

Review Comment:
   Javadoc is missing its first sentence.



##########
src/main/java/org/apache/bcel/classfile/JavaClass.java:
##########
@@ -906,4 +911,27 @@ public String toString() {
         }
         return buf.toString();
     }
+
+    /**
+     * Query method to check if this class was declared as a record
+     *
+     * @return true if a record attribute is present, false otherwise

Review Comment:
   Missing `@since` tag.



##########
src/test/java/org/apache/bcel/classfile/RecordTestCase.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bcel.classfile;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.bcel.AbstractTestCase;
+import org.apache.bcel.util.SyntheticRepository;
+import org.apache.bcel.visitors.CountingVisitor;
+import org.junit.jupiter.api.Test;
+
+public class RecordTestCase extends AbstractTestCase {
+
+    /**
+     * An record type, once compiled, should result in a class file that is 
marked such that we can determine from the
+     * access flags (through BCEL) that it is in fact a record
+     * @throws IOException
+     * @throws ClassFormatException
+     */
+    @Test
+    public void testRecordClassSaysItIs() throws ClassNotFoundException, 
ClassFormatException, IOException {
+        final JavaClass clazz = new 
ClassParser("src/test/resources/record/SimpleRecord.class").parse();
+        assertTrue(clazz.isRecord(), "Expected SimpleEnum class to say it was 
a record - but it didn't !");
+        final JavaClass simpleClazz = getTestJavaClass(PACKAGE_BASE_NAME + 
".data.SimpleClass");
+        assertFalse(simpleClazz.isRecord(), "Expected SimpleClass class to say 
it was not a record - but it didn't !");
+    }
+
+    /**
+     * An simple record with two simple fields, an integer and a String field, 
should

Review Comment:
   `An simple` -> `A simple`.



-- 
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: issues-unsubscr...@commons.apache.org

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

Reply via email to