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-compress.git
The following commit(s) were added to refs/heads/master by this push:
new 48dab7c02 Javadoc
48dab7c02 is described below
commit 48dab7c02f281d42264f93a35b0f80fc3fe16c03
Author: Gary D. Gregory <[email protected]>
AuthorDate: Thu Aug 14 22:23:33 2025 -0400
Javadoc
---
.../compress/harmony/unpack200/BcBands.java | 36 +++++++++++++++++++++-
.../unpack200/bytecode/forms/LookupSwitchForm.java | 12 ++------
2 files changed, 37 insertions(+), 11 deletions(-)
diff --git
a/src/main/java/org/apache/commons/compress/harmony/unpack200/BcBands.java
b/src/main/java/org/apache/commons/compress/harmony/unpack200/BcBands.java
index 67927e193..af4a2bea0 100644
--- a/src/main/java/org/apache/commons/compress/harmony/unpack200/BcBands.java
+++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/BcBands.java
@@ -37,7 +37,41 @@
import org.apache.commons.compress.harmony.unpack200.bytecode.OperandManager;
/**
- * Bytecode bands.
+ * Bytecode bands that transmit bytecode instructions.
+ *
+ * <pre>
+ * bc_bands:
+ * *bc_codes :BYTE1 [...]
+ * *bc_case_count :UNSIGNED5 [COUNT(switch,*bc_codes)]
+ * *bc_case_value :DELTA5 [...]
+ * *bc_byte :BYTE1 [...]
+ * *bc_short :DELTA5 [...]
+ * *bc_local :UNSIGNED5 [...]
+ * *bc_label :BRANCH5 [...]
+ * *bc_intref :DELTA5 [...] (cp_Int)
+ * *bc_floatref :DELTA5 [...] (cp_Float)
+ * *bc_longref :DELTA5 [...] (cp_Long)
+ * *bc_doubleref :DELTA5 [...] (cp_Double)
+ * *bc_stringref :DELTA5 [...] (cp_String)
+ * *bc_loadablevalueref :DELTA5 [...] (cp_LoadableValue)
+ * *bc_classref :UNSIGNED5 [...] (current class or cp_Class)
+ * *bc_fieldref :DELTA5 [...] (cp_Field)
+ * *bc_methodref :UNSIGNED5 [...] (cp_Method)
+ * *bc_imethodref :DELTA5 [...] (cp_Imethod)
+ * *bc_indyref :DELTA5 [...] (cp_InvokeDynamic)
+ * *bc_thisfield :UNSIGNED5 [...] (cp_Field, only for current class)
+ * *bc_superfield :UNSIGNED5 [...] (cp_Field, only for current super)
+ * *bc_thismethod :UNSIGNED5 [...] (cp_Method, only for current class)
+ * *bc_supermethod :UNSIGNED5 [...] (cp_Method, only for current super)
+ * *bc_initref :UNSIGNED5 [...] (cp_Field, only for most recent new)
+ * *bc_escref :UNSIGNED5 [COUNT(ref_escape,*bc_codes)] (cp_All)
+ * *bc_escrefsize :UNSIGNED5 [...]
+ * *bc_escsize :UNSIGNED5 [...]
+ * *bc_escbyte :BYTE1 [...]
+ * </pre>
+ *
+ * @see <a
href="https://docs.oracle.com/en/java/javase/13/docs/specs/pack-spec.html">Pack200:
A Packed Class Deployment Format For Java Applications - 5.10.
+ * Bytecode Instructions</a>
*/
public class BcBands extends BandSet {
diff --git
a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/LookupSwitchForm.java
b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/LookupSwitchForm.java
index 625c9d08e..c44215168 100644
---
a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/LookupSwitchForm.java
+++
b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/LookupSwitchForm.java
@@ -46,21 +46,19 @@ public void setByteCodeOperands(final ByteCode byteCode,
final OperandManager op
Arrays.setAll(caseValues, i -> operandManager.nextCaseValues());
final int[] casePcs = new int[caseCount];
Arrays.setAll(casePcs, i -> operandManager.nextLabel());
-
final int[] labelsArray = new int[caseCount + 1];
labelsArray[0] = defaultPc;
System.arraycopy(casePcs, 0, labelsArray, 1, caseCount + 1 - 1);
byteCode.setByteCodeTargets(labelsArray);
-
// All this gets dumped into the rewrite bytes of the
// poor bytecode.
-
+ //
// Unlike most byte codes, the LookupSwitch is a
// variable-sized bytecode. Because of this, the
// rewrite array has to be defined here individually
// for each bytecode, rather than in the ByteCodeForm
// class.
-
+ //
// First, there's the bytecode. Then there are 0-3
// bytes of padding so that the first (default)
// label is on a 4-byte offset.
@@ -68,31 +66,25 @@ public void setByteCodeOperands(final ByteCode byteCode,
final OperandManager op
final int rewriteSize = 1 + padLength + 4 // defaultbytes
+ 4 // npairs
+ 4 * caseValues.length + 4 * casePcs.length;
-
final int[] newRewrite = new int[rewriteSize];
int rewriteIndex = 0;
-
// Fill in what we can now
// opcode
newRewrite[rewriteIndex++] = byteCode.getOpcode();
-
// padding
for (int index = 0; index < padLength; index++) {
newRewrite[rewriteIndex++] = 0;
}
-
// defaultbyte
// This gets overwritten by fixUpByteCodeTargets
newRewrite[rewriteIndex++] = -1;
newRewrite[rewriteIndex++] = -1;
newRewrite[rewriteIndex++] = -1;
newRewrite[rewriteIndex++] = -1;
-
// npairs
final int npairsIndex = rewriteIndex;
setRewrite4Bytes(caseValues.length, npairsIndex, newRewrite);
rewriteIndex += 4;
-
// match-offset pairs
// The caseValues aren't overwritten, but the
// casePcs will get overwritten by fixUpByteCodeTargets