< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/Attribute.java

Print this page




 304             off += 2;
 305             for (int i = 0; i < size ; i++) {
 306                 a.classes[i] = cr.readClass(off, buf);
 307                 off += 2;
 308             }
 309             a.bytes = Arrays.copyOfRange(cr.b, offset, offset + len);
 310             return a;
 311         }
 312 
 313         @Override
 314         protected ByteVector write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
 315             ByteVector v = new ByteVector(bytes.length);
 316             v.putShort(classes.length);
 317             for (String s : classes) {
 318                 v.putShort(cw.newClass(s));
 319             }
 320             return v;
 321         }
 322     }
 323 
 324     public static class MemberOfNest extends Attribute {
 325 
 326         byte[] bytes;
 327         String clazz;
 328 
 329         public MemberOfNest() {
 330             super("MemberOfNest");
 331         }
 332 
 333         @Override
 334         protected Attribute read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) {
 335             int offset = off;
 336             MemberOfNest a = new MemberOfNest();
 337             a.clazz = cr.readClass(off, buf);
 338             a.bytes = Arrays.copyOfRange(cr.b, offset, offset + len);
 339             return a;
 340         }
 341 
 342         @Override
 343         protected ByteVector write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
 344             ByteVector v = new ByteVector(bytes.length);
 345             v.putShort(cw.newClass(clazz));
 346             return v;
 347         }
 348     }
 349 
 350     static final Attribute[] DEFAULT_ATTRIBUTE_PROTOS = new Attribute[] {
 351         new NestMembers(),
 352         new MemberOfNest()
 353     };
 354 }


 304             off += 2;
 305             for (int i = 0; i < size ; i++) {
 306                 a.classes[i] = cr.readClass(off, buf);
 307                 off += 2;
 308             }
 309             a.bytes = Arrays.copyOfRange(cr.b, offset, offset + len);
 310             return a;
 311         }
 312 
 313         @Override
 314         protected ByteVector write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
 315             ByteVector v = new ByteVector(bytes.length);
 316             v.putShort(classes.length);
 317             for (String s : classes) {
 318                 v.putShort(cw.newClass(s));
 319             }
 320             return v;
 321         }
 322     }
 323 
 324     public static class NestHost extends Attribute {
 325 
 326         byte[] bytes;
 327         String clazz;
 328 
 329         public NestHost() {
 330             super("NestHost");
 331         }
 332 
 333         @Override
 334         protected Attribute read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) {
 335             int offset = off;
 336             NestHost a = new NestHost();
 337             a.clazz = cr.readClass(off, buf);
 338             a.bytes = Arrays.copyOfRange(cr.b, offset, offset + len);
 339             return a;
 340         }
 341 
 342         @Override
 343         protected ByteVector write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
 344             ByteVector v = new ByteVector(bytes.length);
 345             v.putShort(cw.newClass(clazz));
 346             return v;
 347         }
 348     }
 349 
 350     static final Attribute[] DEFAULT_ATTRIBUTE_PROTOS = new Attribute[] {
 351         new NestMembers(),
 352         new NestHost()
 353     };
 354 }
< prev index next >