static void generateMethod(String className,String fqClassName,String methodName,String returnType,String[] paramTypes,int modifiers,ClassWriter cw){
  String[] exceptions=null;
  boolean isStatic=(modifiers & ACC_STATIC) != 0;
  if (returnType == null)   returnType=OBJECT;
  String methodDescriptor=getMethodDescriptor(returnType,paramTypes);
  CodeVisitor cv=cw.visitMethod(modifiers,methodName,methodDescriptor,exceptions);
  if ((modifiers & ACC_ABSTRACT) != 0)   return;
  if (isStatic)   pushBshStatic(fqClassName,className,cv);
 else {
    cv.visitVarInsn(ALOAD,0);
    cv.visitFieldInsn(GETFIELD,fqClassName,BSHTHIS + className,"Lbsh/This;");
  }
  cv.visitLdcInsn(methodName);
  generateParameterReifierCode(paramTypes,isStatic,cv);
  cv.visitInsn(ACONST_NULL);
  cv.visitInsn(ACONST_NULL);
  cv.visitInsn(ACONST_NULL);
  cv.visitInsn(ICONST_1);
  cv.visitMethodInsn(INVOKEVIRTUAL,"bsh/This","invokeMethod",Type.getMethodDescriptor(Type.getType(Object.class),new Type[]{Type.getType(String.class),Type.getType(Object[].class),Type.getType(Interpreter.class),Type.getType(CallStack.class),Type.getType(SimpleNode.class),Type.getType(Boolean.TYPE)}));
  cv.visitMethodInsn(INVOKESTATIC,"bsh/Primitive","unwrap","(Ljava/lang/Object;)Ljava/lang/Object;");
  generateReturnCode(returnType,cv);
  cv.visitMaxs(0,0);
}

static void generateMethod ( String className , String fqClassName , String methodName , String returnType , String [ ] paramTypes , int modifiers , ClassWriter cw ) { String [ ] exceptions = null ; boolean isStatic = ( modifiers & ACC_STATIC ) != 0 ; if ( returnType == null ) returnType = OBJECT ; String methodDescriptor = getMethodDescriptor ( returnType , paramTypes ) ; CodeVisitor cv = cw . visitMethod ( modifiers , methodName , methodDescriptor , exceptions ) ; if ( ( modifiers & ACC_ABSTRACT ) != 0 ) return ; if ( isStatic ) pushBshStatic ( fqClassName , className , cv ) ; else { cv . visitVarInsn ( ALOAD , 0 ) ; cv . visitFieldInsn ( GETFIELD , fqClassName , BSHTHIS + className , "Lbsh/This;" ) ; } cv . visitLdcInsn ( methodName ) ; generateParameterReifierCode ( paramTypes , isStatic , cv ) ; cv . visitInsn ( ACONST_NULL ) ; cv . visitInsn ( ACONST_NULL ) ; cv . visitInsn ( ACONST_NULL ) ; cv . visitInsn ( ICONST_1 ) ; cv . visitMethodInsn ( INVOKEVIRTUAL , "bsh/This" , "invokeMethod" , Type . getMethodDescriptor ( Type . getType ( Object . class ) , new Type [ ] { Type . getType ( String . class ) , Type . getType ( Object [ ] . class ) , Type . getType ( Interpreter . class ) , Type . getType ( CallStack . class ) , Type . getType ( SimpleNode . class ) , Type . getType ( Boolean . TYPE ) } ) ) ; cv . visitMethodInsn ( INVOKESTATIC , "bsh/Primitive" , "unwrap" , "(Ljava/lang/Object;)Ljava/lang/Object;" ) ; generateReturnCode ( returnType , cv ) ; cv . visitMaxs ( 0 , 0 ) ; }
generate a delegate method - static or instance . the generated code packs the method arguments into an object array ( wrapping primitive types in bsh . primitive ) , invokes the static or instance namespace invokemethod ( ) method , and then unwraps / returns the result .
