public byte [ ] toBytes ( JDKVersion version ) { ClassNode node = new ClassNode ( ) ; node . version = version . getVer ( ) ; node . access = this . access | ACC_SUPER ; node . name = this . className ; node . superName = this . superClassName ; node . sourceFile = this . sourceFile ; node . sourceDebug = this . sourceDebug ; if ( parentClassName != null ) { node . visitOuterClass ( parentClassName , null , null ) ; } for ( ChildEntry child : childClasses ) { node . visitInnerClass ( child . getClassName ( ) , className , child . getInnerName ( ) , child . getAccess ( ) ) ; } if ( ! this . interfaces . isEmpty ( ) ) { node . interfaces . addAll ( this . interfaces ) ; } for ( MethodDefinition def : methods ) { node . methods . add ( def . getMethodNode ( ) ) ; } for ( FieldDefinition def : fields ) { node . fields . add ( def . getFieldNode ( ) ) ; } if ( node . visibleAnnotations == null ) { node . visibleAnnotations = new ArrayList < AnnotationNode > ( ) ; } for ( VisibleAnnotation a : annotations ) { node . visibleAnnotations . add ( a . getNode ( ) ) ; } ClassWriter cw = new ClassWriter ( ClassWriter . COMPUTE_FRAMES ) ; node . accept ( cw ) ; return cw . toByteArray ( ) ; }
Convert this class representation to JDK bytecode