Package javassist.bytecode

Examples of javassist.bytecode.Bytecode.addInvokestatic()


                b.addIconst(i);
                b.addLdc(names[i]);
                b.add(Opcode.AASTORE);
            }
        }
        b.addInvokestatic("play.classloading.enhancers.LVEnhancer$LVEnhancerRuntime", "initMethodCall", "(Ljava/lang/String;ILjava/lang/String;[Ljava/lang/String;)V");
        return b;
    }
   
    private static Bytecode makeExitMethod(CtBehavior behavior, String className, String methodName, String signature) {
        Bytecode b = new Bytecode(behavior.getMethodInfo().getConstPool());
View Full Code Here


    private static Bytecode makeExitMethod(CtBehavior behavior, String className, String methodName, String signature) {
        Bytecode b = new Bytecode(behavior.getMethodInfo().getConstPool());
        b.addLdc(className);
        b.addLdc(methodName);
        b.addLdc(signature);
        b.addInvokestatic("play.classloading.enhancers.LVEnhancer$LVEnhancerRuntime", "exitMethod", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
        return b;
    }
   
    private static Bytecode makeEnterMethod(CtBehavior behavior, String className, String methodName, String signature) {
        Bytecode b = new Bytecode(behavior.getMethodInfo().getConstPool());
View Full Code Here

    private static Bytecode makeEnterMethod(CtBehavior behavior, String className, String methodName, String signature) {
        Bytecode b = new Bytecode(behavior.getMethodInfo().getConstPool());
        b.addLdc(className);
        b.addLdc(methodName);
        b.addLdc(signature);
        b.addInvokestatic("play.classloading.enhancers.LVEnhancer$LVEnhancerRuntime", "enterMethod", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
        return b;
    }
   
    private static void insert(Bytecode b, CtClass ctClass, CtBehavior behavior, CodeAttribute codeAttribute, FrameIterator iterator, Frame frame, boolean after) throws CompileError, BadBytecode, NotFoundException {
        int locals = b.getMaxLocals();
View Full Code Here

                !"I".equals(sig) && !"J".equals(sig) && !"S".equals(sig) && !"Z".equals(sig))
            localVarDescriptor = "Ljava/lang/Object;";

        Logger.trace("for variable '%s' in slot=%s, sig was '%s' and is now '%s'", name, slot, sig, localVarDescriptor);

        b.addInvokestatic("yalp.classloading.enhancers.LocalvariablesNamesEnhancer$LocalVariablesNamesTracer", "addVariable", "(Ljava/lang/String;" + localVarDescriptor + ")V");

        return b;
    }

    /**
 
View Full Code Here

/* 1322 */     ExceptionsAttribute ea = new ExceptionsAttribute(cp);
/* 1323 */     ea.setExceptions(list);
/* 1324 */     minfo.setExceptionsAttribute(ea);
/* 1325 */     Bytecode code = new Bytecode(cp, 0, 1);
/* 1326 */     code.addAload(0);
/* 1327 */     code.addInvokestatic("javassist.util.proxy.RuntimeSupport", "makeSerializedProxy", "(Ljava/lang/Object;)Ljavassist/util/proxy/SerializedProxy;");
/*      */
/* 1330 */     code.addOpcode(176);
/* 1331 */     minfo.setCodeAttribute(code.toCodeAttribute());
/* 1332 */     return minfo;
/*      */   }
View Full Code Here

/* 122 */       for (int i = 0; i < params.length; i++) {
/* 123 */         regno += code.addLoad(regno, params[i]);
/*     */       }
/* 125 */       code.setMaxLocals(regno);
/* 126 */       if (desc == accDesc)
/* 127 */         code.addInvokestatic(this.clazz, name, desc);
/*     */       else {
/* 129 */         code.addInvokevirtual(this.clazz, name, desc);
/*     */       }
/* 131 */       code.addReturn(Descriptor.getReturnType(desc, pool));
/* 132 */       minfo.setCodeAttribute(code.toCodeAttribute());
View Full Code Here

/* 344 */     CtClass deleClass = delegate.getDeclaringClass();
/* 345 */     CtClass[] params = delegate.getParameterTypes();
/*     */     int s;
/* 347 */     if (isStatic) {
/* 348 */       int s = code.addLoadParameters(params, 0);
/* 349 */       code.addInvokestatic(deleClass, methodName, desc);
/*     */     }
/*     */     else {
/* 352 */       code.addLoad(0, deleClass);
/* 353 */       s = code.addLoadParameters(params, 1);
/* 354 */       code.addInvokespecial(deleClass, methodName, desc);
View Full Code Here

        /* 0 */ addJump(code, Opcode.JSR, 5);
        /* 3 */ code.addAload(0);
        /* 4 */ code.addOpcode(Opcode.ARETURN);
        /* 5 */ code.addAstore(1);
        /* 6 */ code.addIconst(4);
        /* 7 */ code.addInvokestatic(stringClass, "valueOf", stringClass, new CtClass[]{CtClass.intType});
        /* 10 */ code.addAstore(0);
        /* 11 */ code.addRet(1);
        info.setCodeAttribute(code.toCodeAttribute());
        clazz.addMethod(method);

View Full Code Here

        Bytecode code = new Bytecode(info.getConstPool(), 1, 2);
        /* 0 */ code.addIconst(1);
        /* 1 */ addJump(code, Opcode.GOTO, 5);
        /* 4 */ code.addIconst(0); // DEAD
        /* 5 */ code.addIconst(1);
        /* 6 */ code.addInvokestatic(stringClass, "valueOf", stringClass, new CtClass[]{CtClass.intType});
        /* 9 */ code.addOpcode(Opcode.ARETURN);
        info.setCodeAttribute(code.toCodeAttribute());
        clazz.addMethod(method);

        return method;
View Full Code Here

        CtMethod method = new CtMethod(stringClass, "foo", new CtClass[0], clazz);
        MethodInfo info = method.getMethodInfo2();
        info.setAccessFlags(AccessFlag.PUBLIC | AccessFlag.STATIC);
        Bytecode code = new Bytecode(info.getConstPool(), 1, 2);
        /* 0 */ code.addIconst(1);
        /* 1 */ code.addInvokestatic(intClass, "valueOf", intClass, new CtClass[]{CtClass.intType});
        /* 4 */ code.addOpcode(Opcode.ARETURN);
        info.setCodeAttribute(code.toCodeAttribute());
        clazz.addMethod(method);

        return method;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.