By default ASM strips optional attributes, in order to keep them in the bytecode that is being readed should pass an array of required attribute instances to {@link org.objectweb.asm.ClassReader#accept(org.objectweb.asm.ClassVisitor, org.objectweb.asm.Attribute[], boolean) ClassReader.accept()} method. In order to add custom attributes to the manually constructed bytecode concrete subclasses of the {@link org.objectweb.asm.Attribute Attribute} can be passed to the correspond visit methods of the {@link org.objectweb.asm.ClassVisitor ClassVisitor} and {@link org.objectweb.asm.CodeVisitor CodeVisitor}. @since ASM 1.4.1