1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 | package Torello.Java.Additional;
import Torello.Java.ReadOnly.ReadOnlyList;
class DereferencedValue
{
@SuppressWarnings("unchecked")
static Object get(
final ReadOnlyList<Byte> tags,
final ReadOnlyList<Object> values,
final byte tag,
final int i
)
{
try
{
// 0 & 2: UNUSED
// 1-String, 3-Integer, 4-Float, 5-Long, 6-Double
if (tag < 7) return values.get(i);
switch (tag)
{
case /* 07 */ ConstantPool.TAG_CLASS:
case /* 08 */ ConstantPool.TAG_STRING:
return values.get((Integer) values.get(i));
case /* 09 */ ConstantPool.TAG_FIELD_REF:
case /* 10 */ ConstantPool.TAG_METHOD_REF:
case /* 10 */ ConstantPool.TAG_INTERFACE_METHOD_REF:
return new ConstantPool.Reference(tags, values, i);
case /* 12 */ ConstantPool.TAG_NAME_AND_TYPE:
final Ret2<Integer, Integer> r2 =
(Ret2<Integer, Integer>) values.get(i);
return new Ret2<String, String>
((String) values.get(r2.a), (String) values.get(r2.b));
case /* 15 */ ConstantPool.TAG_METHOD_HANDLE:
return new ConstantPool.MethodHandle(tags, values, i);
case /* 16 */ ConstantPool.TAG_METHOD_TYPE:
return values.get(i);
case /* 17 */ ConstantPool.TAG_DYNAMIC:
case /* 18 */ ConstantPool.TAG_INVOKE_DYNAMIC:
return new ConstantPool.Dynamic(tags, values, i);
case /* 19 */ ConstantPool.TAG_MODULE:
case /* 20 */ ConstantPool.TAG_PACKAGE:
return values.get((Integer) values.get(i));
default:
throw new ConstantPoolError("Unrecognized Tag in Constant-Pool tags List: " + tag);
}
}
catch (ClassCastException cce)
{
throw new ConstantPoolError(
"The internal Constant-Pool Lists are corrupted. A Class Cast Exception " +
"was thrown.",
cce
);
}
}
}
|