use of org.mvel2.asm.Type in project drools by kiegroup.
the class TraitMapProxyClassBuilderImpl method buildSoftSetter.
protected void buildSoftSetter(ClassVisitor cw, FieldDefinition field, String proxy, ClassDefinition core, String setterName, int accessMode) {
String type = field.getTypeName();
MethodVisitor mv = cw.visitMethod(accessMode, setterName, "(" + BuildUtils.getTypeDescriptor(type) + ")V", null, null);
mv.visitCode();
if (core.isFullTraiting()) {
logicalSetter(mv, field, proxy, core);
}
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, BuildUtils.getInternalType(proxy), "map", Type.getDescriptor(Map.class));
mv.visitLdcInsn(field.resolveAlias());
mv.visitVarInsn(BuildUtils.varType(type), 1);
if (BuildUtils.isPrimitive(type)) {
TraitFactory.valueOf(mv, type);
}
mv.visitMethodInsn(INVOKEINTERFACE, Type.getInternalName(Map.class), "put", "(" + Type.getDescriptor(Object.class) + Type.getDescriptor(Object.class) + ")" + Type.getDescriptor(Object.class), true);
mv.visitInsn(POP);
mv.visitInsn(RETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
use of org.mvel2.asm.Type in project drools by kiegroup.
the class DefaultBeanClassBuilder method buildTraitMap.
/**
* A traitable class is a special class with support for dynamic properties and types.
*
* This method builds the trait map, containing the references to the proxies
* for each trait carried by an object at a given time.
*
* @param cw
* @param classDef
*/
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();
}
use of org.mvel2.asm.Type in project drools by kiegroup.
the class DefaultBeanClassBuilder method buildEquals.
protected void buildEquals(ClassVisitor cw, ClassDefinition classDef) {
MethodVisitor mv;
// Building equals method
{
mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null);
mv.visitCode();
Label l0 = null;
if (this.debug) {
l0 = new Label();
mv.visitLabel(l0);
}
// if ( this == obj ) return true;
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitVarInsn(Opcodes.ALOAD, 1);
Label l1 = new Label();
mv.visitJumpInsn(Opcodes.IF_ACMPNE, l1);
mv.visitInsn(Opcodes.ICONST_1);
mv.visitInsn(Opcodes.IRETURN);
// if ( obj == null ) return false;
mv.visitLabel(l1);
mv.visitVarInsn(Opcodes.ALOAD, 1);
Label l2 = new Label();
mv.visitJumpInsn(Opcodes.IFNONNULL, l2);
mv.visitInsn(Opcodes.ICONST_0);
mv.visitInsn(Opcodes.IRETURN);
// if ( getClass() != obj.getClass() ) return false;
mv.visitLabel(l2);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(Object.class), "getClass", Type.getMethodDescriptor(Type.getType(Class.class), new Type[] {}));
mv.visitVarInsn(Opcodes.ALOAD, 1);
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(Object.class), "getClass", Type.getMethodDescriptor(Type.getType(Class.class), new Type[] {}));
Label l3 = new Label();
mv.visitJumpInsn(Opcodes.IF_ACMPEQ, l3);
mv.visitInsn(Opcodes.ICONST_0);
mv.visitInsn(Opcodes.IRETURN);
// final <classname> other = (<classname>) obj;
mv.visitLabel(l3);
mv.visitVarInsn(Opcodes.ALOAD, 1);
mv.visitTypeInsn(Opcodes.CHECKCAST, BuildUtils.getInternalType(classDef.getClassName()));
mv.visitVarInsn(Opcodes.ASTORE, 2);
// for each key field
int count = 0;
for (FieldDefinition field : classDef.getFieldsDefinitions()) {
if (field.isKey()) {
count++;
Label goNext = new Label();
if (BuildUtils.isPrimitive(field.getTypeName())) {
// if attr is primitive
// if ( this.<attr> != other.<booleanAttr> ) return false;
mv.visitVarInsn(Opcodes.ALOAD, 0);
visitFieldOrGetter(mv, classDef, field);
mv.visitVarInsn(Opcodes.ALOAD, 2);
visitFieldOrGetter(mv, classDef, field);
if (field.getTypeName().equals("long")) {
mv.visitInsn(Opcodes.LCMP);
mv.visitJumpInsn(Opcodes.IFEQ, goNext);
} else if (field.getTypeName().equals("double")) {
mv.visitInsn(Opcodes.DCMPL);
mv.visitJumpInsn(Opcodes.IFEQ, goNext);
} else if (field.getTypeName().equals("float")) {
mv.visitInsn(Opcodes.FCMPL);
mv.visitJumpInsn(Opcodes.IFEQ, goNext);
} else {
// boolean, byte, char, short, int
mv.visitJumpInsn(Opcodes.IF_ICMPEQ, goNext);
}
mv.visitInsn(Opcodes.ICONST_0);
mv.visitInsn(Opcodes.IRETURN);
} else {
// if attr is not a primitive
// if ( this.<attr> == null && other.<attr> != null ||
// this.<attr> != null && ! this.<attr>.equals( other.<attr> ) ) return false;
mv.visitVarInsn(Opcodes.ALOAD, 0);
visitFieldOrGetter(mv, classDef, field);
Label secondIfPart = new Label();
mv.visitJumpInsn(Opcodes.IFNONNULL, secondIfPart);
// if ( other.objAttr != null ) return false;
mv.visitVarInsn(Opcodes.ALOAD, 2);
visitFieldOrGetter(mv, classDef, field);
Label returnFalse = new Label();
mv.visitJumpInsn(Opcodes.IFNONNULL, returnFalse);
mv.visitLabel(secondIfPart);
mv.visitVarInsn(Opcodes.ALOAD, 0);
visitFieldOrGetter(mv, classDef, field);
mv.visitJumpInsn(Opcodes.IFNULL, goNext);
mv.visitVarInsn(Opcodes.ALOAD, 0);
visitFieldOrGetter(mv, classDef, field);
mv.visitVarInsn(Opcodes.ALOAD, 2);
visitFieldOrGetter(mv, classDef, field);
if (!BuildUtils.isArray(field.getTypeName())) {
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
} else {
mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/util/Arrays", "equals", "(" + BuildUtils.arrayType(field.getTypeName()) + BuildUtils.arrayType(field.getTypeName()) + ")Z");
}
mv.visitJumpInsn(Opcodes.IFNE, goNext);
mv.visitLabel(returnFalse);
mv.visitInsn(Opcodes.ICONST_0);
mv.visitInsn(Opcodes.IRETURN);
}
mv.visitLabel(goNext);
}
}
if (count > 0) {
mv.visitInsn(Opcodes.ICONST_1);
} else {
mv.visitInsn(Opcodes.ICONST_0);
}
mv.visitInsn(Opcodes.IRETURN);
Label lastLabel = null;
if (this.debug) {
lastLabel = new Label();
mv.visitLabel(lastLabel);
mv.visitLocalVariable("this", BuildUtils.getTypeDescriptor(classDef.getClassName()), null, l0, lastLabel, 0);
mv.visitLocalVariable("obj", Type.getDescriptor(Object.class), null, l0, lastLabel, 1);
mv.visitLocalVariable("other", BuildUtils.getTypeDescriptor(classDef.getClassName()), null, l0, lastLabel, 2);
}
mv.visitMaxs(0, 0);
mv.visitEnd();
}
}
use of org.mvel2.asm.Type in project drools by kiegroup.
the class DefaultBeanClassBuilder method initFieldWithDefaultValue.
protected boolean initFieldWithDefaultValue(MethodVisitor mv, ClassDefinition classDef, FieldDefinition field) {
if (field.getInitExpr() == null && field.isInherited()) {
return false;
}
// get simple init expression value
Object val = BuildUtils.getDefaultValue(field);
boolean hasObjects = false;
if (val != null) {
// there's a simple init expression
mv.visitVarInsn(Opcodes.ALOAD, 0);
if (BuildUtils.isPrimitive(field.getTypeName()) || BuildUtils.isBoxed(field.getTypeName()) || String.class.getName().equals(field.getTypeName())) {
mv.visitLdcInsn(val);
if (BuildUtils.isBoxed(field.getTypeName())) {
mv.visitMethodInsn(Opcodes.INVOKESTATIC, BuildUtils.getInternalType(field.getTypeName()), "valueOf", "(" + BuildUtils.unBox(field.getTypeName()) + ")" + BuildUtils.getTypeDescriptor(field.getTypeName()));
}
} else {
hasObjects = true;
String type = BuildUtils.getInternalType(val.getClass().getName());
mv.visitTypeInsn(NEW, type);
mv.visitInsn(DUP);
mv.visitMethodInsn(INVOKESPECIAL, type, "<init>", "()V");
}
} else {
// there's a complex init expression
if (field.getInitExpr() != null) {
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(field.getInitExpr());
mv.visitMethodInsn(INVOKESTATIC, "org/mvel2/MVEL", "eval", "(Ljava/lang/String;)Ljava/lang/Object;");
mv.visitTypeInsn(CHECKCAST, BuildUtils.getInternalType(field.getTypeName()));
val = field.getInitExpr();
}
}
if (val != null) {
if (!field.isInherited()) {
mv.visitFieldInsn(Opcodes.PUTFIELD, BuildUtils.getInternalType(classDef.getClassName()), field.getName(), BuildUtils.getTypeDescriptor(field.getTypeName()));
} else {
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, BuildUtils.getInternalType(classDef.getClassName()), field.getWriteMethod(), Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { Type.getType(BuildUtils.getTypeDescriptor(field.getTypeName())) }));
}
}
return hasObjects;
}
use of org.mvel2.asm.Type in project drools by kiegroup.
the class AbstractProxyClassBuilderImpl method synchField.
protected void synchField(MethodVisitor mv, FieldDefinition fld, String proxyName) {
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKEVIRTUAL, BuildUtils.getInternalType(proxyName), BuildUtils.getterName(fld.getName(), fld.getTypeName()), "()" + BuildUtils.getTypeDescriptor(fld.getTypeName()), false);
Label l0 = null;
if (!BuildUtils.isPrimitive(fld.getTypeName())) {
l0 = new Label();
mv.visitJumpInsn(IFNONNULL, l0);
}
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(fld.getInitExpr());
if (BuildUtils.isPrimitive(fld.getTypeName())) {
mv.visitFieldInsn(GETSTATIC, BuildUtils.getInternalType(BuildUtils.box(fld.getTypeName())), "TYPE", Type.getDescriptor(Class.class));
} else {
mv.visitLdcInsn(Type.getType(BuildUtils.getTypeDescriptor(fld.getTypeName())));
}
mv.visitMethodInsn(INVOKESTATIC, Type.getInternalName(MVEL.class), "eval", Type.getMethodDescriptor(Type.getType(Object.class), Type.getType(String.class), Type.getType(Class.class)), false);
if (BuildUtils.isPrimitive(fld.getTypeName())) {
mv.visitTypeInsn(CHECKCAST, BuildUtils.getInternalType(BuildUtils.box(fld.getTypeName())));
mv.visitMethodInsn(INVOKEVIRTUAL, BuildUtils.getInternalType(BuildUtils.box(fld.getTypeName())), BuildUtils.numericMorph(BuildUtils.box(fld.getTypeName())), "()" + BuildUtils.getTypeDescriptor(fld.getTypeName()), false);
} else {
mv.visitTypeInsn(CHECKCAST, BuildUtils.getInternalType(fld.getTypeName()));
}
mv.visitMethodInsn(INVOKEVIRTUAL, BuildUtils.getInternalType(proxyName), BuildUtils.setterName(fld.getName(), fld.getTypeName()), "(" + BuildUtils.getTypeDescriptor(fld.getTypeName()) + ")" + Type.getDescriptor(void.class), false);
if (!BuildUtils.isPrimitive(fld.getTypeName())) {
mv.visitLabel(l0);
}
}
Aggregations