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

Print this page




 713             (flags & (SYNTHETIC|BRIDGE)) != SYNTHETIC &&
 714             (flags & ANONCONSTR) == 0 &&
 715             (!types.isSameType(sym.type, sym.erasure(types)) ||
 716              hasTypeVar(sym.type.getThrownTypes()))) {
 717             // note that a local class with captured variables
 718             // will get a signature attribute
 719             int alenIdx = writeAttr(names.Signature);
 720             databuf.appendChar(pool.put(typeSig(sym.type)));
 721             endAttr(alenIdx);
 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;




 713             (flags & (SYNTHETIC|BRIDGE)) != SYNTHETIC &&
 714             (flags & ANONCONSTR) == 0 &&
 715             (!types.isSameType(sym.type, sym.erasure(types)) ||
 716              hasTypeVar(sym.type.getThrownTypes()))) {
 717             // note that a local class with captured variables
 718             // will get a signature attribute
 719             int alenIdx = writeAttr(names.Signature);
 720             databuf.appendChar(pool.put(typeSig(sym.type)));
 721             endAttr(alenIdx);
 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         MethodType ty = m.externalType(types).asMethodType();
 734         final int allparams = ty.argtypes.size();
 735         if (m.params != null && allparams != 0) {
 736             final int attrIndex = writeAttr(names.MethodParameters);
 737             databuf.appendByte(allparams);
 738             // Write extra parameters first
 739             for (VarSymbol s : m.extraParams) {
 740                 final int flags =
 741                     ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
 742                     ((int) m.flags() & SYNTHETIC);
 743                 databuf.appendChar(pool.put(s.name));
 744                 databuf.appendInt(flags);
 745             }
 746             // Now write the real parameters
 747             for (VarSymbol s : m.params) {
 748                 final int flags =
 749                     ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
 750                     ((int) m.flags() & SYNTHETIC);

 751                 databuf.appendChar(pool.put(s.name));
 752                 databuf.appendInt(flags);
 753             }
 754             endAttr(attrIndex);
 755             return 1;
 756         } else
 757             return 0;
 758     }
 759 
 760 
 761     /** Write method parameter annotations;
 762      *  return number of attributes written.
 763      */
 764     int writeParameterAttrs(MethodSymbol m) {
 765         boolean hasVisible = false;
 766         boolean hasInvisible = false;
 767         if (m.params != null) for (VarSymbol s : m.params) {
 768             for (Attribute.Compound a : s.getRawAttributes()) {
 769                 switch (types.getRetention(a)) {
 770                 case SOURCE: break;