1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.compress.harmony.unpack200.bytecode.forms;
18
19 import org.apache.commons.compress.harmony.pack200.Pack200Exception;
20 import org.apache.commons.compress.harmony.unpack200.SegmentConstantPool;
21 import org.apache.commons.compress.harmony.unpack200.bytecode.ByteCode;
22 import org.apache.commons.compress.harmony.unpack200.bytecode.ClassFileEntry;
23 import org.apache.commons.compress.harmony.unpack200.bytecode.OperandManager;
24
25
26
27
28
29 public abstract class ClassSpecificReferenceForm extends ReferenceForm {
30
31 public ClassSpecificReferenceForm(final int opcode, final String name, final int[] rewrite) {
32 super(opcode, name, rewrite);
33 }
34
35 protected abstract String context(OperandManager operandManager);
36
37 @Override
38 protected abstract int getOffset(OperandManager operandManager);
39
40 @Override
41 protected abstract int getPoolID();
42
43 @Override
44 protected void setNestedEntries(final ByteCode byteCode, final OperandManager operandManager, final int offset) throws Pack200Exception {
45 final SegmentConstantPool globalPool = operandManager.globalConstantPool();
46 final ClassFileEntry[] nested = { globalPool.getClassSpecificPoolEntry(getPoolID(), offset, context(operandManager)) };
47 byteCode.setNested(nested);
48 byteCode.setNestedPositions(new int[][] { { 0, 2 } });
49 }
50
51 }