author | dfuchs |
Tue, 20 Aug 2019 15:40:49 +0100 | |
changeset 57815 | 348f7933e2cc |
parent 50735 | 2f2af62dfac7 |
child 59232 | d4ddf19c2624 |
permissions | -rw-r--r-- |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1 |
/* |
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. 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 |
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
727
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 |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
727
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 |
* |
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
727
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.AccessFlags; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
29 |
import com.sun.tools.classfile.AnnotationDefault_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
30 |
import com.sun.tools.classfile.Attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
31 |
import com.sun.tools.classfile.Attributes; |
8042 | 32 |
import com.sun.tools.classfile.BootstrapMethods_attribute; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
33 |
import com.sun.tools.classfile.CharacterRangeTable_attribute; |
36526 | 34 |
import com.sun.tools.classfile.CharacterRangeTable_attribute.Entry; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
35 |
import com.sun.tools.classfile.Code_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
36 |
import com.sun.tools.classfile.CompilationID_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
37 |
import com.sun.tools.classfile.ConstantPool; |
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
38 |
import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
39 |
import com.sun.tools.classfile.ConstantPoolException; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
40 |
import com.sun.tools.classfile.ConstantValue_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
41 |
import com.sun.tools.classfile.DefaultAttribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
42 |
import com.sun.tools.classfile.Deprecated_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
43 |
import com.sun.tools.classfile.EnclosingMethod_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
44 |
import com.sun.tools.classfile.Exceptions_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
45 |
import com.sun.tools.classfile.InnerClasses_attribute; |
36526 | 46 |
import com.sun.tools.classfile.InnerClasses_attribute.Info; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
47 |
import com.sun.tools.classfile.LineNumberTable_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
48 |
import com.sun.tools.classfile.LocalVariableTable_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
49 |
import com.sun.tools.classfile.LocalVariableTypeTable_attribute; |
15031
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
50 |
import com.sun.tools.classfile.MethodParameters_attribute; |
36526 | 51 |
import com.sun.tools.classfile.Module_attribute; |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
52 |
import com.sun.tools.classfile.ModuleHashes_attribute; |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
53 |
import com.sun.tools.classfile.ModuleMainClass_attribute; |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
54 |
import com.sun.tools.classfile.ModulePackages_attribute; |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
55 |
import com.sun.tools.classfile.ModuleResolution_attribute; |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
56 |
import com.sun.tools.classfile.ModuleTarget_attribute; |
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
57 |
import com.sun.tools.classfile.NestHost_attribute; |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
58 |
import com.sun.tools.classfile.NestMembers_attribute; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
59 |
import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
60 |
import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute; |
15385 | 61 |
import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute; |
43364
469da954ee6b
8051768: Inconsistent output for Visible and InvisibleParameterAnnotations
jjg
parents:
42822
diff
changeset
|
62 |
import com.sun.tools.classfile.RuntimeParameterAnnotations_attribute; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
63 |
import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
64 |
import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute; |
15385 | 65 |
import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute; |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
66 |
import com.sun.tools.classfile.Signature_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
67 |
import com.sun.tools.classfile.SourceDebugExtension_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
68 |
import com.sun.tools.classfile.SourceFile_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
69 |
import com.sun.tools.classfile.SourceID_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
70 |
import com.sun.tools.classfile.StackMapTable_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
71 |
import com.sun.tools.classfile.StackMap_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
72 |
import com.sun.tools.classfile.Synthetic_attribute; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
73 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
74 |
import static com.sun.tools.classfile.AccessFlags.*; |
29291
076c277565f7
8073550: java* tools: replace obj.getClass hacks with Assert.checkNonNull or Objects.requireNonNull
mcimadamore
parents:
26389
diff
changeset
|
75 |
|
076c277565f7
8073550: java* tools: replace obj.getClass hacks with Assert.checkNonNull or Objects.requireNonNull
mcimadamore
parents:
26389
diff
changeset
|
76 |
import com.sun.tools.javac.util.Assert; |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
18670
diff
changeset
|
77 |
import com.sun.tools.javac.util.StringUtils; |
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 |
/* |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
80 |
* A writer for writing Attributes as text. |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
81 |
* |
5847
1908176fd6e3
6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
82 |
* <p><b>This is NOT part of any supported API. |
1908176fd6e3
6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
83 |
* If you write code that depends on this, you do so at your own risk. |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
84 |
* 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
|
85 |
* deletion without notice.</b> |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
86 |
*/ |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
87 |
public class AttributeWriter extends BasicWriter |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
88 |
implements Attribute.Visitor<Void,Void> |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
89 |
{ |
3141
79c119fae7fb
6852856: javap changes to facilitate subclassing javap for variants
jjg
parents:
735
diff
changeset
|
90 |
public static AttributeWriter instance(Context context) { |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
91 |
AttributeWriter instance = context.get(AttributeWriter.class); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
92 |
if (instance == null) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
93 |
instance = new AttributeWriter(context); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
94 |
return instance; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
95 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
96 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
97 |
protected AttributeWriter(Context context) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
98 |
super(context); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
99 |
context.put(AttributeWriter.class, this); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
100 |
annotationWriter = AnnotationWriter.instance(context); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
101 |
codeWriter = CodeWriter.instance(context); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
102 |
constantWriter = ConstantWriter.instance(context); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
103 |
options = Options.instance(context); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
104 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
105 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
106 |
public void write(Object owner, Attribute attr, ConstantPool constant_pool) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
107 |
if (attr != null) { |
29291
076c277565f7
8073550: java* tools: replace obj.getClass hacks with Assert.checkNonNull or Objects.requireNonNull
mcimadamore
parents:
26389
diff
changeset
|
108 |
Assert.checkNonNull(constant_pool); |
076c277565f7
8073550: java* tools: replace obj.getClass hacks with Assert.checkNonNull or Objects.requireNonNull
mcimadamore
parents:
26389
diff
changeset
|
109 |
Assert.checkNonNull(owner); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
110 |
this.constant_pool = constant_pool; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
111 |
this.owner = owner; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
112 |
attr.accept(this, null); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
113 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
114 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
115 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
116 |
public void write(Object owner, Attributes attrs, ConstantPool constant_pool) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
117 |
if (attrs != null) { |
29291
076c277565f7
8073550: java* tools: replace obj.getClass hacks with Assert.checkNonNull or Objects.requireNonNull
mcimadamore
parents:
26389
diff
changeset
|
118 |
Assert.checkNonNull(constant_pool); |
076c277565f7
8073550: java* tools: replace obj.getClass hacks with Assert.checkNonNull or Objects.requireNonNull
mcimadamore
parents:
26389
diff
changeset
|
119 |
Assert.checkNonNull(owner); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
120 |
this.constant_pool = constant_pool; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
121 |
this.owner = owner; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
122 |
for (Attribute attr: attrs) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
123 |
attr.accept(this, null); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
124 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
125 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
126 |
|
36526 | 127 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
128 |
public Void visitDefault(DefaultAttribute attr, Void ignore) { |
18667
7c871925691f
6983646: javap should identify why a DefaultAttribute is being used
vromero
parents:
18665
diff
changeset
|
129 |
if (attr.reason != null) { |
7c871925691f
6983646: javap should identify why a DefaultAttribute is being used
vromero
parents:
18665
diff
changeset
|
130 |
report(attr.reason); |
7c871925691f
6983646: javap should identify why a DefaultAttribute is being used
vromero
parents:
18665
diff
changeset
|
131 |
} |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
132 |
byte[] data = attr.info; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
133 |
int i = 0; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
134 |
int j = 0; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
135 |
print(" "); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
136 |
try { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
137 |
print(attr.getName(constant_pool)); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
138 |
} catch (ConstantPoolException e) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
139 |
report(e); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
140 |
print("attribute name = #" + attr.attribute_name_index); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
141 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
142 |
print(": "); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
143 |
println("length = 0x" + toHex(attr.info.length)); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
144 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
145 |
print(" "); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
146 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
147 |
while (i < data.length) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
148 |
print(toHex(data[i], 2)); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
149 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
150 |
j++; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
151 |
if (j == 16) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
152 |
println(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
153 |
print(" "); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
154 |
j = 0; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
155 |
} else { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
156 |
print(" "); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
157 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
158 |
i++; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
159 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
160 |
println(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
161 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
162 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
163 |
|
36526 | 164 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
165 |
public Void visitAnnotationDefault(AnnotationDefault_attribute attr, Void ignore) { |
3546 | 166 |
println("AnnotationDefault:"); |
167 |
indent(+1); |
|
168 |
print("default_value: "); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
169 |
annotationWriter.write(attr.default_value); |
3546 | 170 |
indent(-1); |
43365
3e7c663d33a5
8041793: javap misses newline after printing AnnotationDefault
jjg
parents:
43364
diff
changeset
|
171 |
println(); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
172 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
173 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
174 |
|
36526 | 175 |
@Override |
8042 | 176 |
public Void visitBootstrapMethods(BootstrapMethods_attribute attr, Void p) { |
177 |
println(Attribute.BootstrapMethods + ":"); |
|
178 |
for (int i = 0; i < attr.bootstrap_method_specifiers.length ; i++) { |
|
179 |
BootstrapMethods_attribute.BootstrapMethodSpecifier bsm = attr.bootstrap_method_specifiers[i]; |
|
180 |
indent(+1); |
|
181 |
print(i + ": #" + bsm.bootstrap_method_ref + " "); |
|
182 |
println(constantWriter.stringValue(bsm.bootstrap_method_ref)); |
|
183 |
indent(+1); |
|
184 |
println("Method arguments:"); |
|
185 |
indent(+1); |
|
186 |
for (int j = 0; j < bsm.bootstrap_arguments.length; j++) { |
|
187 |
print("#" + bsm.bootstrap_arguments[j] + " "); |
|
188 |
println(constantWriter.stringValue(bsm.bootstrap_arguments[j])); |
|
189 |
} |
|
190 |
indent(-3); |
|
191 |
} |
|
192 |
return null; |
|
193 |
} |
|
194 |
||
36526 | 195 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
196 |
public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, Void ignore) { |
3546 | 197 |
println("CharacterRangeTable:"); |
198 |
indent(+1); |
|
36526 | 199 |
for (Entry e : attr.character_range_table) { |
7625
f7374a9d9cc9
7004698: javap does not output CharacterRangeTable attributes correctly
jjg
parents:
5847
diff
changeset
|
200 |
print(String.format(" %2d, %2d, %6x, %6x, %4x", |
f7374a9d9cc9
7004698: javap does not output CharacterRangeTable attributes correctly
jjg
parents:
5847
diff
changeset
|
201 |
e.start_pc, e.end_pc, |
f7374a9d9cc9
7004698: javap does not output CharacterRangeTable attributes correctly
jjg
parents:
5847
diff
changeset
|
202 |
e.character_range_start, e.character_range_end, |
f7374a9d9cc9
7004698: javap does not output CharacterRangeTable attributes correctly
jjg
parents:
5847
diff
changeset
|
203 |
e.flags)); |
3546 | 204 |
tab(); |
7625
f7374a9d9cc9
7004698: javap does not output CharacterRangeTable attributes correctly
jjg
parents:
5847
diff
changeset
|
205 |
print(String.format("// %2d, %2d, %4d:%02d, %4d:%02d", |
f7374a9d9cc9
7004698: javap does not output CharacterRangeTable attributes correctly
jjg
parents:
5847
diff
changeset
|
206 |
e.start_pc, e.end_pc, |
f7374a9d9cc9
7004698: javap does not output CharacterRangeTable attributes correctly
jjg
parents:
5847
diff
changeset
|
207 |
(e.character_range_start >> 10), (e.character_range_start & 0x3ff), |
f7374a9d9cc9
7004698: javap does not output CharacterRangeTable attributes correctly
jjg
parents:
5847
diff
changeset
|
208 |
(e.character_range_end >> 10), (e.character_range_end & 0x3ff))); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
209 |
if ((e.flags & CharacterRangeTable_attribute.CRT_STATEMENT) != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
210 |
print(", statement"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
211 |
if ((e.flags & CharacterRangeTable_attribute.CRT_BLOCK) != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
212 |
print(", block"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
213 |
if ((e.flags & CharacterRangeTable_attribute.CRT_ASSIGNMENT) != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
214 |
print(", assignment"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
215 |
if ((e.flags & CharacterRangeTable_attribute.CRT_FLOW_CONTROLLER) != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
216 |
print(", flow-controller"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
217 |
if ((e.flags & CharacterRangeTable_attribute.CRT_FLOW_TARGET) != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
218 |
print(", flow-target"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
219 |
if ((e.flags & CharacterRangeTable_attribute.CRT_INVOKE) != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
220 |
print(", invoke"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
221 |
if ((e.flags & CharacterRangeTable_attribute.CRT_CREATE) != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
222 |
print(", create"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
223 |
if ((e.flags & CharacterRangeTable_attribute.CRT_BRANCH_TRUE) != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
224 |
print(", branch-true"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
225 |
if ((e.flags & CharacterRangeTable_attribute.CRT_BRANCH_FALSE) != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
226 |
print(", branch-false"); |
7625
f7374a9d9cc9
7004698: javap does not output CharacterRangeTable attributes correctly
jjg
parents:
5847
diff
changeset
|
227 |
println(); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
228 |
} |
3546 | 229 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
230 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
231 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
232 |
|
36526 | 233 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
234 |
public Void visitCode(Code_attribute attr, Void ignore) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
235 |
codeWriter.write(attr, constant_pool); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
236 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
237 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
238 |
|
36526 | 239 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
240 |
public Void visitCompilationID(CompilationID_attribute attr, Void ignore) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
241 |
constantWriter.write(attr.compilationID_index); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
242 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
243 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
244 |
|
36526 | 245 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
246 |
public Void visitConstantValue(ConstantValue_attribute attr, Void ignore) { |
22698 | 247 |
print("ConstantValue: "); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
248 |
constantWriter.write(attr.constantvalue_index); |
3546 | 249 |
println(); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
250 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
251 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
252 |
|
36526 | 253 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
254 |
public Void visitDeprecated(Deprecated_attribute attr, Void ignore) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
255 |
println("Deprecated: true"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
256 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
257 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
258 |
|
36526 | 259 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
260 |
public Void visitEnclosingMethod(EnclosingMethod_attribute attr, Void ignore) { |
3546 | 261 |
print("EnclosingMethod: #" + attr.class_index + ".#" + attr.method_index); |
262 |
tab(); |
|
263 |
print("// " + getJavaClassName(attr)); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
264 |
if (attr.method_index != 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
265 |
print("." + getMethodName(attr)); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
266 |
println(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
267 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
268 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
269 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
270 |
private String getJavaClassName(EnclosingMethod_attribute a) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
271 |
try { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
272 |
return getJavaName(a.getClassName(constant_pool)); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
273 |
} catch (ConstantPoolException e) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
274 |
return report(e); |
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 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
277 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
278 |
private String getMethodName(EnclosingMethod_attribute a) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
279 |
try { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
280 |
return a.getMethodName(constant_pool); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
281 |
} catch (ConstantPoolException e) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
282 |
return report(e); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
283 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
284 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
285 |
|
36526 | 286 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
287 |
public Void visitExceptions(Exceptions_attribute attr, Void ignore) { |
3546 | 288 |
println("Exceptions:"); |
289 |
indent(+1); |
|
290 |
print("throws "); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
291 |
for (int i = 0; i < attr.number_of_exceptions; i++) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
292 |
if (i > 0) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
293 |
print(", "); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
294 |
print(getJavaException(attr, i)); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
295 |
} |
3546 | 296 |
println(); |
297 |
indent(-1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
298 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
299 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
300 |
|
733 | 301 |
private String getJavaException(Exceptions_attribute attr, int index) { |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
302 |
try { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
303 |
return getJavaName(attr.getException(index, constant_pool)); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
304 |
} catch (ConstantPoolException e) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
305 |
return report(e); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
306 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
307 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
308 |
|
36526 | 309 |
|
310 |
@Override |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
311 |
public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
312 |
boolean first = true; |
36526 | 313 |
for (Info info : attr.classes) { |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
314 |
//access |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
315 |
AccessFlags access_flags = info.inner_class_access_flags; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
316 |
if (options.checkAccess(access_flags)) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
317 |
if (first) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
318 |
writeInnerClassHeader(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
319 |
first = false; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
320 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
321 |
for (String name: access_flags.getInnerClassModifiers()) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
322 |
print(name + " "); |
26389
b389165f2c78
8034861: Incorrect format and indentation of InnerClasses section
jjg
parents:
25874
diff
changeset
|
323 |
if (info.inner_name_index != 0) { |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
324 |
print("#" + info.inner_name_index + "= "); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
325 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
326 |
print("#" + info.inner_class_info_index); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
327 |
if (info.outer_class_info_index != 0) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
328 |
print(" of #" + info.outer_class_info_index); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
329 |
} |
26389
b389165f2c78
8034861: Incorrect format and indentation of InnerClasses section
jjg
parents:
25874
diff
changeset
|
330 |
print(";"); |
b389165f2c78
8034861: Incorrect format and indentation of InnerClasses section
jjg
parents:
25874
diff
changeset
|
331 |
tab(); |
b389165f2c78
8034861: Incorrect format and indentation of InnerClasses section
jjg
parents:
25874
diff
changeset
|
332 |
print("// "); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
333 |
if (info.inner_name_index != 0) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
334 |
print(getInnerName(constant_pool, info) + "="); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
335 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
336 |
constantWriter.write(info.inner_class_info_index); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
337 |
if (info.outer_class_info_index != 0) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
338 |
print(" of "); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
339 |
constantWriter.write(info.outer_class_info_index); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
340 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
341 |
println(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
342 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
343 |
} |
3546 | 344 |
if (!first) |
345 |
indent(-1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
346 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
347 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
348 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
349 |
String getInnerName(ConstantPool constant_pool, InnerClasses_attribute.Info info) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
350 |
try { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
351 |
return info.getInnerName(constant_pool); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
352 |
} catch (ConstantPoolException e) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
353 |
return report(e); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
354 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
355 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
356 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
357 |
private void writeInnerClassHeader() { |
22698 | 358 |
println("InnerClasses:"); |
3546 | 359 |
indent(+1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
360 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
361 |
|
36526 | 362 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
363 |
public Void visitLineNumberTable(LineNumberTable_attribute attr, Void ignore) { |
3546 | 364 |
println("LineNumberTable:"); |
365 |
indent(+1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
366 |
for (LineNumberTable_attribute.Entry entry: attr.line_number_table) { |
3546 | 367 |
println("line " + entry.line_number + ": " + entry.start_pc); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
368 |
} |
3546 | 369 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
370 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
371 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
372 |
|
36526 | 373 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
374 |
public Void visitLocalVariableTable(LocalVariableTable_attribute attr, Void ignore) { |
3546 | 375 |
println("LocalVariableTable:"); |
376 |
indent(+1); |
|
377 |
println("Start Length Slot Name Signature"); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
378 |
for (LocalVariableTable_attribute.Entry entry : attr.local_variable_table) { |
18665
49867b085faf
8005552: c.s.t.javap.AttributeWriter.visitLocalVariableTable() uses incorrect format string
vromero
parents:
15720
diff
changeset
|
379 |
println(String.format("%5d %7d %5d %5s %s", |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
380 |
entry.start_pc, entry.length, entry.index, |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
381 |
constantWriter.stringValue(entry.name_index), |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
382 |
constantWriter.stringValue(entry.descriptor_index))); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
383 |
} |
3546 | 384 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
385 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
386 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
387 |
|
36526 | 388 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
389 |
public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, Void ignore) { |
3546 | 390 |
println("LocalVariableTypeTable:"); |
391 |
indent(+1); |
|
392 |
println("Start Length Slot Name Signature"); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
393 |
for (LocalVariableTypeTable_attribute.Entry entry : attr.local_variable_table) { |
3546 | 394 |
println(String.format("%5d %7d %5d %5s %s", |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
395 |
entry.start_pc, entry.length, entry.index, |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
396 |
constantWriter.stringValue(entry.name_index), |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
397 |
constantWriter.stringValue(entry.signature_index))); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
398 |
} |
3546 | 399 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
400 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
401 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
402 |
|
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
403 |
@Override |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
404 |
public Void visitNestHost(NestHost_attribute attr, Void aVoid) { |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
405 |
print("NestHost: "); |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
406 |
constantWriter.write(attr.top_index); |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
407 |
println(); |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
408 |
return null; |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
409 |
} |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
410 |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
411 |
private String getJavaClassName(ModuleMainClass_attribute a) { |
36526 | 412 |
try { |
413 |
return getJavaName(a.getMainClassName(constant_pool)); |
|
414 |
} catch (ConstantPoolException e) { |
|
415 |
return report(e); |
|
416 |
} |
|
417 |
} |
|
418 |
||
15031
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
419 |
private static final String format = "%-31s%s"; |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
420 |
|
36526 | 421 |
@Override |
15031
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
422 |
public Void visitMethodParameters(MethodParameters_attribute attr, |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
423 |
Void ignore) { |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
424 |
final String header = String.format(format, "Name", "Flags"); |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
425 |
println("MethodParameters:"); |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
426 |
indent(+1); |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
427 |
println(header); |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
428 |
for (MethodParameters_attribute.Entry entry : |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
429 |
attr.method_parameter_table) { |
15720
e61b2f7a5148
8006345: Report Synthesized Parameters in java.lang.reflect.Parameter API
mcimadamore
parents:
15385
diff
changeset
|
430 |
String namestr = |
e61b2f7a5148
8006345: Report Synthesized Parameters in java.lang.reflect.Parameter API
mcimadamore
parents:
15385
diff
changeset
|
431 |
entry.name_index != 0 ? |
e61b2f7a5148
8006345: Report Synthesized Parameters in java.lang.reflect.Parameter API
mcimadamore
parents:
15385
diff
changeset
|
432 |
constantWriter.stringValue(entry.name_index) : "<no name>"; |
15031
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
433 |
String flagstr = |
15720
e61b2f7a5148
8006345: Report Synthesized Parameters in java.lang.reflect.Parameter API
mcimadamore
parents:
15385
diff
changeset
|
434 |
(0 != (entry.flags & ACC_FINAL) ? "final " : "") + |
e61b2f7a5148
8006345: Report Synthesized Parameters in java.lang.reflect.Parameter API
mcimadamore
parents:
15385
diff
changeset
|
435 |
(0 != (entry.flags & ACC_MANDATED) ? "mandated " : "") + |
e61b2f7a5148
8006345: Report Synthesized Parameters in java.lang.reflect.Parameter API
mcimadamore
parents:
15385
diff
changeset
|
436 |
(0 != (entry.flags & ACC_SYNTHETIC) ? "synthetic" : ""); |
e61b2f7a5148
8006345: Report Synthesized Parameters in java.lang.reflect.Parameter API
mcimadamore
parents:
15385
diff
changeset
|
437 |
println(String.format(format, namestr, flagstr)); |
15031
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
438 |
} |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
439 |
indent(-1); |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
440 |
return null; |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
441 |
} |
c4fad55a5681
8004727: Add compiler support for parameter reflection
jjg
parents:
8042
diff
changeset
|
442 |
|
36526 | 443 |
@Override |
444 |
public Void visitModule(Module_attribute attr, Void ignore) { |
|
445 |
println("Module:"); |
|
446 |
indent(+1); |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
447 |
|
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
448 |
print("#" + attr.module_name); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
449 |
print(","); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
450 |
print(String.format("%x", attr.module_flags)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
451 |
tab(); |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
452 |
print("// " + constantWriter.stringValue(attr.module_name)); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
453 |
if ((attr.module_flags & Module_attribute.ACC_OPEN) != 0) |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
454 |
print(" ACC_OPEN"); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
455 |
if ((attr.module_flags & Module_attribute.ACC_MANDATED) != 0) |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
456 |
print(" ACC_MANDATED"); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
457 |
if ((attr.module_flags & Module_attribute.ACC_SYNTHETIC) != 0) |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
458 |
print(" ACC_SYNTHETIC"); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
459 |
println(); |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
460 |
print("#" + attr.module_version_index); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
461 |
if (attr.module_version_index != 0) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
462 |
tab(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
463 |
print("// " + constantWriter.stringValue(attr.module_version_index)); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
464 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
465 |
println(); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
466 |
|
36526 | 467 |
printRequiresTable(attr); |
468 |
printExportsTable(attr); |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
469 |
printOpensTable(attr); |
36526 | 470 |
printUsesTable(attr); |
471 |
printProvidesTable(attr); |
|
472 |
indent(-1); |
|
473 |
return null; |
|
474 |
} |
|
475 |
||
476 |
protected void printRequiresTable(Module_attribute attr) { |
|
477 |
Module_attribute.RequiresEntry[] entries = attr.requires; |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
478 |
print(entries.length); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
479 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
480 |
println("// " + "requires"); |
36526 | 481 |
indent(+1); |
482 |
for (Module_attribute.RequiresEntry e: entries) { |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
483 |
print("#" + e.requires_index + "," + String.format("%x", e.requires_flags)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
484 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
485 |
print("// " + constantWriter.stringValue(e.requires_index)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
486 |
if ((e.requires_flags & Module_attribute.ACC_TRANSITIVE) != 0) |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
487 |
print(" ACC_TRANSITIVE"); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
488 |
if ((e.requires_flags & Module_attribute.ACC_STATIC_PHASE) != 0) |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
489 |
print(" ACC_STATIC_PHASE"); |
36526 | 490 |
if ((e.requires_flags & Module_attribute.ACC_SYNTHETIC) != 0) |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
491 |
print(" ACC_SYNTHETIC"); |
36526 | 492 |
if ((e.requires_flags & Module_attribute.ACC_MANDATED) != 0) |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
493 |
print(" ACC_MANDATED"); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
494 |
println(); |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
495 |
print("#" + e.requires_version_index); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
496 |
if (e.requires_version_index != 0) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
497 |
tab(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
498 |
print("// " + constantWriter.stringValue(e.requires_version_index)); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
499 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
500 |
println(); |
36526 | 501 |
} |
502 |
indent(-1); |
|
503 |
} |
|
504 |
||
505 |
protected void printExportsTable(Module_attribute attr) { |
|
506 |
Module_attribute.ExportsEntry[] entries = attr.exports; |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
507 |
print(entries.length); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
508 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
509 |
println("// exports"); |
36526 | 510 |
indent(+1); |
511 |
for (Module_attribute.ExportsEntry e: entries) { |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
512 |
printExportOpenEntry(e.exports_index, e.exports_flags, e.exports_to_index); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
513 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
514 |
indent(-1); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
515 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
516 |
|
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
517 |
protected void printOpensTable(Module_attribute attr) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
518 |
Module_attribute.OpensEntry[] entries = attr.opens; |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
519 |
print(entries.length); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
520 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
521 |
println("// opens"); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
522 |
indent(+1); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
523 |
for (Module_attribute.OpensEntry e: entries) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
524 |
printExportOpenEntry(e.opens_index, e.opens_flags, e.opens_to_index); |
36526 | 525 |
} |
526 |
indent(-1); |
|
527 |
} |
|
528 |
||
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
529 |
protected void printExportOpenEntry(int index, int flags, int[] to_index) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
530 |
print("#" + index + "," + String.format("%x", flags)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
531 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
532 |
print("// "); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
533 |
print(constantWriter.stringValue(index)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
534 |
if ((flags & Module_attribute.ACC_MANDATED) != 0) |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
535 |
print(" ACC_MANDATED"); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
536 |
if ((flags & Module_attribute.ACC_SYNTHETIC) != 0) |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
537 |
print(" ACC_SYNTHETIC"); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
538 |
if (to_index.length == 0) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
539 |
println(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
540 |
} else { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
541 |
println(" to ... " + to_index.length); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
542 |
indent(+1); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
543 |
for (int to: to_index) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
544 |
print("#" + to); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
545 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
546 |
println("// ... to " + constantWriter.stringValue(to)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
547 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
548 |
indent(-1); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
549 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
550 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
551 |
|
36526 | 552 |
protected void printUsesTable(Module_attribute attr) { |
553 |
int[] entries = attr.uses_index; |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
554 |
print(entries.length); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
555 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
556 |
println("// " + "uses"); |
36526 | 557 |
indent(+1); |
558 |
for (int e: entries) { |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
559 |
print("#" + e); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
560 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
561 |
println("// " + constantWriter.stringValue(e)); |
36526 | 562 |
} |
563 |
indent(-1); |
|
564 |
} |
|
565 |
||
566 |
protected void printProvidesTable(Module_attribute attr) { |
|
567 |
Module_attribute.ProvidesEntry[] entries = attr.provides; |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
568 |
print(entries.length); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
569 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
570 |
println("// " + "provides"); |
36526 | 571 |
indent(+1); |
572 |
for (Module_attribute.ProvidesEntry e: entries) { |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
573 |
print("#" + e.provides_index); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
574 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
575 |
print("// "); |
36526 | 576 |
print(constantWriter.stringValue(e.provides_index)); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
577 |
println(" with ... " + e.with_count); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
578 |
indent(+1); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
579 |
for (int with : e.with_index) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
580 |
print("#" + with); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
581 |
tab(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
582 |
println("// ... with " + constantWriter.stringValue(with)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
583 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
584 |
indent(-1); |
36526 | 585 |
} |
586 |
indent(-1); |
|
587 |
} |
|
588 |
||
589 |
@Override |
|
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
590 |
public Void visitModuleHashes(ModuleHashes_attribute attr, Void ignore) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
591 |
println("ModuleHashes:"); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
592 |
indent(+1); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
593 |
print("algorithm: #" + attr.algorithm_index); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
594 |
tab(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
595 |
println("// " + getAlgorithm(attr)); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
596 |
print(attr.hashes_table_length); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
597 |
tab(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
598 |
println("// hashes"); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
599 |
for (ModuleHashes_attribute.Entry e : attr.hashes_table) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
600 |
print("#" + e.module_name_index); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
601 |
tab(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
602 |
println("// " + getModuleName(e)); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
603 |
println("hash_length: " + e.hash.length); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
604 |
println("hash: [" + toHex(e.hash) + "]"); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
605 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
606 |
indent(-1); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
607 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
608 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
609 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
610 |
private String getAlgorithm(ModuleHashes_attribute attr) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
611 |
try { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
612 |
return constant_pool.getUTF8Value(attr.algorithm_index); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
613 |
} catch (ConstantPoolException e) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
614 |
return report(e); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
615 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
616 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
617 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
618 |
private String getModuleName(ModuleHashes_attribute.Entry entry) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
619 |
try { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
620 |
int utf8Index = constant_pool.getModuleInfo(entry.module_name_index).name_index; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
621 |
return constant_pool.getUTF8Value(utf8Index); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
622 |
} catch (ConstantPoolException e) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
623 |
return report(e); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
624 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
625 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
626 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
627 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
628 |
public Void visitModuleMainClass(ModuleMainClass_attribute attr, Void ignore) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
629 |
print("ModuleMainClass: #" + attr.main_class_index); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
630 |
tab(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
631 |
print("// " + getJavaClassName(attr)); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
632 |
println(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
633 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
634 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
635 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
636 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
637 |
public Void visitModulePackages(ModulePackages_attribute attr, Void ignore) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
638 |
println("ModulePackages: "); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
639 |
indent(+1); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
640 |
for (int i = 0; i < attr.packages_count; i++) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
641 |
print("#" + attr.packages_index[i]); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
642 |
tab(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
643 |
println("// " + getJavaPackage(attr, i)); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
644 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
645 |
indent(-1); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
646 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
647 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
648 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
649 |
private String getJavaPackage(ModulePackages_attribute attr, int index) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
650 |
try { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
651 |
return getJavaName(attr.getPackage(index, constant_pool)); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
652 |
} catch (ConstantPoolException e) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
653 |
return report(e); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
654 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
655 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
656 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
657 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
658 |
public Void visitModuleResolution(ModuleResolution_attribute attr, Void ignore) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
659 |
println("ModuleResolution:"); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
660 |
indent(+1); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
661 |
print(String.format("%x", attr.resolution_flags)); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
662 |
tab(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
663 |
print("// "); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
664 |
int flags = attr.resolution_flags; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
665 |
if ((flags & ModuleResolution_attribute.DO_NOT_RESOLVE_BY_DEFAULT) != 0) |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
666 |
print(" DO_NOT_RESOLVE_BY_DEFAULT"); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
667 |
if ((flags & ModuleResolution_attribute.WARN_DEPRECATED) != 0) |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
668 |
print(" WARN_DEPRECATED"); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
669 |
if ((flags & ModuleResolution_attribute.WARN_DEPRECATED_FOR_REMOVAL) != 0) |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
670 |
print(" WARN_DEPRECATED_FOR_REMOVAL"); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
671 |
if ((flags & ModuleResolution_attribute.WARN_INCUBATING) != 0) |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
672 |
print(" WARN_INCUBATING"); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
673 |
println(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
674 |
indent(-1); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
675 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
676 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
677 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
678 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
679 |
public Void visitModuleTarget(ModuleTarget_attribute attr, Void ignore) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
680 |
println("ModuleTarget:"); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
681 |
indent(+1); |
45041
f17345838471
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44386
diff
changeset
|
682 |
print("target_platform: #" + attr.target_platform_index); |
f17345838471
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44386
diff
changeset
|
683 |
if (attr.target_platform_index != 0) { |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
684 |
tab(); |
45041
f17345838471
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44386
diff
changeset
|
685 |
print("// " + getTargetPlatform(attr)); |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
686 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
687 |
println(); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
688 |
indent(-1); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
689 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
690 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
691 |
|
45041
f17345838471
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44386
diff
changeset
|
692 |
private String getTargetPlatform(ModuleTarget_attribute attr) { |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
693 |
try { |
45041
f17345838471
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44386
diff
changeset
|
694 |
return constant_pool.getUTF8Value(attr.target_platform_index); |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
695 |
} catch (ConstantPoolException e) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
696 |
return report(e); |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
697 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
698 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
699 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
700 |
@Override |
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
701 |
public Void visitNestMembers(NestMembers_attribute attr, Void aVoid) { |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
702 |
println("NestMembers:"); |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
703 |
indent(+1); |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
704 |
try { |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
705 |
CONSTANT_Class_info[] children = attr.getChildren(constant_pool); |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
706 |
for (int i = 0; i < attr.members_indexes.length; i++) { |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
707 |
println(constantWriter.stringValue(children[i])); |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
708 |
} |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
709 |
indent(-1); |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
710 |
} catch (ConstantPoolException ex) { |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
711 |
throw new AssertionError(ex); |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
712 |
} |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
713 |
return null; |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
714 |
} |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
715 |
|
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
716 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
717 |
public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) { |
3546 | 718 |
println("RuntimeVisibleAnnotations:"); |
719 |
indent(+1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
720 |
for (int i = 0; i < attr.annotations.length; i++) { |
3546 | 721 |
print(i + ": "); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
722 |
annotationWriter.write(attr.annotations[i]); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
723 |
println(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
724 |
} |
3546 | 725 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
726 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
727 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
728 |
|
36526 | 729 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
730 |
public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, Void ignore) { |
3546 | 731 |
println("RuntimeInvisibleAnnotations:"); |
732 |
indent(+1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
733 |
for (int i = 0; i < attr.annotations.length; i++) { |
3546 | 734 |
print(i + ": "); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
735 |
annotationWriter.write(attr.annotations[i]); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
736 |
println(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
737 |
} |
3546 | 738 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
739 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
740 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
741 |
|
36526 | 742 |
@Override |
15385 | 743 |
public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, Void ignore) { |
744 |
println("RuntimeVisibleTypeAnnotations:"); |
|
745 |
indent(+1); |
|
746 |
for (int i = 0; i < attr.annotations.length; i++) { |
|
747 |
print(i + ": "); |
|
748 |
annotationWriter.write(attr.annotations[i]); |
|
749 |
println(); |
|
750 |
} |
|
751 |
indent(-1); |
|
752 |
return null; |
|
753 |
} |
|
754 |
||
36526 | 755 |
@Override |
15385 | 756 |
public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, Void ignore) { |
757 |
println("RuntimeInvisibleTypeAnnotations:"); |
|
758 |
indent(+1); |
|
759 |
for (int i = 0; i < attr.annotations.length; i++) { |
|
760 |
print(i + ": "); |
|
761 |
annotationWriter.write(attr.annotations[i]); |
|
762 |
println(); |
|
763 |
} |
|
764 |
indent(-1); |
|
765 |
return null; |
|
766 |
} |
|
767 |
||
43364
469da954ee6b
8051768: Inconsistent output for Visible and InvisibleParameterAnnotations
jjg
parents:
42822
diff
changeset
|
768 |
private void visitParameterAnnotations(String message, RuntimeParameterAnnotations_attribute attr) { |
469da954ee6b
8051768: Inconsistent output for Visible and InvisibleParameterAnnotations
jjg
parents:
42822
diff
changeset
|
769 |
println(message); |
3546 | 770 |
indent(+1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
771 |
for (int param = 0; param < attr.parameter_annotations.length; param++) { |
3546 | 772 |
println("parameter " + param + ": "); |
773 |
indent(+1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
774 |
for (int i = 0; i < attr.parameter_annotations[param].length; i++) { |
3546 | 775 |
print(i + ": "); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
776 |
annotationWriter.write(attr.parameter_annotations[param][i]); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
777 |
println(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
778 |
} |
3546 | 779 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
780 |
} |
3546 | 781 |
indent(-1); |
43364
469da954ee6b
8051768: Inconsistent output for Visible and InvisibleParameterAnnotations
jjg
parents:
42822
diff
changeset
|
782 |
} |
469da954ee6b
8051768: Inconsistent output for Visible and InvisibleParameterAnnotations
jjg
parents:
42822
diff
changeset
|
783 |
|
469da954ee6b
8051768: Inconsistent output for Visible and InvisibleParameterAnnotations
jjg
parents:
42822
diff
changeset
|
784 |
@Override |
469da954ee6b
8051768: Inconsistent output for Visible and InvisibleParameterAnnotations
jjg
parents:
42822
diff
changeset
|
785 |
public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, Void ignore) { |
469da954ee6b
8051768: Inconsistent output for Visible and InvisibleParameterAnnotations
jjg
parents:
42822
diff
changeset
|
786 |
visitParameterAnnotations("RuntimeVisibleParameterAnnotations:", (RuntimeParameterAnnotations_attribute) attr); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
787 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
788 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
789 |
|
36526 | 790 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
791 |
public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, Void ignore) { |
43364
469da954ee6b
8051768: Inconsistent output for Visible and InvisibleParameterAnnotations
jjg
parents:
42822
diff
changeset
|
792 |
visitParameterAnnotations("RuntimeInvisibleParameterAnnotations:", (RuntimeParameterAnnotations_attribute) attr); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
793 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
794 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
795 |
|
36526 | 796 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
797 |
public Void visitSignature(Signature_attribute attr, Void ignore) { |
3546 | 798 |
print("Signature: #" + attr.signature_index); |
799 |
tab(); |
|
800 |
println("// " + getSignature(attr)); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
801 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
802 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
803 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
804 |
String getSignature(Signature_attribute info) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
805 |
try { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
806 |
return info.getSignature(constant_pool); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
807 |
} catch (ConstantPoolException e) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
808 |
return report(e); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
809 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
810 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
811 |
|
36526 | 812 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
813 |
public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr, Void ignore) { |
18670
a23df082a854
8019397: javap does not show SourceDebugExtension properly
vromero
parents:
18667
diff
changeset
|
814 |
println("SourceDebugExtension:"); |
a23df082a854
8019397: javap does not show SourceDebugExtension properly
vromero
parents:
18667
diff
changeset
|
815 |
indent(+1); |
a23df082a854
8019397: javap does not show SourceDebugExtension properly
vromero
parents:
18667
diff
changeset
|
816 |
for (String s: attr.getValue().split("[\r\n]+")) { |
a23df082a854
8019397: javap does not show SourceDebugExtension properly
vromero
parents:
18667
diff
changeset
|
817 |
println(s); |
a23df082a854
8019397: javap does not show SourceDebugExtension properly
vromero
parents:
18667
diff
changeset
|
818 |
} |
a23df082a854
8019397: javap does not show SourceDebugExtension properly
vromero
parents:
18667
diff
changeset
|
819 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
820 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
821 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
822 |
|
36526 | 823 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
824 |
public Void visitSourceFile(SourceFile_attribute attr, Void ignore) { |
3546 | 825 |
println("SourceFile: \"" + getSourceFile(attr) + "\""); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
826 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
827 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
828 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
829 |
private String getSourceFile(SourceFile_attribute attr) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
830 |
try { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
831 |
return attr.getSourceFile(constant_pool); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
832 |
} catch (ConstantPoolException e) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
833 |
return report(e); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
834 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
835 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
836 |
|
36526 | 837 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
838 |
public Void visitSourceID(SourceID_attribute attr, Void ignore) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
839 |
constantWriter.write(attr.sourceID_index); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
840 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
841 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
842 |
|
36526 | 843 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
844 |
public Void visitStackMap(StackMap_attribute attr, Void ignore) { |
3546 | 845 |
println("StackMap: number_of_entries = " + attr.number_of_entries); |
846 |
indent(+1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
847 |
StackMapTableWriter w = new StackMapTableWriter(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
848 |
for (StackMapTable_attribute.stack_map_frame entry : attr.entries) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
849 |
w.write(entry); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
850 |
} |
3546 | 851 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
852 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
853 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
854 |
|
36526 | 855 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
856 |
public Void visitStackMapTable(StackMapTable_attribute attr, Void ignore) { |
3546 | 857 |
println("StackMapTable: number_of_entries = " + attr.number_of_entries); |
858 |
indent(+1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
859 |
StackMapTableWriter w = new StackMapTableWriter(); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
860 |
for (StackMapTable_attribute.stack_map_frame entry : attr.entries) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
861 |
w.write(entry); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
862 |
} |
3546 | 863 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
864 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
865 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
866 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
867 |
class StackMapTableWriter // also handles CLDC StackMap attributes |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
868 |
implements StackMapTable_attribute.stack_map_frame.Visitor<Void,Void> { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
869 |
public void write(StackMapTable_attribute.stack_map_frame frame) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
870 |
frame.accept(this, null); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
871 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
872 |
|
36526 | 873 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
874 |
public Void visit_same_frame(StackMapTable_attribute.same_frame frame, Void p) { |
23112
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
875 |
printHeader(frame, "/* same */"); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
876 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
877 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
878 |
|
36526 | 879 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
880 |
public Void visit_same_locals_1_stack_item_frame(StackMapTable_attribute.same_locals_1_stack_item_frame frame, Void p) { |
23112
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
881 |
printHeader(frame, "/* same_locals_1_stack_item */"); |
3546 | 882 |
indent(+1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
883 |
printMap("stack", frame.stack); |
3546 | 884 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
885 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
886 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
887 |
|
36526 | 888 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
889 |
public Void visit_same_locals_1_stack_item_frame_extended(StackMapTable_attribute.same_locals_1_stack_item_frame_extended frame, Void p) { |
23112
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
890 |
printHeader(frame, "/* same_locals_1_stack_item_frame_extended */"); |
3546 | 891 |
indent(+1); |
892 |
println("offset_delta = " + frame.offset_delta); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
893 |
printMap("stack", frame.stack); |
3546 | 894 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
895 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
896 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
897 |
|
36526 | 898 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
899 |
public Void visit_chop_frame(StackMapTable_attribute.chop_frame frame, Void p) { |
23112
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
900 |
printHeader(frame, "/* chop */"); |
3546 | 901 |
indent(+1); |
902 |
println("offset_delta = " + frame.offset_delta); |
|
903 |
indent(-1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
904 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
905 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
906 |
|
36526 | 907 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
908 |
public Void visit_same_frame_extended(StackMapTable_attribute.same_frame_extended frame, Void p) { |
23112
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
909 |
printHeader(frame, "/* same_frame_extended */"); |
3546 | 910 |
indent(+1); |
911 |
println("offset_delta = " + frame.offset_delta); |
|
912 |
indent(-1); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
913 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
914 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
915 |
|
36526 | 916 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
917 |
public Void visit_append_frame(StackMapTable_attribute.append_frame frame, Void p) { |
23112
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
918 |
printHeader(frame, "/* append */"); |
18665
49867b085faf
8005552: c.s.t.javap.AttributeWriter.visitLocalVariableTable() uses incorrect format string
vromero
parents:
15720
diff
changeset
|
919 |
indent(+1); |
49867b085faf
8005552: c.s.t.javap.AttributeWriter.visitLocalVariableTable() uses incorrect format string
vromero
parents:
15720
diff
changeset
|
920 |
println("offset_delta = " + frame.offset_delta); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
921 |
printMap("locals", frame.locals); |
23110 | 922 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
923 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
924 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
925 |
|
36526 | 926 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
927 |
public Void visit_full_frame(StackMapTable_attribute.full_frame frame, Void p) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
928 |
if (frame instanceof StackMap_attribute.stack_map_frame) { |
23112
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
929 |
printHeader(frame, "offset = " + frame.offset_delta); |
3546 | 930 |
indent(+1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
931 |
} else { |
23112
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
932 |
printHeader(frame, "/* full_frame */"); |
3546 | 933 |
indent(+1); |
934 |
println("offset_delta = " + frame.offset_delta); |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
935 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
936 |
printMap("locals", frame.locals); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
937 |
printMap("stack", frame.stack); |
3546 | 938 |
indent(-1); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
939 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
940 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
941 |
|
23112
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
942 |
void printHeader(StackMapTable_attribute.stack_map_frame frame, String extra) { |
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
943 |
print("frame_type = " + frame.frame_type + " "); |
4fa26477332d
8033930: Unnecessary new line after the StackMapTable
jjg
parents:
23110
diff
changeset
|
944 |
println(extra); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
945 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
946 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
947 |
void printMap(String name, StackMapTable_attribute.verification_type_info[] map) { |
3546 | 948 |
print(name + " = ["); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
949 |
for (int i = 0; i < map.length; i++) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
950 |
StackMapTable_attribute.verification_type_info info = map[i]; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
951 |
int tag = info.tag; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
952 |
switch (tag) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
953 |
case StackMapTable_attribute.verification_type_info.ITEM_Object: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
954 |
print(" "); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
955 |
constantWriter.write(((StackMapTable_attribute.Object_variable_info) info).cpool_index); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
956 |
break; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
957 |
case StackMapTable_attribute.verification_type_info.ITEM_Uninitialized: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
958 |
print(" " + mapTypeName(tag)); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
959 |
print(" " + ((StackMapTable_attribute.Uninitialized_variable_info) info).offset); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
960 |
break; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
961 |
default: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
962 |
print(" " + mapTypeName(tag)); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
963 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
964 |
print(i == (map.length - 1) ? " " : ","); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
965 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
966 |
println("]"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
967 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
968 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
969 |
String mapTypeName(int tag) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
970 |
switch (tag) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
971 |
case StackMapTable_attribute.verification_type_info.ITEM_Top: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
972 |
return "top"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
973 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
974 |
case StackMapTable_attribute.verification_type_info.ITEM_Integer: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
975 |
return "int"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
976 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
977 |
case StackMapTable_attribute.verification_type_info.ITEM_Float: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
978 |
return "float"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
979 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
980 |
case StackMapTable_attribute.verification_type_info.ITEM_Long: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
981 |
return "long"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
982 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
983 |
case StackMapTable_attribute.verification_type_info.ITEM_Double: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
984 |
return "double"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
985 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
986 |
case StackMapTable_attribute.verification_type_info.ITEM_Null: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
987 |
return "null"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
988 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
989 |
case StackMapTable_attribute.verification_type_info.ITEM_UninitializedThis: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
990 |
return "this"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
991 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
992 |
case StackMapTable_attribute.verification_type_info.ITEM_Object: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
993 |
return "CP"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
994 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
995 |
case StackMapTable_attribute.verification_type_info.ITEM_Uninitialized: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
996 |
return "uninitialized"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
997 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
998 |
default: |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
999 |
report("unrecognized verification_type_info tag: " + tag); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1000 |
return "[tag:" + tag + "]"; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1001 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1002 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1003 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1004 |
|
36526 | 1005 |
@Override |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1006 |
public Void visitSynthetic(Synthetic_attribute attr, Void ignore) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1007 |
println("Synthetic: true"); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1008 |
return null; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1009 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1010 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1011 |
static String getJavaName(String name) { |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1012 |
return name.replace('/', '.'); |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1013 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1014 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1015 |
String toHex(byte b, int w) { |
22698 | 1016 |
return toHex(b & 0xff, w); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1017 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1018 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1019 |
static String toHex(int i) { |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
18670
diff
changeset
|
1020 |
return StringUtils.toUpperCase(Integer.toString(i, 16)); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1021 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1022 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1023 |
static String toHex(int i, int w) { |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
18670
diff
changeset
|
1024 |
String s = StringUtils.toUpperCase(Integer.toHexString(i)); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1025 |
while (s.length() < w) |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1026 |
s = "0" + s; |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
18670
diff
changeset
|
1027 |
return StringUtils.toUpperCase(s); |
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1028 |
} |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1029 |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
1030 |
static String toHex(byte[] ba) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
1031 |
StringBuilder sb = new StringBuilder(ba.length); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
1032 |
for (byte b: ba) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
1033 |
sb.append(String.format("%02x", b & 0xff)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
1034 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
1035 |
return sb.toString(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
1036 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
1037 |
|
36526 | 1038 |
private final AnnotationWriter annotationWriter; |
1039 |
private final CodeWriter codeWriter; |
|
1040 |
private final ConstantWriter constantWriter; |
|
1041 |
private final Options options; |
|
727
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1042 |
|
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1043 |
private ConstantPool constant_pool; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1044 |
private Object owner; |
cb50c1ae7bab
4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff
changeset
|
1045 |
} |