Skip to content

Commit 4bef9fe

Browse files
committed
Bytecode analyser cleanup
- Add documentation link for constant pool - order tags for readability
1 parent 2d3ff66 commit 4bef9fe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/scijava/annotations/ByteCodeAnalyzer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ private double getDoubleConstant(final int index) {
107107
getU4(offset + 5));
108108
}
109109

110+
// See https://en.wikipedia.org/wiki/Java_class_file#The_constant_pool for the
111+
// meaning of the offsets behind these numbers
110112
private void getConstantPoolOffsets() {
111113
final int poolCount = getU2(8) - 1;
112114
poolOffsets = new int[poolCount];
@@ -115,8 +117,8 @@ private void getConstantPoolOffsets() {
115117
poolOffsets[i] = offset;
116118
final int tag = getU1(offset);
117119
if (tag == 7 || tag == 8) offset += 3;
118-
else if (tag == 9 || tag == 10 || tag == 11 || tag == 3 || tag == 4 ||
119-
tag == 12) offset += 5;
120+
else if (tag == 3 || tag == 4 || tag == 9 || tag == 10
121+
|| tag == 11 || tag == 12) offset += 5;
120122
else if (tag == 5 || tag == 6) {
121123
poolOffsets[++i] = offset;
122124
offset += 9;

0 commit comments

Comments
 (0)