protected void buildHardGetter( ClassVisitor cw, FieldDefinition field, String masterName, ClassDefinition proxy, ClassDefinition core, String getterName, boolean protect ) {
Class fieldType = field.getType();
MethodVisitor mv = cw.visitMethod( protect ? ACC_PROTECTED : ACC_PUBLIC,
getterName,
"()" + Type.getDescriptor( fieldType ),
null,
null);
mv.visitCode();
TraitFactory.invokeExtractor( mv, masterName, proxy, core, field );
if ( ! BuildUtils.isPrimitive( field.getTypeName() ) ) {
mv.visitTypeInsn( CHECKCAST, Type.getInternalName( fieldType ) );
}
mv.visitInsn( BuildUtils.returnType ( fieldType.getName() ) );
// mv.visitMaxs( 2, 1 );
mv.visitMaxs( 0, 0 );
mv.visitEnd();
}