src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java

Print this page




 722             acount++;
 723         }
 724         acount += writeJavaAnnotations(sym.getRawAttributes());
 725         acount += writeTypeAnnotations(sym.getRawTypeAttributes());
 726         return acount;
 727     }
 728 
 729     /**
 730      * Write method parameter names attribute.
 731      */
 732     int writeMethodParametersAttr(MethodSymbol m) {
 733         if (m.params != null && 0 != m.params.length()) {
 734             int attrIndex = writeAttr(names.MethodParameters);
 735             databuf.appendByte(m.params.length());
 736             for (VarSymbol s : m.params) {
 737                 // TODO: expand to cover synthesized, once we figure out
 738                 // how to represent that.
 739                 final int flags = (int) s.flags() & (FINAL | SYNTHETIC);
 740                 // output parameter info
 741                 databuf.appendChar(pool.put(s.name));
 742                 databuf.appendInt(flags);
 743             }
 744             endAttr(attrIndex);
 745             return 1;
 746         } else
 747             return 0;
 748     }
 749 
 750 
 751     /** Write method parameter annotations;
 752      *  return number of attributes written.
 753      */
 754     int writeParameterAttrs(MethodSymbol m) {
 755         boolean hasVisible = false;
 756         boolean hasInvisible = false;
 757         if (m.params != null) for (VarSymbol s : m.params) {
 758             for (Attribute.Compound a : s.getRawAttributes()) {
 759                 switch (types.getRetention(a)) {
 760                 case SOURCE: break;
 761                 case CLASS: hasInvisible = true; break;
 762                 case RUNTIME: hasVisible = true; break;




 722             acount++;
 723         }
 724         acount += writeJavaAnnotations(sym.getRawAttributes());
 725         acount += writeTypeAnnotations(sym.getRawTypeAttributes());
 726         return acount;
 727     }
 728 
 729     /**
 730      * Write method parameter names attribute.
 731      */
 732     int writeMethodParametersAttr(MethodSymbol m) {
 733         if (m.params != null && 0 != m.params.length()) {
 734             int attrIndex = writeAttr(names.MethodParameters);
 735             databuf.appendByte(m.params.length());
 736             for (VarSymbol s : m.params) {
 737                 // TODO: expand to cover synthesized, once we figure out
 738                 // how to represent that.
 739                 final int flags = (int) s.flags() & (FINAL | SYNTHETIC);
 740                 // output parameter info
 741                 databuf.appendChar(pool.put(s.name));
 742                 databuf.appendChar(flags);
 743             }
 744             endAttr(attrIndex);
 745             return 1;
 746         } else
 747             return 0;
 748     }
 749 
 750 
 751     /** Write method parameter annotations;
 752      *  return number of attributes written.
 753      */
 754     int writeParameterAttrs(MethodSymbol m) {
 755         boolean hasVisible = false;
 756         boolean hasInvisible = false;
 757         if (m.params != null) for (VarSymbol s : m.params) {
 758             for (Attribute.Compound a : s.getRawAttributes()) {
 759                 switch (types.getRetention(a)) {
 760                 case SOURCE: break;
 761                 case CLASS: hasInvisible = true; break;
 762                 case RUNTIME: hasVisible = true; break;