< prev index next >

src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java

Print this page
rev 50604 : imported patch jep181-rev1
   1 /*
   2  * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  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


 512             out.writeShort(entry.index);
 513         }
 514 
 515         @Override
 516         public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, ClassOutputStream out) {
 517             out.writeShort(attr.local_variable_table.length);
 518             for (LocalVariableTypeTable_attribute.Entry e: attr.local_variable_table)
 519                 writeLocalVariableTypeTableEntry(e, out);
 520             return null;
 521         }
 522 
 523         protected void writeLocalVariableTypeTableEntry(LocalVariableTypeTable_attribute.Entry entry, ClassOutputStream out) {
 524             out.writeShort(entry.start_pc);
 525             out.writeShort(entry.length);
 526             out.writeShort(entry.name_index);
 527             out.writeShort(entry.signature_index);
 528             out.writeShort(entry.index);
 529         }
 530 
 531         @Override






 532         public Void visitMethodParameters(MethodParameters_attribute attr, ClassOutputStream out) {
 533             out.writeByte(attr.method_parameter_table.length);
 534             for (MethodParameters_attribute.Entry e : attr.method_parameter_table) {
 535                 out.writeShort(e.name_index);
 536                 out.writeShort(e.flags);
 537             }
 538             return null;
 539         }
 540 
 541         @Override
 542         public Void visitModule(Module_attribute attr, ClassOutputStream out) {
 543             out.writeShort(attr.module_name);
 544             out.writeShort(attr.module_flags);
 545             out.writeShort(attr.module_version_index);
 546 
 547             out.writeShort(attr.requires.length);
 548             for (Module_attribute.RequiresEntry e: attr.requires) {
 549                 out.writeShort(e.requires_index);
 550                 out.writeShort(e.requires_flags);
 551                 out.writeShort(e.requires_version_index);


 606             return null;
 607         }
 608 
 609         @Override
 610         public Void visitModulePackages(ModulePackages_attribute attr, ClassOutputStream out) {
 611             out.writeShort(attr.packages_count);
 612             for (int i: attr.packages_index)
 613                 out.writeShort(i);
 614             return null;
 615         }
 616 
 617         @Override
 618         public Void visitModuleResolution(ModuleResolution_attribute attr, ClassOutputStream out) {
 619             out.writeShort(attr.resolution_flags);
 620             return null;
 621         }
 622 
 623         @Override
 624         public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) {
 625             out.writeShort(attr.target_platform_index);









 626             return null;
 627         }
 628 
 629         @Override
 630         public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, ClassOutputStream out) {
 631             annotationWriter.write(attr.annotations, out);
 632             return null;
 633         }
 634 
 635         @Override
 636         public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
 637             out.writeByte(attr.parameter_annotations.length);
 638             for (Annotation[] annos: attr.parameter_annotations)
 639                 annotationWriter.write(annos, out);
 640             return null;
 641         }
 642 
 643         @Override
 644         public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
 645             annotationWriter.write(attr.annotations, out);


   1 /*
   2  * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  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


 512             out.writeShort(entry.index);
 513         }
 514 
 515         @Override
 516         public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, ClassOutputStream out) {
 517             out.writeShort(attr.local_variable_table.length);
 518             for (LocalVariableTypeTable_attribute.Entry e: attr.local_variable_table)
 519                 writeLocalVariableTypeTableEntry(e, out);
 520             return null;
 521         }
 522 
 523         protected void writeLocalVariableTypeTableEntry(LocalVariableTypeTable_attribute.Entry entry, ClassOutputStream out) {
 524             out.writeShort(entry.start_pc);
 525             out.writeShort(entry.length);
 526             out.writeShort(entry.name_index);
 527             out.writeShort(entry.signature_index);
 528             out.writeShort(entry.index);
 529         }
 530 
 531         @Override
 532         public Void visitNestHost(NestHost_attribute attr, ClassOutputStream out) {
 533             out.writeShort(attr.top_index);
 534             return null;
 535         }
 536 
 537         @Override
 538         public Void visitMethodParameters(MethodParameters_attribute attr, ClassOutputStream out) {
 539             out.writeByte(attr.method_parameter_table.length);
 540             for (MethodParameters_attribute.Entry e : attr.method_parameter_table) {
 541                 out.writeShort(e.name_index);
 542                 out.writeShort(e.flags);
 543             }
 544             return null;
 545         }
 546 
 547         @Override
 548         public Void visitModule(Module_attribute attr, ClassOutputStream out) {
 549             out.writeShort(attr.module_name);
 550             out.writeShort(attr.module_flags);
 551             out.writeShort(attr.module_version_index);
 552 
 553             out.writeShort(attr.requires.length);
 554             for (Module_attribute.RequiresEntry e: attr.requires) {
 555                 out.writeShort(e.requires_index);
 556                 out.writeShort(e.requires_flags);
 557                 out.writeShort(e.requires_version_index);


 612             return null;
 613         }
 614 
 615         @Override
 616         public Void visitModulePackages(ModulePackages_attribute attr, ClassOutputStream out) {
 617             out.writeShort(attr.packages_count);
 618             for (int i: attr.packages_index)
 619                 out.writeShort(i);
 620             return null;
 621         }
 622 
 623         @Override
 624         public Void visitModuleResolution(ModuleResolution_attribute attr, ClassOutputStream out) {
 625             out.writeShort(attr.resolution_flags);
 626             return null;
 627         }
 628 
 629         @Override
 630         public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) {
 631             out.writeShort(attr.target_platform_index);
 632             return null;
 633         }
 634 
 635         @Override
 636         public Void visitNestMembers(NestMembers_attribute attr, ClassOutputStream out) {
 637             out.writeShort(attr.members_indexes.length);
 638             for (int i : attr.members_indexes) {
 639                 out.writeShort(i);
 640             }
 641             return null;
 642         }
 643 
 644         @Override
 645         public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, ClassOutputStream out) {
 646             annotationWriter.write(attr.annotations, out);
 647             return null;
 648         }
 649 
 650         @Override
 651         public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
 652             out.writeByte(attr.parameter_annotations.length);
 653             for (Annotation[] annos: attr.parameter_annotations)
 654                 annotationWriter.write(annos, out);
 655             return null;
 656         }
 657 
 658         @Override
 659         public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
 660             annotationWriter.write(attr.annotations, out);


< prev index next >