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
commit 4248d68b16ec041af87de2dbd22fda29a3322ea6 Author: Gary Gregory <[email protected]> AuthorDate: Fri Jan 9 14:46:08 2026 -0500 Javadoc --- .../apache/bcel/classfile/AnnotationDefault.java | 10 ++++++---- .../org/apache/bcel/classfile/AnnotationEntry.java | 16 ++++++++++++++++ .../java/org/apache/bcel/classfile/Annotations.java | 21 +++++++++++++++++---- .../apache/bcel/classfile/ArrayElementValue.java | 17 +++++++++++++++++ .../org/apache/bcel/classfile/ElementValue.java | 15 +++++++++++++++ 5 files changed, 71 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/bcel/classfile/AnnotationDefault.java b/src/main/java/org/apache/bcel/classfile/AnnotationDefault.java index 4c64341b..1a6b6ae6 100644 --- a/src/main/java/org/apache/bcel/classfile/AnnotationDefault.java +++ b/src/main/java/org/apache/bcel/classfile/AnnotationDefault.java @@ -46,10 +46,12 @@ public class AnnotationDefault extends Attribute { } /** - * @param nameIndex Index pointing to the name <em>Code</em> - * @param length Content length in bytes - * @param defaultValue the annotation's default value - * @param constantPool Array of constants + * Constructs an AnnotationDefault attribute. + * + * @param nameIndex Index pointing to the name <em>Code</em>. + * @param length Content length in bytes. + * @param defaultValue the annotation's default value. + * @param constantPool Array of constants. */ public AnnotationDefault(final int nameIndex, final int length, final ElementValue defaultValue, final ConstantPool constantPool) { super(Const.ATTR_ANNOTATION_DEFAULT, nameIndex, length, constantPool); diff --git a/src/main/java/org/apache/bcel/classfile/AnnotationEntry.java b/src/main/java/org/apache/bcel/classfile/AnnotationEntry.java index a657bc6e..5bfb1b5d 100644 --- a/src/main/java/org/apache/bcel/classfile/AnnotationEntry.java +++ b/src/main/java/org/apache/bcel/classfile/AnnotationEntry.java @@ -34,8 +34,17 @@ import org.apache.commons.lang3.stream.Streams; */ public class AnnotationEntry implements Node { + /** + * Empty array of AnnotationEntry objects. + */ public static final AnnotationEntry[] EMPTY_ARRAY = {}; + /** + * Creates annotation entries from attributes. + * + * @param attributes the attributes. + * @return the annotation entries. + */ public static AnnotationEntry[] createAnnotationEntries(final Attribute[] attributes) { // Find attributes that contain annotation data return Streams.of(attributes).filter(Annotations.class::isInstance).flatMap(e -> Stream.of(((Annotations) e).getAnnotationEntries())) @@ -69,6 +78,13 @@ public class AnnotationEntry implements Node { private final List<ElementValuePair> elementValuePairs; + /** + * Constructs an AnnotationEntry. + * + * @param typeIndex the type index. + * @param constantPool the constant pool. + * @param isRuntimeVisible whether the annotation is runtime visible. + */ public AnnotationEntry(final int typeIndex, final ConstantPool constantPool, final boolean isRuntimeVisible) { this.typeIndex = typeIndex; this.constantPool = constantPool; diff --git a/src/main/java/org/apache/bcel/classfile/Annotations.java b/src/main/java/org/apache/bcel/classfile/Annotations.java index de29a79c..7e398b1e 100644 --- a/src/main/java/org/apache/bcel/classfile/Annotations.java +++ b/src/main/java/org/apache/bcel/classfile/Annotations.java @@ -93,7 +93,9 @@ public abstract class Annotations extends Attribute implements Iterable<Annotati } /** - * Gets the array of annotation entries in this annotation + * Gets the array of annotation entries in this annotation. + * + * @return the array of annotation entries in this annotation. */ public AnnotationEntry[] getAnnotationEntries() { return annotationTable; @@ -102,12 +104,17 @@ public abstract class Annotations extends Attribute implements Iterable<Annotati /** * Gets the number of annotation entries in this annotation. * - * @return the number of annotation entries in this annotation + * @return the number of annotation entries in this annotation. */ public final int getNumAnnotations() { return annotationTable.length; } + /** + * Gets whether this annotation is runtime visible. + * + * @return true if this annotation is runtime visible. + */ public boolean isRuntimeVisible() { return isRuntimeVisible; } @@ -120,7 +127,7 @@ public abstract class Annotations extends Attribute implements Iterable<Annotati /** * Sets the entries to set in this annotation. * - * @param annotationTable the entries to set in this annotation + * @param annotationTable the entries to set in this annotation. */ public final void setAnnotationTable(final AnnotationEntry[] annotationTable) { this.annotationTable = annotationTable != null ? annotationTable : AnnotationEntry.EMPTY_ARRAY; @@ -129,7 +136,7 @@ public abstract class Annotations extends Attribute implements Iterable<Annotati /** * Converts to a String representation. * - * @return String representation + * @return String representation. */ @Override public final String toString() { @@ -144,6 +151,12 @@ public abstract class Annotations extends Attribute implements Iterable<Annotati return buf.toString(); } + /** + * Writes the annotations to a DataOutputStream. + * + * @param dos the data output stream. + * @throws IOException if an I/O error occurs. + */ protected void writeAnnotations(final DataOutputStream dos) throws IOException { dos.writeShort(annotationTable.length); for (final AnnotationEntry element : annotationTable) { diff --git a/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java b/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java index 680a103b..dcc93f82 100644 --- a/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java +++ b/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java @@ -30,6 +30,13 @@ public class ArrayElementValue extends ElementValue { // For array types, this is the array private final ElementValue[] elementValues; + /** + * Constructs an ArrayElementValue. + * + * @param type the type. + * @param elementValues the element values. + * @param cpool the constant pool. + */ public ArrayElementValue(final int type, final ElementValue[] elementValues, final ConstantPool cpool) { super(type, cpool); if (type != ARRAY) { @@ -47,10 +54,20 @@ public class ArrayElementValue extends ElementValue { } } + /** + * Gets the element values array. + * + * @return the element values array. + */ public ElementValue[] getElementValuesArray() { return elementValues; } + /** + * Gets the element values array size. + * + * @return the element values array size. + */ public int getElementValuesArraySize() { return elementValues.length; } diff --git a/src/main/java/org/apache/bcel/classfile/ElementValue.java b/src/main/java/org/apache/bcel/classfile/ElementValue.java index 096c6fd3..f5d9c4d8 100644 --- a/src/main/java/org/apache/bcel/classfile/ElementValue.java +++ b/src/main/java/org/apache/bcel/classfile/ElementValue.java @@ -182,12 +182,27 @@ public abstract class ElementValue { return type; } + /** + * Returns a string representation of the element value. + * + * @return a string representation of the element value. + */ public abstract String stringifyValue(); + /** + * Returns a short string representation of the element value. + * + * @return a short string representation of the element value. + */ public String toShortString() { return stringifyValue(); } + /** + * Returns a string representation of the element value. + * + * @return a string representation of the element value. + */ @Override public String toString() { return stringifyValue();
