protected void initializeDynamicTypeStructures ( MethodVisitor mv , ClassDefinition classDef ) { if ( classDef . isFullTraiting ( ) ) { mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitTypeInsn ( NEW , Type . getInternalName ( TraitFieldTMSImpl . class ) ) ; mv . visitInsn ( DUP ) ; mv . visitMethodInsn ( INVOKESPECIAL , Type . getInternalName ( TraitFieldTMSImpl . class ) , "<init>" , "()V" ) ; mv . visitFieldInsn ( PUTFIELD , BuildUtils . getInternalType ( classDef . getClassName ( ) ) , TraitableBean . FIELDTMS_FIELD_NAME , Type . getDescriptor ( TraitFieldTMS . class ) ) ; for ( FactField hardField : classDef . getFields ( ) ) { FieldDefinition fld = ( FieldDefinition ) hardField ; mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitFieldInsn ( GETFIELD , BuildUtils . getInternalType ( classDef . getClassName ( ) ) , TraitableBean . FIELDTMS_FIELD_NAME , Type . getDescriptor ( TraitFieldTMS . class ) ) ; mv . visitLdcInsn ( Type . getType ( BuildUtils . getTypeDescriptor ( classDef . getClassName ( ) ) ) ) ; mv . visitLdcInsn ( fld . resolveAlias ( ) ) ; if ( BuildUtils . isPrimitive ( fld . getTypeName ( ) ) ) { // mv.visitFieldInsn( GETSTATIC, BuildUtils.getInternalType( BuildUtils.box( fld.getTypeName() ) ), "TYPE", Type.getDescriptor( Class.class ) ); mv . visitLdcInsn ( Type . getType ( BuildUtils . getTypeDescriptor ( BuildUtils . box ( fld . getTypeName ( ) ) ) ) ) ; } else { mv . visitLdcInsn ( Type . getType ( BuildUtils . getTypeDescriptor ( fld . getTypeName ( ) ) ) ) ; } mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , BuildUtils . getInternalType ( classDef . getClassName ( ) ) , BuildUtils . getterName ( fld . getName ( ) , fld . getTypeName ( ) ) , "()" + BuildUtils . getTypeDescriptor ( fld . getTypeName ( ) ) ) ; if ( BuildUtils . isPrimitive ( fld . getTypeName ( ) ) ) { mv . visitMethodInsn ( INVOKESTATIC , BuildUtils . getInternalType ( BuildUtils . box ( fld . getTypeName ( ) ) ) , "valueOf" , "(" + BuildUtils . getTypeDescriptor ( fld . getTypeName ( ) ) + ")" + BuildUtils . getTypeDescriptor ( BuildUtils . box ( fld . getTypeName ( ) ) ) ) ; } if ( fld . getInitExpr ( ) != null ) { mv . visitLdcInsn ( fld . getInitExpr ( ) ) ; } else { mv . visitInsn ( ACONST_NULL ) ; } mv . visitMethodInsn ( INVOKEINTERFACE , Type . getInternalName ( TraitFieldTMS . class ) , "registerField" , Type . getMethodDescriptor ( Type . VOID_TYPE , new Type [ ] { Type . getType ( Class . class ) , Type . getType ( String . class ) , Type . getType ( Class . class ) , Type . getType ( Object . class ) , Type . getType ( String . class ) } ) ) ; } } }
Initializes the trait map and dynamic property map to empty values