/** * Return the field returned by the given method, or null if none. * Package-protected and static for testing. */ static BCField getReturnedField(BCMethod meth) { return findField(meth, (AccessController.doPrivileged( J2DoPrivHelper.newCodeAction())).xreturn() .setType(meth.getReturnType()), false); }
/** * Return the field returned by the given method, or null if none. * Package-protected and static for testing. */ static BCField getReturnedField(BCMethod meth) { return findField(meth, (AccessController.doPrivileged( J2DoPrivHelper.newCodeAction())).xreturn() .setType(meth.getReturnType()), false); }
/** * Return the field returned by the given method, or null if none. * Package-protected and static for testing. */ static BCField getReturnedField(BCMethod meth) { return findField(meth, (AccessController.doPrivileged( J2DoPrivHelper.newCodeAction())).xreturn() .setType(meth.getReturnType()), false); }
/** * Return the field returned by the given method, or null if none. * Package-protected and static for testing. */ static BCField getReturnedField(BCMethod meth) { return findField(meth, (AccessController.doPrivileged( J2DoPrivHelper.newCodeAction())).xreturn() .setType(meth.getReturnType()), false); }
/** * Return the field returned by the given method, or null if none. * Package-protected and static for testing. */ static BCField getReturnedField(BCMethod meth) { return findField(meth, ((Code) AccessController.doPrivileged( J2DoPrivHelper.newCodeAction())).xreturn() .setType(meth.getReturnType()), false); }
/** * Proxy the given method with one that overrides it by calling into the * given helper. */ private void proxyOverrideMethod(BCClass bc, Method meth, Method helper, Class[] params) { BCMethod m = bc.declareMethod(meth.getName(), meth.getReturnType(), meth.getParameterTypes()); m.makePublic(); Code code = m.getCode(true); code.aload().setThis(); for (int i = 1; i < params.length; i++) code.xload().setParam(i - 1).setType(params[i]); code.invokestatic().setMethod(helper); code.xreturn().setType(meth.getReturnType()); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Proxy the given method with one that overrides it by calling into the * given helper. */ private void proxyOverrideMethod(BCClass bc, Method meth, Method helper, Class[] params) { BCMethod m = bc.declareMethod(meth.getName(), meth.getReturnType(), meth.getParameterTypes()); m.makePublic(); Code code = m.getCode(true); code.aload().setThis(); for (int i = 1; i < params.length; i++) code.xload().setParam(i - 1).setType(params[i]); code.invokestatic().setMethod(helper); code.xreturn().setType(meth.getReturnType()); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Proxy the given method with one that overrides it by calling into the * given helper. */ private void proxyOverrideMethod(BCClass bc, Method meth, Method helper, Class[] params) { BCMethod m = bc.declareMethod(meth.getName(), meth.getReturnType(), meth.getParameterTypes()); m.makePublic(); Code code = m.getCode(true); code.aload().setThis(); for (int i = 1; i < params.length; i++) code.xload().setParam(i - 1).setType(params[i]); code.invokestatic().setMethod(helper); code.xreturn().setType(meth.getReturnType()); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Proxy the given method with one that overrides it by calling into the * given helper. */ private void proxyOverrideMethod(BCClass bc, Method meth, Method helper, Class[] params) { BCMethod m = bc.declareMethod(meth.getName(), meth.getReturnType(), meth.getParameterTypes()); m.makePublic(); Code code = m.getCode(true); code.aload().setThis(); for (int i = 1; i < params.length; i++) code.xload().setParam(i - 1).setType(params[i]); code.invokestatic().setMethod(helper); code.xreturn().setType(meth.getReturnType()); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Clear code associated with the given method signature, and return * the empty code. Will return null if the method should be empty. */ protected Code replaceMethod(BCClass bc, String name, Class retType, Class[] args, boolean remove) { bc.removeDeclaredMethod(name, args); BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); if (!remove) return code; code.xreturn().setType(retType); code.calculateMaxStack(); code.calculateMaxLocals(); return null; }
/** * Clear code associated with the given method signature, and return * the empty code. Will return null if the method should be empty. */ protected Code replaceMethod(BCClass bc, String name, Class retType, Class[] args, boolean remove) { bc.removeDeclaredMethod(name, args); BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); if (!remove) return code; code.xreturn().setType(retType); code.calculateMaxStack(); code.calculateMaxLocals(); return null; }
/** * Clear code associated with the given method signature, and return * the empty code. Will return null if the method should be empty. */ protected Code replaceMethod(BCClass bc, String name, Class retType, Class[] args, boolean remove) { bc.removeDeclaredMethod(name, args); BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); if (!remove) return code; code.xreturn().setType(retType); code.calculateMaxStack(); code.calculateMaxLocals(); return null; }
/** * Clear code associated with the given method signature, and return * the empty code. Will return null if the method should be empty. */ protected Code replaceMethod(BCClass bc, String name, Class retType, Class[] args, boolean remove) { bc.removeDeclaredMethod(name, args); BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); if (!remove) return code; code.xreturn().setType(retType); code.calculateMaxStack(); code.calculateMaxLocals(); return null; }
/** * Clear code associated with the given method signature, and return * the empty code. Will return null if the method should be empty. */ protected Code replaceMethod(BCClass bc, String name, Class retType, Class[] args, boolean remove) { bc.removeDeclaredMethod(name, args); BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); if (!remove) return code; code.xreturn().setType(retType); code.calculateMaxStack(); code.calculateMaxLocals(); return null; }
/** * Proxy the given setter method to dirty the proxy owner. */ private void proxySetter(BCClass bc, Class type, Method meth) { Class[] params = meth.getParameterTypes(); Class ret = meth.getReturnType(); BCMethod m = bc.declareMethod(meth.getName(), ret, params); m.makePublic(); Code code = m.getCode(true); code.aload().setThis(); code.constant().setValue(true); code.invokestatic().setMethod(Proxies.class, "dirty", void.class, new Class[] { Proxy.class, boolean.class }); code.aload().setThis(); for (int i = 0; i < params.length; i++) code.xload().setParam(i).setType(params[i]); code.invokespecial().setMethod(type, meth.getName(), ret, params); code.xreturn().setType(ret); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Add method which defers to AbstractPCData. */ protected void callAbstractPCData(BCClass bc, String name, Class<?> retType, Class<?>[] args) { BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); code.aload().setThis(); for (int i = 0; i < args.length; i++) code.xload().setParam(i).setType(args[i]); code.invokevirtual().setMethod(AbstractPCData.class, name, retType, args); if (!void.class.equals(retType)) code.xreturn().setType(retType); code.calculateMaxLocals(); code.calculateMaxStack(); }
/** * Add method which defers to AbstractPCData. */ protected void callAbstractPCData(BCClass bc, String name, Class<?> retType, Class<?>[] args) { BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); code.aload().setThis(); for (int i = 0; i < args.length; i++) code.xload().setParam(i).setType(args[i]); code.invokevirtual().setMethod(AbstractPCData.class, name, retType, args); if (!void.class.equals(retType)) code.xreturn().setType(retType); code.calculateMaxLocals(); code.calculateMaxStack(); }
/** * Add method which defers to AbstractPCData. */ protected void callAbstractPCData(BCClass bc, String name, Class<?> retType, Class<?>[] args) { BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); code.aload().setThis(); for (int i = 0; i < args.length; i++) code.xload().setParam(i).setType(args[i]); code.invokevirtual().setMethod(AbstractPCData.class, name, retType, args); if (!void.class.equals(retType)) code.xreturn().setType(retType); code.calculateMaxLocals(); code.calculateMaxStack(); }
/** * Add method which defers to AbstractPCData. */ protected void callAbstractPCData(BCClass bc, String name, Class<?> retType, Class<?>[] args) { BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); code.aload().setThis(); for (int i = 0; i < args.length; i++) code.xload().setParam(i).setType(args[i]); code.invokevirtual().setMethod(AbstractPCData.class, name, retType, args); if (!void.class.equals(retType)) code.xreturn().setType(retType); code.calculateMaxLocals(); code.calculateMaxStack(); }
/** * Add method which defers to AbstractPCData. */ protected void callAbstractPCData(BCClass bc, String name, Class retType, Class[] args) { BCMethod meth = bc.declareMethod(name, retType, args); Code code = meth.getCode(true); code.aload().setThis(); for (int i = 0; i < args.length; i++) code.xload().setParam(i).setType(args[i]); code.invokevirtual().setMethod(AbstractPCData.class, name, retType, args); if (!void.class.equals(retType)) code.xreturn().setType(retType); code.calculateMaxLocals(); code.calculateMaxStack(); }