< prev index next >

src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java

Print this page

  31 import com.sun.tools.classfile.AnnotationDefault_attribute;
  32 import com.sun.tools.classfile.Attribute;
  33 import com.sun.tools.classfile.Attributes;
  34 import com.sun.tools.classfile.BootstrapMethods_attribute;
  35 import com.sun.tools.classfile.CharacterRangeTable_attribute;
  36 import com.sun.tools.classfile.CharacterRangeTable_attribute.Entry;
  37 import com.sun.tools.classfile.Code_attribute;
  38 import com.sun.tools.classfile.CompilationID_attribute;
  39 import com.sun.tools.classfile.ConstantPool;
  40 import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
  41 import com.sun.tools.classfile.ConstantPoolException;
  42 import com.sun.tools.classfile.ConstantValue_attribute;
  43 import com.sun.tools.classfile.DefaultAttribute;
  44 import com.sun.tools.classfile.Deprecated_attribute;
  45 import com.sun.tools.classfile.Descriptor;
  46 import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
  47 import com.sun.tools.classfile.EnclosingMethod_attribute;
  48 import com.sun.tools.classfile.Exceptions_attribute;
  49 import com.sun.tools.classfile.InnerClasses_attribute;
  50 import com.sun.tools.classfile.InnerClasses_attribute.Info;

  51 import com.sun.tools.classfile.LineNumberTable_attribute;
  52 import com.sun.tools.classfile.LocalVariableTable_attribute;
  53 import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
  54 import com.sun.tools.classfile.MethodParameters_attribute;
  55 import com.sun.tools.classfile.Module_attribute;
  56 import com.sun.tools.classfile.ModuleHashes_attribute;
  57 import com.sun.tools.classfile.ModuleMainClass_attribute;
  58 import com.sun.tools.classfile.ModulePackages_attribute;
  59 import com.sun.tools.classfile.ModuleResolution_attribute;
  60 import com.sun.tools.classfile.ModuleTarget_attribute;
  61 import com.sun.tools.classfile.NestHost_attribute;
  62 import com.sun.tools.classfile.NestMembers_attribute;
  63 import com.sun.tools.classfile.Record_attribute;
  64 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
  65 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
  66 import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
  67 import com.sun.tools.classfile.RuntimeParameterAnnotations_attribute;
  68 import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
  69 import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
  70 import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;

 337                 }
 338                 print(";");
 339                 tab();
 340                 print("// ");
 341                 if (info.inner_name_index != 0) {
 342                     print(getInnerName(constant_pool, info) + "=");
 343                 }
 344                 constantWriter.write(info.inner_class_info_index);
 345                 if (info.outer_class_info_index != 0) {
 346                     print(" of ");
 347                     constantWriter.write(info.outer_class_info_index);
 348                 }
 349                 println();
 350             }
 351         }
 352         if (!first)
 353             indent(-1);
 354         return null;
 355     }
 356 










 357     String getInnerName(ConstantPool constant_pool, InnerClasses_attribute.Info info) {
 358         try {
 359             return info.getInnerName(constant_pool);
 360         } catch (ConstantPoolException e) {
 361             return report(e);
 362         }
 363     }
 364 
 365     private void writeInnerClassHeader() {
 366         println("InnerClasses:");
 367         indent(+1);
 368     }
 369 
 370     @Override
 371     public Void visitLineNumberTable(LineNumberTable_attribute attr, Void ignore) {
 372         println("LineNumberTable:");
 373         indent(+1);
 374         for (LineNumberTable_attribute.Entry entry: attr.line_number_table) {
 375             println("line " + entry.line_number + ": " + entry.start_pc);
 376         }

  31 import com.sun.tools.classfile.AnnotationDefault_attribute;
  32 import com.sun.tools.classfile.Attribute;
  33 import com.sun.tools.classfile.Attributes;
  34 import com.sun.tools.classfile.BootstrapMethods_attribute;
  35 import com.sun.tools.classfile.CharacterRangeTable_attribute;
  36 import com.sun.tools.classfile.CharacterRangeTable_attribute.Entry;
  37 import com.sun.tools.classfile.Code_attribute;
  38 import com.sun.tools.classfile.CompilationID_attribute;
  39 import com.sun.tools.classfile.ConstantPool;
  40 import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
  41 import com.sun.tools.classfile.ConstantPoolException;
  42 import com.sun.tools.classfile.ConstantValue_attribute;
  43 import com.sun.tools.classfile.DefaultAttribute;
  44 import com.sun.tools.classfile.Deprecated_attribute;
  45 import com.sun.tools.classfile.Descriptor;
  46 import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
  47 import com.sun.tools.classfile.EnclosingMethod_attribute;
  48 import com.sun.tools.classfile.Exceptions_attribute;
  49 import com.sun.tools.classfile.InnerClasses_attribute;
  50 import com.sun.tools.classfile.InnerClasses_attribute.Info;
  51 import com.sun.tools.classfile.JavaFlags_attribute;
  52 import com.sun.tools.classfile.LineNumberTable_attribute;
  53 import com.sun.tools.classfile.LocalVariableTable_attribute;
  54 import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
  55 import com.sun.tools.classfile.MethodParameters_attribute;
  56 import com.sun.tools.classfile.Module_attribute;
  57 import com.sun.tools.classfile.ModuleHashes_attribute;
  58 import com.sun.tools.classfile.ModuleMainClass_attribute;
  59 import com.sun.tools.classfile.ModulePackages_attribute;
  60 import com.sun.tools.classfile.ModuleResolution_attribute;
  61 import com.sun.tools.classfile.ModuleTarget_attribute;
  62 import com.sun.tools.classfile.NestHost_attribute;
  63 import com.sun.tools.classfile.NestMembers_attribute;
  64 import com.sun.tools.classfile.Record_attribute;
  65 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
  66 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
  67 import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
  68 import com.sun.tools.classfile.RuntimeParameterAnnotations_attribute;
  69 import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
  70 import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
  71 import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;

 338                 }
 339                 print(";");
 340                 tab();
 341                 print("// ");
 342                 if (info.inner_name_index != 0) {
 343                     print(getInnerName(constant_pool, info) + "=");
 344                 }
 345                 constantWriter.write(info.inner_class_info_index);
 346                 if (info.outer_class_info_index != 0) {
 347                     print(" of ");
 348                     constantWriter.write(info.outer_class_info_index);
 349                 }
 350                 println();
 351             }
 352         }
 353         if (!first)
 354             indent(-1);
 355         return null;
 356     }
 357 
 358     @Override
 359     public Void visitJavaFlags(JavaFlags_attribute attr, Void unused) {
 360         println("Extended Flags:");
 361         indent(+1);
 362         if ((attr.extendedFlags & ACC_REF_DEFAULT) != 0)
 363             println("ACC_REF_DEFAULT");
 364         indent(-1);
 365         return null;
 366     }
 367 
 368     String getInnerName(ConstantPool constant_pool, InnerClasses_attribute.Info info) {
 369         try {
 370             return info.getInnerName(constant_pool);
 371         } catch (ConstantPoolException e) {
 372             return report(e);
 373         }
 374     }
 375 
 376     private void writeInnerClassHeader() {
 377         println("InnerClasses:");
 378         indent(+1);
 379     }
 380 
 381     @Override
 382     public Void visitLineNumberTable(LineNumberTable_attribute attr, Void ignore) {
 383         println("LineNumberTable:");
 384         indent(+1);
 385         for (LineNumberTable_attribute.Entry entry: attr.line_number_table) {
 386             println("line " + entry.line_number + ": " + entry.start_pc);
 387         }
< prev index next >