45N/A/*
814N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
45N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45N/A *
45N/A * This code is free software; you can redistribute it and/or modify it
45N/A * under the terms of the GNU General Public License version 2 only, as
553N/A * published by the Free Software Foundation. Oracle designates this
45N/A * particular file as subject to the "Classpath" exception as provided
553N/A * by Oracle in the LICENSE file that accompanied this code.
45N/A *
45N/A * This code is distributed in the hope that it will be useful, but WITHOUT
45N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
45N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
45N/A * version 2 for more details (a copy is included in the LICENSE file that
45N/A * accompanied this code).
45N/A *
45N/A * You should have received a copy of the GNU General Public License version
45N/A * 2 along with this work; if not, write to the Free Software Foundation,
45N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
45N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
45N/A */
45N/A
45N/Apackage com.sun.tools.javap;
45N/A
45N/Aimport java.util.Formatter;
45N/A
45N/Aimport com.sun.tools.classfile.AccessFlags;
45N/Aimport com.sun.tools.classfile.AnnotationDefault_attribute;
45N/Aimport com.sun.tools.classfile.Attribute;
45N/Aimport com.sun.tools.classfile.Attributes;
825N/Aimport com.sun.tools.classfile.BootstrapMethods_attribute;
45N/Aimport com.sun.tools.classfile.CharacterRangeTable_attribute;
45N/Aimport com.sun.tools.classfile.Code_attribute;
45N/Aimport com.sun.tools.classfile.CompilationID_attribute;
45N/Aimport com.sun.tools.classfile.ConstantPool;
45N/Aimport com.sun.tools.classfile.ConstantPoolException;
45N/Aimport com.sun.tools.classfile.ConstantValue_attribute;
45N/Aimport com.sun.tools.classfile.DefaultAttribute;
45N/Aimport com.sun.tools.classfile.Deprecated_attribute;
45N/Aimport com.sun.tools.classfile.EnclosingMethod_attribute;
45N/Aimport com.sun.tools.classfile.Exceptions_attribute;
45N/Aimport com.sun.tools.classfile.InnerClasses_attribute;
45N/Aimport com.sun.tools.classfile.LineNumberTable_attribute;
45N/Aimport com.sun.tools.classfile.LocalVariableTable_attribute;
45N/Aimport com.sun.tools.classfile.LocalVariableTypeTable_attribute;
45N/Aimport com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
45N/Aimport com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
45N/Aimport com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
45N/Aimport com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
45N/Aimport com.sun.tools.classfile.Signature_attribute;
45N/Aimport com.sun.tools.classfile.SourceDebugExtension_attribute;
45N/Aimport com.sun.tools.classfile.SourceFile_attribute;
45N/Aimport com.sun.tools.classfile.SourceID_attribute;
45N/Aimport com.sun.tools.classfile.StackMapTable_attribute;
45N/Aimport com.sun.tools.classfile.StackMap_attribute;
45N/Aimport com.sun.tools.classfile.Synthetic_attribute;
45N/A
45N/Aimport static com.sun.tools.classfile.AccessFlags.*;
45N/A
45N/A/*
45N/A * A writer for writing Attributes as text.
45N/A *
580N/A * <p><b>This is NOT part of any supported API.
580N/A * If you write code that depends on this, you do so at your own risk.
45N/A * This code and its internal interfaces are subject to change or
45N/A * deletion without notice.</b>
45N/A */
45N/Apublic class AttributeWriter extends BasicWriter
45N/A implements Attribute.Visitor<Void,Void>
45N/A{
299N/A public static AttributeWriter instance(Context context) {
45N/A AttributeWriter instance = context.get(AttributeWriter.class);
45N/A if (instance == null)
45N/A instance = new AttributeWriter(context);
45N/A return instance;
45N/A }
45N/A
45N/A protected AttributeWriter(Context context) {
45N/A super(context);
45N/A context.put(AttributeWriter.class, this);
45N/A annotationWriter = AnnotationWriter.instance(context);
45N/A codeWriter = CodeWriter.instance(context);
45N/A constantWriter = ConstantWriter.instance(context);
45N/A options = Options.instance(context);
45N/A }
45N/A
45N/A public void write(Object owner, Attribute attr, ConstantPool constant_pool) {
45N/A if (attr != null) {
45N/A // null checks
45N/A owner.getClass();
45N/A constant_pool.getClass();
45N/A this.constant_pool = constant_pool;
45N/A this.owner = owner;
45N/A attr.accept(this, null);
45N/A }
45N/A }
45N/A
45N/A public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
45N/A if (attrs != null) {
45N/A // null checks
45N/A owner.getClass();
45N/A constant_pool.getClass();
45N/A this.constant_pool = constant_pool;
45N/A this.owner = owner;
45N/A for (Attribute attr: attrs)
45N/A attr.accept(this, null);
45N/A }
45N/A }
45N/A
45N/A public Void visitDefault(DefaultAttribute attr, Void ignore) {
45N/A byte[] data = attr.info;
45N/A int i = 0;
45N/A int j = 0;
45N/A print(" ");
45N/A try {
45N/A print(attr.getName(constant_pool));
45N/A } catch (ConstantPoolException e) {
45N/A report(e);
45N/A print("attribute name = #" + attr.attribute_name_index);
45N/A }
45N/A print(": ");
45N/A println("length = 0x" + toHex(attr.info.length));
45N/A
45N/A print(" ");
45N/A
45N/A while (i < data.length) {
45N/A print(toHex(data[i], 2));
45N/A
45N/A j++;
45N/A if (j == 16) {
45N/A println();
45N/A print(" ");
45N/A j = 0;
45N/A } else {
45N/A print(" ");
45N/A }
45N/A i++;
45N/A }
45N/A println();
45N/A return null;
45N/A }
45N/A
45N/A public Void visitAnnotationDefault(AnnotationDefault_attribute attr, Void ignore) {
347N/A println("AnnotationDefault:");
347N/A indent(+1);
347N/A print("default_value: ");
45N/A annotationWriter.write(attr.default_value);
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
825N/A public Void visitBootstrapMethods(BootstrapMethods_attribute attr, Void p) {
825N/A println(Attribute.BootstrapMethods + ":");
825N/A for (int i = 0; i < attr.bootstrap_method_specifiers.length ; i++) {
825N/A BootstrapMethods_attribute.BootstrapMethodSpecifier bsm = attr.bootstrap_method_specifiers[i];
825N/A indent(+1);
825N/A print(i + ": #" + bsm.bootstrap_method_ref + " ");
825N/A println(constantWriter.stringValue(bsm.bootstrap_method_ref));
825N/A indent(+1);
825N/A println("Method arguments:");
825N/A indent(+1);
825N/A for (int j = 0; j < bsm.bootstrap_arguments.length; j++) {
825N/A print("#" + bsm.bootstrap_arguments[j] + " ");
825N/A println(constantWriter.stringValue(bsm.bootstrap_arguments[j]));
825N/A }
825N/A indent(-3);
825N/A }
825N/A return null;
825N/A }
825N/A
45N/A public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, Void ignore) {
347N/A println("CharacterRangeTable:");
347N/A indent(+1);
45N/A for (int i = 0; i < attr.character_range_table.length; i++) {
45N/A CharacterRangeTable_attribute.Entry e = attr.character_range_table[i];
776N/A print(String.format(" %2d, %2d, %6x, %6x, %4x",
776N/A e.start_pc, e.end_pc,
776N/A e.character_range_start, e.character_range_end,
776N/A e.flags));
347N/A tab();
776N/A print(String.format("// %2d, %2d, %4d:%02d, %4d:%02d",
776N/A e.start_pc, e.end_pc,
776N/A (e.character_range_start >> 10), (e.character_range_start & 0x3ff),
776N/A (e.character_range_end >> 10), (e.character_range_end & 0x3ff)));
45N/A if ((e.flags & CharacterRangeTable_attribute.CRT_STATEMENT) != 0)
45N/A print(", statement");
45N/A if ((e.flags & CharacterRangeTable_attribute.CRT_BLOCK) != 0)
45N/A print(", block");
45N/A if ((e.flags & CharacterRangeTable_attribute.CRT_ASSIGNMENT) != 0)
45N/A print(", assignment");
45N/A if ((e.flags & CharacterRangeTable_attribute.CRT_FLOW_CONTROLLER) != 0)
45N/A print(", flow-controller");
45N/A if ((e.flags & CharacterRangeTable_attribute.CRT_FLOW_TARGET) != 0)
45N/A print(", flow-target");
45N/A if ((e.flags & CharacterRangeTable_attribute.CRT_INVOKE) != 0)
45N/A print(", invoke");
45N/A if ((e.flags & CharacterRangeTable_attribute.CRT_CREATE) != 0)
45N/A print(", create");
45N/A if ((e.flags & CharacterRangeTable_attribute.CRT_BRANCH_TRUE) != 0)
45N/A print(", branch-true");
45N/A if ((e.flags & CharacterRangeTable_attribute.CRT_BRANCH_FALSE) != 0)
45N/A print(", branch-false");
776N/A println();
45N/A }
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitCode(Code_attribute attr, Void ignore) {
45N/A codeWriter.write(attr, constant_pool);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitCompilationID(CompilationID_attribute attr, Void ignore) {
45N/A constantWriter.write(attr.compilationID_index);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitConstantValue(ConstantValue_attribute attr, Void ignore) {
45N/A if (options.compat) // BUG 6622216 javap names some attributes incorrectly
347N/A print("Constant value: ");
45N/A else
347N/A print("ConstantValue: ");
45N/A constantWriter.write(attr.constantvalue_index);
347N/A println();
45N/A return null;
45N/A }
45N/A
45N/A public Void visitDeprecated(Deprecated_attribute attr, Void ignore) {
45N/A println("Deprecated: true");
45N/A return null;
45N/A }
45N/A
45N/A public Void visitEnclosingMethod(EnclosingMethod_attribute attr, Void ignore) {
347N/A print("EnclosingMethod: #" + attr.class_index + ".#" + attr.method_index);
347N/A tab();
347N/A print("// " + getJavaClassName(attr));
45N/A if (attr.method_index != 0)
45N/A print("." + getMethodName(attr));
45N/A println();
45N/A return null;
45N/A }
45N/A
45N/A private String getJavaClassName(EnclosingMethod_attribute a) {
45N/A try {
45N/A return getJavaName(a.getClassName(constant_pool));
45N/A } catch (ConstantPoolException e) {
45N/A return report(e);
45N/A }
45N/A }
45N/A
45N/A private String getMethodName(EnclosingMethod_attribute a) {
45N/A try {
45N/A return a.getMethodName(constant_pool);
45N/A } catch (ConstantPoolException e) {
45N/A return report(e);
45N/A }
45N/A }
45N/A
45N/A public Void visitExceptions(Exceptions_attribute attr, Void ignore) {
347N/A println("Exceptions:");
347N/A indent(+1);
347N/A print("throws ");
45N/A for (int i = 0; i < attr.number_of_exceptions; i++) {
45N/A if (i > 0)
45N/A print(", ");
45N/A print(getJavaException(attr, i));
45N/A }
347N/A println();
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
51N/A private String getJavaException(Exceptions_attribute attr, int index) {
45N/A try {
45N/A return getJavaName(attr.getException(index, constant_pool));
45N/A } catch (ConstantPoolException e) {
45N/A return report(e);
45N/A }
45N/A }
45N/A
45N/A public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) {
45N/A boolean first = true;
45N/A if (options.compat) {
45N/A writeInnerClassHeader();
45N/A first = false;
45N/A }
45N/A for (int i = 0 ; i < attr.classes.length; i++) {
45N/A InnerClasses_attribute.Info info = attr.classes[i];
45N/A //access
45N/A AccessFlags access_flags = info.inner_class_access_flags;
45N/A if (options.compat) {
45N/A // BUG 6622215: javap ignores certain relevant access flags
45N/A access_flags = access_flags.ignore(ACC_STATIC | ACC_PROTECTED | ACC_PRIVATE | ACC_INTERFACE | ACC_SYNTHETIC | ACC_ENUM);
45N/A // BUG 6622232: javap gets whitespace confused
45N/A print(" ");
45N/A }
45N/A if (options.checkAccess(access_flags)) {
45N/A if (first) {
45N/A writeInnerClassHeader();
45N/A first = false;
45N/A }
347N/A print(" ");
45N/A for (String name: access_flags.getInnerClassModifiers())
45N/A print(name + " ");
45N/A if (info.inner_name_index!=0) {
45N/A print("#" + info.inner_name_index + "= ");
45N/A }
45N/A print("#" + info.inner_class_info_index);
45N/A if (info.outer_class_info_index != 0) {
45N/A print(" of #" + info.outer_class_info_index);
45N/A }
45N/A print("; //");
45N/A if (info.inner_name_index != 0) {
45N/A print(getInnerName(constant_pool, info) + "=");
45N/A }
45N/A constantWriter.write(info.inner_class_info_index);
45N/A if (info.outer_class_info_index != 0) {
45N/A print(" of ");
45N/A constantWriter.write(info.outer_class_info_index);
45N/A }
45N/A println();
45N/A }
45N/A }
347N/A if (!first)
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A String getInnerName(ConstantPool constant_pool, InnerClasses_attribute.Info info) {
45N/A try {
45N/A return info.getInnerName(constant_pool);
45N/A } catch (ConstantPoolException e) {
45N/A return report(e);
45N/A }
45N/A }
45N/A
45N/A private void writeInnerClassHeader() {
45N/A if (options.compat) // BUG 6622216: javap names some attributes incorrectly
45N/A print("InnerClass");
45N/A else
45N/A print("InnerClasses");
348N/A println(":");
347N/A indent(+1);
45N/A }
45N/A
45N/A public Void visitLineNumberTable(LineNumberTable_attribute attr, Void ignore) {
347N/A println("LineNumberTable:");
347N/A indent(+1);
45N/A for (LineNumberTable_attribute.Entry entry: attr.line_number_table) {
347N/A println("line " + entry.line_number + ": " + entry.start_pc);
45N/A }
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitLocalVariableTable(LocalVariableTable_attribute attr, Void ignore) {
347N/A println("LocalVariableTable:");
347N/A indent(+1);
347N/A println("Start Length Slot Name Signature");
45N/A for (LocalVariableTable_attribute.Entry entry : attr.local_variable_table) {
45N/A Formatter formatter = new Formatter();
45N/A println(formatter.format("%8d %7d %5d %5s %s",
45N/A entry.start_pc, entry.length, entry.index,
45N/A constantWriter.stringValue(entry.name_index),
45N/A constantWriter.stringValue(entry.descriptor_index)));
45N/A }
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, Void ignore) {
347N/A println("LocalVariableTypeTable:");
347N/A indent(+1);
347N/A println("Start Length Slot Name Signature");
45N/A for (LocalVariableTypeTable_attribute.Entry entry : attr.local_variable_table) {
347N/A println(String.format("%5d %7d %5d %5s %s",
45N/A entry.start_pc, entry.length, entry.index,
45N/A constantWriter.stringValue(entry.name_index),
45N/A constantWriter.stringValue(entry.signature_index)));
45N/A }
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) {
347N/A println("RuntimeVisibleAnnotations:");
347N/A indent(+1);
45N/A for (int i = 0; i < attr.annotations.length; i++) {
347N/A print(i + ": ");
45N/A annotationWriter.write(attr.annotations[i]);
45N/A println();
45N/A }
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, Void ignore) {
347N/A println("RuntimeInvisibleAnnotations:");
347N/A indent(+1);
45N/A for (int i = 0; i < attr.annotations.length; i++) {
347N/A print(i + ": ");
45N/A annotationWriter.write(attr.annotations[i]);
45N/A println();
45N/A }
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, Void ignore) {
347N/A println("RuntimeVisibleParameterAnnotations:");
347N/A indent(+1);
45N/A for (int param = 0; param < attr.parameter_annotations.length; param++) {
347N/A println("parameter " + param + ": ");
347N/A indent(+1);
45N/A for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
347N/A print(i + ": ");
45N/A annotationWriter.write(attr.parameter_annotations[param][i]);
45N/A println();
45N/A }
347N/A indent(-1);
45N/A }
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, Void ignore) {
347N/A println("RuntimeInvisibleParameterAnnotations:");
347N/A indent(+1);
45N/A for (int param = 0; param < attr.parameter_annotations.length; param++) {
347N/A println(param + ": ");
347N/A indent(+1);
45N/A for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
347N/A print(i + ": ");
45N/A annotationWriter.write(attr.parameter_annotations[param][i]);
45N/A println();
45N/A }
347N/A indent(-1);
45N/A }
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitSignature(Signature_attribute attr, Void ignore) {
347N/A print("Signature: #" + attr.signature_index);
347N/A tab();
347N/A println("// " + getSignature(attr));
45N/A return null;
45N/A }
45N/A
45N/A String getSignature(Signature_attribute info) {
45N/A try {
45N/A return info.getSignature(constant_pool);
45N/A } catch (ConstantPoolException e) {
45N/A return report(e);
45N/A }
45N/A }
45N/A
45N/A public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr, Void ignore) {
347N/A println("SourceDebugExtension: " + attr.getValue());
45N/A return null;
45N/A }
45N/A
45N/A public Void visitSourceFile(SourceFile_attribute attr, Void ignore) {
347N/A println("SourceFile: \"" + getSourceFile(attr) + "\"");
45N/A return null;
45N/A }
45N/A
45N/A private String getSourceFile(SourceFile_attribute attr) {
45N/A try {
45N/A return attr.getSourceFile(constant_pool);
45N/A } catch (ConstantPoolException e) {
45N/A return report(e);
45N/A }
45N/A }
45N/A
45N/A public Void visitSourceID(SourceID_attribute attr, Void ignore) {
45N/A constantWriter.write(attr.sourceID_index);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitStackMap(StackMap_attribute attr, Void ignore) {
347N/A println("StackMap: number_of_entries = " + attr.number_of_entries);
347N/A indent(+1);
45N/A StackMapTableWriter w = new StackMapTableWriter();
45N/A for (StackMapTable_attribute.stack_map_frame entry : attr.entries) {
45N/A w.write(entry);
45N/A }
45N/A println();
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visitStackMapTable(StackMapTable_attribute attr, Void ignore) {
347N/A println("StackMapTable: number_of_entries = " + attr.number_of_entries);
347N/A indent(+1);
45N/A StackMapTableWriter w = new StackMapTableWriter();
45N/A for (StackMapTable_attribute.stack_map_frame entry : attr.entries) {
45N/A w.write(entry);
45N/A }
45N/A println();
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A class StackMapTableWriter // also handles CLDC StackMap attributes
45N/A implements StackMapTable_attribute.stack_map_frame.Visitor<Void,Void> {
45N/A public void write(StackMapTable_attribute.stack_map_frame frame) {
45N/A frame.accept(this, null);
45N/A }
45N/A
45N/A public Void visit_same_frame(StackMapTable_attribute.same_frame frame, Void p) {
45N/A printHeader(frame);
45N/A println(" /* same */");
45N/A return null;
45N/A }
45N/A
45N/A public Void visit_same_locals_1_stack_item_frame(StackMapTable_attribute.same_locals_1_stack_item_frame frame, Void p) {
45N/A printHeader(frame);
45N/A println(" /* same_locals_1_stack_item */");
347N/A indent(+1);
45N/A printMap("stack", frame.stack);
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visit_same_locals_1_stack_item_frame_extended(StackMapTable_attribute.same_locals_1_stack_item_frame_extended frame, Void p) {
45N/A printHeader(frame);
45N/A println(" /* same_locals_1_stack_item_frame_extended */");
347N/A indent(+1);
347N/A println("offset_delta = " + frame.offset_delta);
45N/A printMap("stack", frame.stack);
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visit_chop_frame(StackMapTable_attribute.chop_frame frame, Void p) {
45N/A printHeader(frame);
45N/A println(" /* chop */");
347N/A indent(+1);
347N/A println("offset_delta = " + frame.offset_delta);
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visit_same_frame_extended(StackMapTable_attribute.same_frame_extended frame, Void p) {
45N/A printHeader(frame);
45N/A println(" /* same_frame_extended */");
347N/A indent(+1);
347N/A println("offset_delta = " + frame.offset_delta);
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A public Void visit_append_frame(StackMapTable_attribute.append_frame frame, Void p) {
45N/A printHeader(frame);
45N/A println(" /* append */");
45N/A println(" offset_delta = " + frame.offset_delta);
45N/A printMap("locals", frame.locals);
45N/A return null;
45N/A }
45N/A
45N/A public Void visit_full_frame(StackMapTable_attribute.full_frame frame, Void p) {
45N/A printHeader(frame);
45N/A if (frame instanceof StackMap_attribute.stack_map_frame) {
347N/A indent(+1);
347N/A println(" offset = " + frame.offset_delta);
45N/A } else {
45N/A println(" /* full_frame */");
347N/A indent(+1);
347N/A println("offset_delta = " + frame.offset_delta);
45N/A }
45N/A printMap("locals", frame.locals);
45N/A printMap("stack", frame.stack);
347N/A indent(-1);
45N/A return null;
45N/A }
45N/A
45N/A void printHeader(StackMapTable_attribute.stack_map_frame frame) {
45N/A print(" frame_type = " + frame.frame_type);
45N/A }
45N/A
45N/A void printMap(String name, StackMapTable_attribute.verification_type_info[] map) {
347N/A print(name + " = [");
45N/A for (int i = 0; i < map.length; i++) {
45N/A StackMapTable_attribute.verification_type_info info = map[i];
45N/A int tag = info.tag;
45N/A switch (tag) {
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Object:
45N/A print(" ");
45N/A constantWriter.write(((StackMapTable_attribute.Object_variable_info) info).cpool_index);
45N/A break;
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Uninitialized:
45N/A print(" " + mapTypeName(tag));
45N/A print(" " + ((StackMapTable_attribute.Uninitialized_variable_info) info).offset);
45N/A break;
45N/A default:
45N/A print(" " + mapTypeName(tag));
45N/A }
45N/A print(i == (map.length - 1) ? " " : ",");
45N/A }
45N/A println("]");
45N/A }
45N/A
45N/A String mapTypeName(int tag) {
45N/A switch (tag) {
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Top:
45N/A return "top";
45N/A
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Integer:
45N/A return "int";
45N/A
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Float:
45N/A return "float";
45N/A
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Long:
45N/A return "long";
45N/A
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Double:
45N/A return "double";
45N/A
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Null:
45N/A return "null";
45N/A
45N/A case StackMapTable_attribute.verification_type_info.ITEM_UninitializedThis:
45N/A return "this";
45N/A
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Object:
45N/A return "CP";
45N/A
45N/A case StackMapTable_attribute.verification_type_info.ITEM_Uninitialized:
45N/A return "uninitialized";
45N/A
45N/A default:
45N/A report("unrecognized verification_type_info tag: " + tag);
45N/A return "[tag:" + tag + "]";
45N/A }
45N/A }
45N/A }
45N/A
45N/A public Void visitSynthetic(Synthetic_attribute attr, Void ignore) {
45N/A println("Synthetic: true");
45N/A return null;
45N/A }
45N/A
45N/A static String getJavaName(String name) {
45N/A return name.replace('/', '.');
45N/A }
45N/A
45N/A String toHex(byte b, int w) {
45N/A if (options.compat) // BUG 6622260: javap prints negative bytes incorrectly in hex
45N/A return toHex((int) b, w);
45N/A else
45N/A return toHex(b & 0xff, w);
45N/A }
45N/A
45N/A static String toHex(int i) {
45N/A return Integer.toString(i, 16).toUpperCase();
45N/A }
45N/A
45N/A static String toHex(int i, int w) {
45N/A String s = Integer.toHexString(i).toUpperCase();
45N/A while (s.length() < w)
45N/A s = "0" + s;
45N/A return s.toUpperCase();
45N/A }
45N/A
45N/A private AnnotationWriter annotationWriter;
45N/A private CodeWriter codeWriter;
45N/A private ConstantWriter constantWriter;
45N/A private Options options;
45N/A
45N/A private ConstantPool constant_pool;
45N/A private Object owner;
45N/A}