langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java
changeset 8031 d5fe2c1cecfc
parent 7681 1f0819a3341f
child 14056 0ea78d6e0b7b
equal deleted inserted replaced
7848:884a6d60b235 8031:d5fe2c1cecfc
     1 /*
     1 /*
     2  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    62         sourceWriter = SourceWriter.instance(context);
    62         sourceWriter = SourceWriter.instance(context);
    63         tryBlockWriter = TryBlockWriter.instance(context);
    63         tryBlockWriter = TryBlockWriter.instance(context);
    64         stackMapWriter = StackMapWriter.instance(context);
    64         stackMapWriter = StackMapWriter.instance(context);
    65         localVariableTableWriter = LocalVariableTableWriter.instance(context);
    65         localVariableTableWriter = LocalVariableTableWriter.instance(context);
    66         localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
    66         localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
    67         typeAnnotationWriter = TypeAnnotationWriter.instance(context);
       
    68         options = Options.instance(context);
    67         options = Options.instance(context);
    69     }
    68     }
    70 
    69 
    71     void write(Code_attribute attr, ConstantPool constant_pool) {
    70     void write(Code_attribute attr, ConstantPool constant_pool) {
    72         println("Code:");
    71         println("Code:");
   264         if (options.details.contains(InstructionDetailWriter.Kind.TRY_BLOCKS)) {
   263         if (options.details.contains(InstructionDetailWriter.Kind.TRY_BLOCKS)) {
   265             tryBlockWriter.reset(attr);
   264             tryBlockWriter.reset(attr);
   266             detailWriters.add(tryBlockWriter);
   265             detailWriters.add(tryBlockWriter);
   267         }
   266         }
   268 
   267 
   269         if (options.details.contains(InstructionDetailWriter.Kind.TYPE_ANNOS)) {
       
   270             typeAnnotationWriter.reset(attr);
       
   271             detailWriters.add(typeAnnotationWriter);
       
   272         }
       
   273 
       
   274         return detailWriters;
   268         return detailWriters;
   275     }
   269     }
   276 
   270 
   277     private AttributeWriter attrWriter;
   271     private AttributeWriter attrWriter;
   278     private ClassWriter classWriter;
   272     private ClassWriter classWriter;
   279     private ConstantWriter constantWriter;
   273     private ConstantWriter constantWriter;
   280     private LocalVariableTableWriter localVariableTableWriter;
   274     private LocalVariableTableWriter localVariableTableWriter;
   281     private LocalVariableTypeTableWriter localVariableTypeTableWriter;
   275     private LocalVariableTypeTableWriter localVariableTypeTableWriter;
   282     private TypeAnnotationWriter typeAnnotationWriter;
       
   283     private SourceWriter sourceWriter;
   276     private SourceWriter sourceWriter;
   284     private StackMapWriter stackMapWriter;
   277     private StackMapWriter stackMapWriter;
   285     private TryBlockWriter tryBlockWriter;
   278     private TryBlockWriter tryBlockWriter;
   286     private Options options;
   279     private Options options;
   287 }
   280 }