src/share/classes/jdk/internal/org/objectweb/asm/ClassWriter.java

Print this page




 768             tanns = aw;
 769         } else {
 770             aw.next = itanns;
 771             itanns = aw;
 772         }
 773         return aw;
 774     }
 775 
 776     @Override
 777     public final void visitAttribute(final Attribute attr) {
 778         attr.next = attrs;
 779         attrs = attr;
 780     }
 781 
 782     @Override
 783     public final void visitInnerClass(final String name,
 784             final String outerName, final String innerName, final int access) {
 785         if (innerClasses == null) {
 786             innerClasses = new ByteVector();
 787         }












 788         ++innerClassesCount;
 789         innerClasses.putShort(name == null ? 0 : newClass(name));
 790         innerClasses.putShort(outerName == null ? 0 : newClass(outerName));
 791         innerClasses.putShort(innerName == null ? 0 : newUTF8(innerName));
 792         innerClasses.putShort(access);





 793     }

 794 
 795     @Override
 796     public final FieldVisitor visitField(final int access, final String name,
 797             final String desc, final String signature, final Object value) {
 798         return new FieldWriter(this, access, name, desc, signature, value);
 799     }
 800 
 801     @Override
 802     public final MethodVisitor visitMethod(final int access, final String name,
 803             final String desc, final String signature, final String[] exceptions) {
 804         return new MethodWriter(this, access, name, desc, signature,
 805                 exceptions, computeMaxs, computeFrames);
 806     }
 807 
 808     @Override
 809     public final void visitEnd() {
 810     }
 811 
 812     // ------------------------------------------------------------------------
 813     // Other public methods




 768             tanns = aw;
 769         } else {
 770             aw.next = itanns;
 771             itanns = aw;
 772         }
 773         return aw;
 774     }
 775 
 776     @Override
 777     public final void visitAttribute(final Attribute attr) {
 778         attr.next = attrs;
 779         attrs = attr;
 780     }
 781 
 782     @Override
 783     public final void visitInnerClass(final String name,
 784             final String outerName, final String innerName, final int access) {
 785         if (innerClasses == null) {
 786             innerClasses = new ByteVector();
 787         }
 788         // Sec. 4.7.6 of the JVMS states "Every CONSTANT_Class_info entry in the
 789         // constant_pool table which represents a class or interface C that is
 790         // not a package member must have exactly one corresponding entry in the
 791         // classes array". To avoid duplicates we keep track in the intVal field
 792         // of the Item of each CONSTANT_Class_info entry C whether an inner
 793         // class entry has already been added for C (this field is unused for
 794         // class entries, and changing its value does not change the hashcode
 795         // and equality tests). If so we store the index of this inner class
 796         // entry (plus one) in intVal. This hack allows duplicate detection in
 797         // O(1) time.
 798         Item nameItem = newClassItem(name);
 799         if (nameItem.intVal == 0) {
 800             ++innerClassesCount;
 801             innerClasses.putShort(nameItem.index);
 802             innerClasses.putShort(outerName == null ? 0 : newClass(outerName));
 803             innerClasses.putShort(innerName == null ? 0 : newUTF8(innerName));
 804             innerClasses.putShort(access);
 805             nameItem.intVal = innerClassesCount;
 806         } else {
 807             // Compare the inner classes entry nameItem.intVal - 1 with the
 808             // arguments of this method and throw an exception if there is a
 809             // difference?
 810         }
 811     }
 812 
 813     @Override
 814     public final FieldVisitor visitField(final int access, final String name,
 815             final String desc, final String signature, final Object value) {
 816         return new FieldWriter(this, access, name, desc, signature, value);
 817     }
 818 
 819     @Override
 820     public final MethodVisitor visitMethod(final int access, final String name,
 821             final String desc, final String signature, final String[] exceptions) {
 822         return new MethodWriter(this, access, name, desc, signature,
 823                 exceptions, computeMaxs, computeFrames);
 824     }
 825 
 826     @Override
 827     public final void visitEnd() {
 828     }
 829 
 830     // ------------------------------------------------------------------------
 831     // Other public methods