docs: protected void buildTraitMap(ClassWriter cw, ClassDefinition classDef) {
  
          FieldVisitor fv = cw.visitField( ACC_PRIVATE,
                  TraitableBean.TRAITSET_FIELD_NAME,
                  Type.getDescriptor( Map.class ),
                  "Ljava/util/Map<Ljava/lang/String;Lorg/drools/core/factmodel/traits/Thing;>;",
                  null );
          fv.visitEnd();
  
          MethodVisitor mv;
  
          mv = cw.visitMethod( ACC_PUBLIC,
                               "_getTraitMap",
                               Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ),
                               "()Ljava/util/Map<Ljava/lang/String;Lorg/drools/factmodel/traits/Thing;>;",
                               null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitFieldInsn( GETFIELD,
                             BuildUtils.getInternalType( classDef.getName() ),
                             TraitableBean.TRAITSET_FIELD_NAME,
                             Type.getDescriptor( Map.class ) );
          mv.visitInsn(ARETURN);
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
          mv = cw.visitMethod( ACC_PUBLIC, "_setTraitMap", Type.getMethodDescriptor( Type.getType( void.class ), new Type[] { Type.getType( Map.class ) } ), null, null);
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitVarInsn( ALOAD, 1 );
          mv.visitFieldInsn( PUTFIELD, BuildUtils.getInternalType( classDef.getName() ), TraitableBean.TRAITSET_FIELD_NAME, Type.getDescriptor( Map.class ));
          mv.visitInsn( RETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
  
          mv = cw.visitMethod( ACC_PUBLIC, "addTrait",
                  Type.getMethodDescriptor( Type.getType( void.class ), new Type[] { Type.getType( String.class ), Type.getType( Thing.class ) } ),
                  "(Ljava/lang/String;Lorg/drools/core/factmodel/traits/Thing;)V", null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitMethodInsn( INVOKEVIRTUAL,
                  BuildUtils.getInternalType( classDef.getName() ),
                  "_getTraitMap",
                  Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ) );
          mv.visitVarInsn( ALOAD, 1 );
          mv.visitVarInsn( ALOAD, 2 );
          mv.visitMethodInsn( INVOKEINTERFACE,
                  Type.getInternalName( Map.class ),
                  "put",
                  Type.getMethodDescriptor( Type.getType( Object.class ), new Type[] { Type.getType( Object.class ), Type.getType( Object.class ) } ) );
          mv.visitInsn( POP );
          mv.visitInsn( RETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
  
          mv = cw.visitMethod( ACC_PUBLIC,
                  "getTrait",
                  Type.getMethodDescriptor( Type.getType( Thing.class ), new Type[] { Type.getType( String.class ) } ),
                  Type.getMethodDescriptor( Type.getType( Thing.class ), new Type[] { Type.getType( String.class ) } ),
                  null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitMethodInsn( INVOKEVIRTUAL,
                  BuildUtils.getInternalType( classDef.getName() ),
                  "_getTraitMap",
                  Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ) );
          mv.visitVarInsn( ALOAD, 1 );
          mv.visitMethodInsn( INVOKEINTERFACE,
                  Type.getInternalName( Map.class ),
                  "get",
                  Type.getMethodDescriptor( Type.getType( Object.class ), new Type[] { Type.getType( Object.class ) } ) );
          mv.visitTypeInsn( CHECKCAST, Type.getInternalName( Thing.class ) );
          mv.visitInsn( ARETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
  
          mv = cw.visitMethod( ACC_PUBLIC,
                  "hasTrait",
                  Type.getMethodDescriptor( Type.getType( boolean.class ), new Type[] { Type.getType( String.class ) } ),
                  null,
                  null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitMethodInsn( INVOKEVIRTUAL,
                  BuildUtils.getInternalType( classDef.getName() ),
                  "_getTraitMap",
                  Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ) );
          Label l0 = new Label();
          mv.visitJumpInsn( IFNONNULL, l0 );
          mv.visitInsn( ICONST_0 );
          mv.visitInsn( IRETURN );
          mv.visitLabel( l0 );
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitMethodInsn( INVOKEVIRTUAL,
                  BuildUtils.getInternalType( classDef.getName() ),
                  "_getTraitMap",
                  Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ) );
          mv.visitVarInsn( ALOAD, 1 );
          mv.visitMethodInsn( INVOKEINTERFACE,
                  Type.getInternalName( Map.class ),
                  "containsKey",
                  Type.getMethodDescriptor( Type.getType( boolean.class ), new Type[] { Type.getType( Object.class ) } ) );
          mv.visitInsn( IRETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
  
          mv = cw.visitMethod( ACC_PUBLIC,
                  "hasTraits",
                  Type.getMethodDescriptor( Type.getType( boolean.class ), new Type[] {} ),
                  null,
                  null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType( classDef.getName() ),TraitableBean.TRAITSET_FIELD_NAME, Type.getDescriptor( Map.class ) );
          Label l5 = new Label();
          mv.visitJumpInsn( IFNULL, l5 );
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType( classDef.getName() ), TraitableBean.TRAITSET_FIELD_NAME, Type.getDescriptor( Map.class ) );
          mv.visitMethodInsn( INVOKEINTERFACE, Type.getInternalName( Map.class ), "isEmpty", Type.getMethodDescriptor( Type.BOOLEAN_TYPE, new Type[] {} ) );
          mv.visitJumpInsn( IFNE, l5 );
          mv.visitInsn( ICONST_1 );
          Label l4 = new Label();
          mv.visitJumpInsn( GOTO, l4 );
          mv.visitLabel( l5 );
          mv.visitInsn( ICONST_0 );
          mv.visitLabel( l4 );
          mv.visitInsn( IRETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
  
          mv = cw.visitMethod( ACC_PUBLIC, "removeTrait",
                  Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { Type.getType( String.class ) } ),
                  Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { Type.getType( String.class ) } ),
                  null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitMethodInsn( INVOKEVIRTUAL, BuildUtils.getInternalType( classDef.getName() ), "_getTraitMap", Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ) );
          mv.visitTypeInsn( CHECKCAST, Type.getInternalName( TraitTypeMap.class ) );
          mv.visitVarInsn(ALOAD, 1);
          mv.visitMethodInsn( INVOKEVIRTUAL, Type.getInternalName( TraitTypeMap.class ), "removeCascade",
                  Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { Type.getType( String.class )} ) );
          mv.visitInsn( ARETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
          mv = cw.visitMethod( ACC_PUBLIC, "removeTrait",
                  Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { Type.getType( BitSet.class ) } ),
                  Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { Type.getType( BitSet.class ) } ),
                  null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitMethodInsn( INVOKEVIRTUAL, BuildUtils.getInternalType( classDef.getName() ), "_getTraitMap", Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ) );
          mv.visitTypeInsn( CHECKCAST, Type.getInternalName( TraitTypeMap.class ) );
          mv.visitVarInsn( ALOAD, 1 );
          mv.visitMethodInsn( INVOKEVIRTUAL, Type.getInternalName( TraitTypeMap.class ), "removeCascade",
                  Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { Type.getType( BitSet.class )} ) );
          mv.visitInsn( ARETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
  
          mv = cw.visitMethod( ACC_PUBLIC,
                  "getTraits",
                  Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { } ),
                  "()Ljava/util/Collection<Ljava/lang/String;>;",
                  null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitMethodInsn( INVOKEVIRTUAL,
                  BuildUtils.getInternalType( classDef.getName() ),
                  "_getTraitMap",
                  Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ) );
          mv.visitMethodInsn( INVOKEINTERFACE,
                  Type.getInternalName( Map.class ),
                  "keySet",
                  Type.getMethodDescriptor( Type.getType( Set.class ), new Type[] {} ) );
          mv.visitInsn( ARETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
  
          mv = cw.visitMethod( ACC_PUBLIC,
                  "_setBottomTypeCode",
                  Type.getMethodDescriptor( Type.getType( void.class ), new Type[] { Type.getType( BitSet.class ) } ),
                  null, null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType( classDef.getName() ), TraitableBean.TRAITSET_FIELD_NAME , Type.getDescriptor( Map.class ) );
          mv.visitTypeInsn( CHECKCAST, Type.getInternalName( TraitTypeMap.class ) );
          mv.visitVarInsn( ALOAD, 1 );
          mv.visitMethodInsn( INVOKEVIRTUAL,
                  Type.getInternalName( TraitTypeMap.class ),
                  "setBottomCode",
                  Type.getMethodDescriptor( Type.getType( void.class ), new Type[] { Type.getType( BitSet.class ) } ) );
          mv.visitInsn( RETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
          mv = cw.visitMethod( ACC_PUBLIC,
                  "getMostSpecificTraits",
                  Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { } ) ,
                  "()Ljava/util/Collection<Lorg/drools/core/factmodel/traits/Thing;>;",
                  null );
          mv.visitCode();
  
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType( classDef.getName() ),
                  TraitableBean.TRAITSET_FIELD_NAME ,
                  Type.getDescriptor( Map.class ) );
  
  
          Label l99 = new Label();
          mv.visitJumpInsn( IFNULL, l99 );
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType( classDef.getName() ),
                             TraitableBean.TRAITSET_FIELD_NAME ,
                             Type.getDescriptor( Map.class ) );
          mv.visitTypeInsn( CHECKCAST, Type.getInternalName( TraitTypeMap.class ) );
          mv.visitMethodInsn( INVOKEVIRTUAL,
                  Type.getInternalName( TraitTypeMap.class ),
                  "getMostSpecificTraits",
                  Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { } )  );
          mv.visitInsn( ARETURN );
          mv.visitLabel( l99 );
          mv.visitMethodInsn( INVOKESTATIC,
                              Type.getInternalName( Collections.class ),
                              "emptySet",
                              Type.getMethodDescriptor( Type.getType( Set.class ), new Type[] { } )  );
          mv.visitMethodInsn( INVOKESTATIC,
                              Type.getInternalName( Collections.class ),
                              "unmodifiableCollection",
                              Type.getMethodDescriptor( Type.getType( Collection.class ), new Type[] { Type.getType( Collection.class ) } )  );
          mv.visitInsn( ARETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
          mv = cw.visitMethod( ACC_PUBLIC, "getCurrentTypeCode", Type.getMethodDescriptor( Type.getType( BitSet.class ), new Type[] { } ) , null, null );
          mv.visitCode();
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitFieldInsn( GETFIELD,
                             BuildUtils.getInternalType( classDef.getName() ),
                             TraitableBean.TRAITSET_FIELD_NAME,
                             Type.getDescriptor( Map.class ) );
          Label l3 = new Label();
          mv.visitJumpInsn( IFNONNULL, l3 );
          mv.visitInsn( ACONST_NULL );
          mv.visitInsn( ARETURN );
          mv.visitLabel( l3 );
          mv.visitVarInsn( ALOAD, 0 );
          mv.visitFieldInsn( GETFIELD,
                             BuildUtils.getInternalType( classDef.getName() ),
                             TraitableBean.TRAITSET_FIELD_NAME,
                             Type.getDescriptor( Map.class ) );
          mv.visitTypeInsn( CHECKCAST, Type.getInternalName( TraitTypeMap.class ) );
          mv.visitMethodInsn( INVOKEVIRTUAL,
                              Type.getInternalName( TraitTypeMap.class ),
                              "getCurrentTypeCode",
                              Type.getMethodDescriptor( Type.getType( BitSet.class ), new Type[] { } ) );
          mv.visitInsn( ARETURN );
          mv.visitMaxs( 0, 0 );
          mv.visitEnd();
  
  
      }