author | jjg |
Tue, 02 Feb 2010 10:56:10 -0800 | |
changeset 4873 | cc4a679a96a2 |
parent 3536 | dee1b5833af7 |
child 5520 | 86e4b9a9da40 |
permissions | -rw-r--r-- |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1 |
/* |
735 | 2 |
* Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
4 |
* |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Sun designates this |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
10 |
* |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
15 |
* accompanied this code). |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
16 |
* |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
20 |
* |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
23 |
* have any questions. |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
24 |
*/ |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
25 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
26 |
package com.sun.tools.javap; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
27 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
28 |
import com.sun.tools.classfile.Annotation; |
3149 | 29 |
import com.sun.tools.classfile.ExtendedAnnotation; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
30 |
import com.sun.tools.classfile.Annotation.Annotation_element_value; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
31 |
import com.sun.tools.classfile.Annotation.Array_element_value; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
32 |
import com.sun.tools.classfile.Annotation.Class_element_value; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
33 |
import com.sun.tools.classfile.Annotation.Enum_element_value; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
34 |
import com.sun.tools.classfile.Annotation.Primitive_element_value; |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
35 |
import com.sun.tools.classfile.ConstantPool; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
36 |
import com.sun.tools.classfile.ConstantPoolException; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
37 |
import com.sun.tools.classfile.Descriptor; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
38 |
import com.sun.tools.classfile.Descriptor.InvalidDescriptor; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
39 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
40 |
/** |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
41 |
* A writer for writing annotations as text. |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
42 |
* |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
43 |
* <p><b>This is NOT part of any API supported by Sun Microsystems. If |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
44 |
* you write code that depends on this, you do so at your own risk. |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
45 |
* This code and its internal interfaces are subject to change or |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
46 |
* deletion without notice.</b> |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
47 |
*/ |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
48 |
public class AnnotationWriter extends BasicWriter { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
49 |
static AnnotationWriter instance(Context context) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
50 |
AnnotationWriter instance = context.get(AnnotationWriter.class); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
51 |
if (instance == null) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
52 |
instance = new AnnotationWriter(context); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
53 |
return instance; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
54 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
55 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
56 |
protected AnnotationWriter(Context context) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
57 |
super(context); |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
58 |
classWriter = ClassWriter.instance(context); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
59 |
constantWriter = ConstantWriter.instance(context); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
60 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
61 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
62 |
public void write(Annotation annot) { |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
63 |
write(annot, false); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
64 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
65 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
66 |
public void write(Annotation annot, boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
67 |
writeDescriptor(annot.type_index, resolveIndices); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
68 |
boolean showParens = annot.num_element_value_pairs > 0 || !resolveIndices; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
69 |
if (showParens) |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
70 |
print("("); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
71 |
for (int i = 0; i < annot.num_element_value_pairs; i++) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
72 |
if (i > 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
73 |
print(","); |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
74 |
write(annot.element_value_pairs[i], resolveIndices); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
75 |
} |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
76 |
if (showParens) |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
77 |
print(")"); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
78 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
79 |
|
3149 | 80 |
public void write(ExtendedAnnotation annot) { |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
81 |
write(annot, true, false); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
82 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
83 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
84 |
public void write(ExtendedAnnotation annot, boolean showOffsets, boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
85 |
write(annot.annotation, resolveIndices); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
86 |
print(": "); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
87 |
write(annot.position, showOffsets); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
88 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
89 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
90 |
public void write(ExtendedAnnotation.Position pos, boolean showOffsets) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
91 |
print(pos.type); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
92 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
93 |
switch (pos.type) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
94 |
// type case |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
95 |
case TYPECAST: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
96 |
case TYPECAST_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
97 |
// object creation |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
98 |
case INSTANCEOF: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
99 |
case INSTANCEOF_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
100 |
// new expression |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
101 |
case NEW: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
102 |
case NEW_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
103 |
case NEW_TYPE_ARGUMENT: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
104 |
case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
105 |
if (showOffsets) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
106 |
print(", offset="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
107 |
print(pos.offset); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
108 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
109 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
110 |
// local variable |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
111 |
case LOCAL_VARIABLE: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
112 |
case LOCAL_VARIABLE_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
113 |
print(", {"); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
114 |
for (int i = 0; i < pos.lvarOffset.length; ++i) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
115 |
if (i != 0) print("; "); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
116 |
if (showOffsets) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
117 |
print(", start_pc="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
118 |
print(pos.lvarOffset[i]); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
119 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
120 |
print(", length="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
121 |
print(pos.lvarLength[i]); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
122 |
print(", index="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
123 |
print(pos.lvarIndex[i]); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
124 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
125 |
print("}"); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
126 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
127 |
// method receiver |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
128 |
case METHOD_RECEIVER: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
129 |
// Do nothing |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
130 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
131 |
// type parameters |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
132 |
case CLASS_TYPE_PARAMETER: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
133 |
case METHOD_TYPE_PARAMETER: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
134 |
print(", param_index="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
135 |
print(pos.parameter_index); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
136 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
137 |
// type parameters bound |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
138 |
case CLASS_TYPE_PARAMETER_BOUND: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
139 |
case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
140 |
case METHOD_TYPE_PARAMETER_BOUND: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
141 |
case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
142 |
print(", param_index="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
143 |
print(pos.parameter_index); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
144 |
print(", bound_index="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
145 |
print(pos.bound_index); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
146 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
147 |
// wildcard |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
148 |
case WILDCARD_BOUND: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
149 |
case WILDCARD_BOUND_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
150 |
print(", wild_card="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
151 |
print(pos.wildcard_position); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
152 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
153 |
// Class extends and implements clauses |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
154 |
case CLASS_EXTENDS: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
155 |
case CLASS_EXTENDS_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
156 |
print(", type_index="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
157 |
print(pos.type_index); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
158 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
159 |
// throws |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
160 |
case THROWS: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
161 |
print(", type_index="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
162 |
print(pos.type_index); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
163 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
164 |
case CLASS_LITERAL: |
4873 | 165 |
case CLASS_LITERAL_GENERIC_OR_ARRAY: |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
166 |
if (showOffsets) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
167 |
print(", offset="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
168 |
print(pos.offset); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
169 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
170 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
171 |
// method parameter: not specified |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
172 |
case METHOD_PARAMETER_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
173 |
print(", param_index="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
174 |
print(pos.parameter_index); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
175 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
176 |
// method type argument: wasn't specified |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
177 |
case METHOD_TYPE_ARGUMENT: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
178 |
case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
179 |
if (showOffsets) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
180 |
print(", offset="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
181 |
print(pos.offset); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
182 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
183 |
print(", type_index="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
184 |
print(pos.type_index); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
185 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
186 |
// We don't need to worry abut these |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
187 |
case METHOD_RETURN_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
188 |
case FIELD_GENERIC_OR_ARRAY: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
189 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
190 |
case UNKNOWN: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
191 |
break; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
192 |
default: |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
193 |
throw new AssertionError("unknown type: " + pos.type); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
194 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
195 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
196 |
// Append location data for generics/arrays. |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
197 |
if (pos.type.hasLocation()) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
198 |
print(", location="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
199 |
print(pos.location); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
200 |
} |
3149 | 201 |
} |
202 |
||
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
203 |
public void write(Annotation.element_value_pair pair) { |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
204 |
write(pair, false); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
205 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
206 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
207 |
public void write(Annotation.element_value_pair pair, boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
208 |
writeIndex(pair.element_name_index, resolveIndices); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
209 |
print("="); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
210 |
write(pair.value, resolveIndices); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
211 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
212 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
213 |
public void write(Annotation.element_value value) { |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
214 |
write(value, false); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
215 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
216 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
217 |
public void write(Annotation.element_value value, boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
218 |
ev_writer.write(value, resolveIndices); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
219 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
220 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
221 |
private void writeDescriptor(int index, boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
222 |
if (resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
223 |
try { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
224 |
ConstantPool constant_pool = classWriter.getClassFile().constant_pool; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
225 |
Descriptor d = new Descriptor(index); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
226 |
print(d.getFieldType(constant_pool)); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
227 |
return; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
228 |
} catch (ConstantPoolException ignore) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
229 |
} catch (InvalidDescriptor ignore) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
230 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
231 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
232 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
233 |
print("#" + index); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
234 |
} |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
235 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
236 |
private void writeIndex(int index, boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
237 |
if (resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
238 |
print(constantWriter.stringValue(index)); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
239 |
} else |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
240 |
print("#" + index); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
241 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
242 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
243 |
element_value_Writer ev_writer = new element_value_Writer(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
244 |
|
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
245 |
class element_value_Writer implements Annotation.element_value.Visitor<Void,Boolean> { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
246 |
public void write(Annotation.element_value value, boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
247 |
value.accept(this, resolveIndices); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
248 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
249 |
|
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
250 |
public Void visitPrimitive(Primitive_element_value ev, Boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
251 |
if (resolveIndices) |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
252 |
writeIndex(ev.const_value_index, resolveIndices); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
253 |
else |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
254 |
print(((char) ev.tag) + "#" + ev.const_value_index); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
255 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
256 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
257 |
|
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
258 |
public Void visitEnum(Enum_element_value ev, Boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
259 |
if (resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
260 |
writeIndex(ev.type_name_index, resolveIndices); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
261 |
print("."); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
262 |
writeIndex(ev.const_name_index, resolveIndices); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
263 |
} else |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
264 |
print(((char) ev.tag) + "#" + ev.type_name_index + ".#" + ev.const_name_index); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
265 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
266 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
267 |
|
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
268 |
public Void visitClass(Class_element_value ev, Boolean resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
269 |
if (resolveIndices) { |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
270 |
writeIndex(ev.class_info_index, resolveIndices); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
271 |
print(".class"); |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
272 |
} else |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
273 |
print(((char) ev.tag) + "#" + ev.class_info_index); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
274 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
275 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
276 |
|
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
277 |
public Void visitAnnotation(Annotation_element_value ev, Boolean resolveIndices) { |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
278 |
print((char) ev.tag); |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
279 |
AnnotationWriter.this.write(ev.annotation_value, resolveIndices); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
280 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
281 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
282 |
|
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
283 |
public Void visitArray(Array_element_value ev, Boolean resolveIndices) { |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
284 |
print("["); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
285 |
for (int i = 0; i < ev.num_values; i++) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
286 |
if (i > 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
287 |
print(","); |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
288 |
write(ev.values[i], resolveIndices); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
289 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
290 |
print("]"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
291 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
292 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
293 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
294 |
} |
3536
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
295 |
|
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
296 |
private ClassWriter classWriter; |
dee1b5833af7
6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
3149
diff
changeset
|
297 |
private ConstantWriter constantWriter; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
298 |
} |