You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/01/09 20:03:22 UTC
(commons-bcel) 08/11: Javadoc
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 67b5ba8fdcad3b39f084b597c2c7fb7f74a26d8e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jan 9 15:02:35 2026 -0500
Javadoc
---
.../org/apache/bcel/generic/InstructionHandle.java | 68 ++++++++++++++++++----
1 file changed, 56 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/apache/bcel/generic/InstructionHandle.java b/src/main/java/org/apache/bcel/generic/InstructionHandle.java
index 3fbc8122..3c5790c0 100644
--- a/src/main/java/org/apache/bcel/generic/InstructionHandle.java
+++ b/src/main/java/org/apache/bcel/generic/InstructionHandle.java
@@ -111,6 +111,8 @@ public class InstructionHandle {
/**
* Denote this handle is being referenced by t.
+ *
+ * @param t the instruction targeter.
*/
public void addTargeter(final InstructionTargeter t) {
if (targeters == null) {
@@ -121,7 +123,7 @@ public class InstructionHandle {
}
/**
- * Delete contents, i.e., remove user access.
+ * Delete contents, removes user access.
*/
void dispose() {
next = prev = null;
@@ -135,14 +137,17 @@ public class InstructionHandle {
/**
* Gets attribute of an instruction handle.
*
- * @param key the key object to store/retrieve the attribute
+ * @param key the key object to store/retrieve the attribute.
+ * @return the attribute value.
*/
public Object getAttribute(final Object key) {
return attributes != null ? attributes.get(key) : null;
}
/**
- * @return all attributes associated with this handle
+ * Gets all attributes associated with this handle.
+ *
+ * @return all attributes associated with this handle.
*/
public Collection<Object> getAttributes() {
if (attributes == null) {
@@ -151,28 +156,47 @@ public class InstructionHandle {
return attributes.values();
}
+ /**
+ * Gets the instruction.
+ *
+ * @return the instruction.
+ */
public final Instruction getInstruction() {
return instruction;
}
+ /**
+ * Gets the next instruction handle.
+ *
+ * @return the next instruction handle.
+ */
public final InstructionHandle getNext() {
return next;
}
/**
- * @return the position, i.e., the byte code offset of the contained instruction. This is accurate only after
+ * Gets the position.
+ *
+ * @return the position, the byte code offset of the contained instruction. This is accurate only after
* InstructionList.setPositions() has been called.
*/
public int getPosition() {
return i_position;
}
+ /**
+ * Gets the previous instruction handle.
+ *
+ * @return the previous instruction handle.
+ */
public final InstructionHandle getPrev() {
return prev;
}
/**
- * @return null, if there are no targeters
+ * Gets the targeters.
+ *
+ * @return null, if there are no targeters.
*/
public InstructionTargeter[] getTargeters() {
if (!hasTargeters()) {
@@ -199,7 +223,7 @@ public class InstructionHandle {
/**
* Delete an attribute of an instruction handle.
*
- * @param key the key object to retrieve the attribute
+ * @param key the key object to retrieve the attribute.
*/
public void removeAttribute(final Object key) {
if (attributes != null) {
@@ -209,6 +233,8 @@ public class InstructionHandle {
/**
* Denote this handle isn't referenced anymore by t.
+ *
+ * @param t the instruction targeter.
*/
public void removeTargeter(final InstructionTargeter t) {
if (targeters != null) {
@@ -218,6 +244,8 @@ public class InstructionHandle {
/**
* Replace current instruction contained in this handle. Old instruction is disposed using Instruction.dispose().
+ *
+ * @param i the new instruction.
*/
public void setInstruction(final Instruction i) { // Overridden in BranchHandle TODO could be package-protected?
if (i == null) {
@@ -233,7 +261,10 @@ public class InstructionHandle {
}
/**
- * @param next the next to set
+ * Sets the next instruction handle.
+ *
+ * @param next the next to set.
+ * @return the next instruction handle.
* @since 6.0
*/
final InstructionHandle setNext(final InstructionHandle next) {
@@ -242,14 +273,19 @@ public class InstructionHandle {
}
/**
- * Sets the position, i.e., the byte code offset of the contained instruction.
+ * Sets the position, the byte code offset of the contained instruction.
+ *
+ * @param pos the position.
*/
void setPosition(final int pos) {
i_position = pos;
}
/**
- * @param prev the prev to set
+ * Sets the previous instruction handle.
+ *
+ * @param prev the prev to set.
+ * @return the previous instruction handle.
* @since 6.0
*/
final InstructionHandle setPrev(final InstructionHandle prev) {
@@ -263,6 +299,9 @@ public class InstructionHandle {
* <p>
* Warning: if this is used on a BranchHandle then some methods such as getPosition() will still refer to the original
* cached instruction, whereas other BH methods may affect the cache and the replacement instruction.
+ *
+ * @param i the replacement instruction.
+ * @return the old instruction.
*/
// See BCEL-273
// TODO remove this method in any redesign of BCEL
@@ -273,6 +312,8 @@ public class InstructionHandle {
}
/**
+ * Gets a string representation of the contained instruction.
+ *
* @return a string representation of the contained instruction.
*/
@Override
@@ -281,6 +322,9 @@ public class InstructionHandle {
}
/**
+ * Gets a verbose string representation of the contained instruction.
+ *
+ * @param verbose whether to be verbose.
* @return a (verbose) string representation of the contained instruction.
*/
public String toString(final boolean verbose) {
@@ -292,9 +336,9 @@ public class InstructionHandle {
* length instructions 'setPositions()' performs multiple passes over the instruction list to calculate the correct
* (byte) positions and offsets by calling this function.
*
- * @param offset additional offset caused by preceding (variable length) instructions
- * @param maxOffset the maximum offset that may be caused by these instructions
- * @return additional offset caused by possible change of this instruction's length
+ * @param offset additional offset caused by preceding (variable length) instructions.
+ * @param maxOffset the maximum offset that may be caused by these instructions.
+ * @return additional offset caused by possible change of this instruction's length.
*/
protected int updatePosition(final int offset, final int maxOffset) {
i_position += offset;