void write(DataOutput out) throws IOException { super.write(out); out.writeShort(_index); if (getOpcode() == Constants.INVOKEINTERFACE) { String[] args = getMethodParamNames(); int count = 1; for (int i = 0; i < args.length; i++, count++) if (long.class.getName().equals(args[i]) || double.class.getName().equals(args[i])) count++; out.writeByte(count); out.writeByte(0); } else if (getOpcode() == Constants.INVOKEDYNAMIC) { out.writeByte(0); out.writeByte(0); } } }
public int getLogicalStackChange() { String ret = getMethodReturnName(); if (ret == null) return 0; // subtract a stack pos for the this ptr int stack = 0; if (getOpcode() != Constants.INVOKESTATIC) stack--; // and for each arg String[] params = getMethodParamNames(); for (int i = 0; i < params.length; i++) stack--; // add for the return value, if any if (!void.class.getName().equals(ret)) stack++; return stack; }
public int getLogicalStackChange() { String ret = getMethodReturnName(); if (ret == null) return 0; // subtract a stack pos for the this ptr int stack = 0; if (getOpcode() != Constants.INVOKESTATIC) stack--; // and for each arg String[] params = getMethodParamNames(); for (int i = 0; i < params.length; i++) stack--; // add for the return value, if any if (!void.class.getName().equals(ret)) stack++; return stack; }
void write(DataOutput out) throws IOException { super.write(out); out.writeShort(_index); if (getOpcode() == Constants.INVOKEINTERFACE) { String[] args = getMethodParamNames(); int count = 1; for (int i = 0; i < args.length; i++, count++) if (long.class.getName().equals(args[i]) || double.class.getName().equals(args[i])) count++; out.writeByte(count); out.writeByte(0); } else if (getOpcode() == Constants.INVOKEDYNAMIC) { out.writeByte(0); out.writeByte(0); } } }
/** * Return the param types of the method this instruction operates on, * or empty array if none. */ public Class[] getMethodParamTypes() { String[] paramNames = getMethodParamNames(); Class[] params = new Class[paramNames.length]; for (int i = 0; i < paramNames.length; i++) params[i] = Strings.toClass(paramNames[i], getClassLoader()); return params; }
/** * Return the param types of the method this instruction operates on, * or empty array if none. */ public Class[] getMethodParamTypes() { String[] paramNames = getMethodParamNames(); Class[] params = new Class[paramNames.length]; for (int i = 0; i < paramNames.length; i++) params[i] = Strings.toClass(paramNames[i], getClassLoader()); return params; }
public void enterMethodInstruction(MethodInstruction obj) { _out.print(obj.getMethodIndex() + " <" + obj.getMethodReturnName() + " " + obj.getMethodDeclarerName() + "." + obj.getMethodName() + "("); String[] params = obj.getMethodParamNames(); int dotIndex; for (int i = 0; i < params.length; i++) { dotIndex = params[i].lastIndexOf('.'); if (dotIndex != -1) params[i] = params[i].substring(dotIndex + 1); _out.print(params[i]); if (i != (params.length - 1)) _out.print(", "); } _out.print(")>"); }
public void enterMethodInstruction(MethodInstruction obj) { _out.print(obj.getMethodIndex() + " <" + obj.getMethodReturnName() + " " + obj.getMethodDeclarerName() + "." + obj.getMethodName() + "("); String[] params = obj.getMethodParamNames(); int dotIndex; for (int i = 0; i < params.length; i++) { dotIndex = params[i].lastIndexOf('.'); if (dotIndex != -1) params[i] = params[i].substring(dotIndex + 1); _out.print(params[i]); if (i != (params.length - 1)) _out.print(", "); } _out.print(")>"); }
/** * Set the return type of the method this instruction operates on. * * @return this instruction, for method chaining */ public MethodInstruction setMethodReturn(String type) { return setMethod(getMethodDeclarerName(), getMethodName(), type, getMethodParamNames()); }
/** * Set the declaring type of the method this instruction operates on. * * @return this instruction, for method chaining */ public MethodInstruction setMethodDeclarer(String type) { return setMethod(type, getMethodName(), getMethodReturnName(), getMethodParamNames()); }
/** * Return the param types of the method this instruction operates on, * or empty array if none. */ public BCClass[] getMethodParamBCs() { String[] paramNames = getMethodParamNames(); BCClass[] params = new BCClass[paramNames.length]; for (int i = 0; i < paramNames.length; i++) params[i] = getProject().loadClass(paramNames[i], getClassLoader()); return params; }
/** * Set the declaring type of the method this instruction operates on. * * @return this instruction, for method chaining */ public MethodInstruction setMethodDeclarer(String type) { return setMethod(type, getMethodName(), getMethodReturnName(), getMethodParamNames()); }
/** * Set the return type of the method this instruction operates on. * * @return this instruction, for method chaining */ public MethodInstruction setMethodReturn(String type) { return setMethod(getMethodDeclarerName(), getMethodName(), type, getMethodParamNames()); }
/** * Set the name of the method this instruction operates on. * * @return this instruction, for method chaining */ public MethodInstruction setMethodName(String name) { return setMethod(getMethodDeclarerName(), name, getMethodReturnName(), getMethodParamNames()); }
/** * Return the param types of the method this instruction operates on, * or empty array if none. */ public BCClass[] getMethodParamBCs() { String[] paramNames = getMethodParamNames(); BCClass[] params = new BCClass[paramNames.length]; for (int i = 0; i < paramNames.length; i++) params[i] = getProject().loadClass(paramNames[i], getClassLoader()); return params; }
/** * Set the name of the method this instruction operates on. * * @return this instruction, for method chaining */ public MethodInstruction setMethodName(String name) { return setMethod(getMethodDeclarerName(), name, getMethodReturnName(), getMethodParamNames()); }
void read(Instruction orig) { super.read(orig); MethodInstruction ins = (MethodInstruction) orig; setMethod(ins.getMethodDeclarerName(), ins.getMethodName(), ins.getMethodReturnName(), ins.getMethodParamNames()); }
void read(Instruction orig) { super.read(orig); MethodInstruction ins = (MethodInstruction) orig; setMethod(ins.getMethodDeclarerName(), ins.getMethodName(), ins.getMethodReturnName(), ins.getMethodParamNames()); }
/** * Return the method this instruction operates on, or null if not set. */ public BCMethod getMethod() { String dec = getMethodDeclarerName(); if (dec == null) return null; BCClass bc = getProject().loadClass(dec, getClassLoader()); BCMethod[] meths = bc.getMethods(getMethodName(),getMethodParamNames()); if (meths.length == 0) return null; return meths[0]; }
/** * Return the method this instruction operates on, or null if not set. */ public BCMethod getMethod() { String dec = getMethodDeclarerName(); if (dec == null) return null; BCClass bc = getProject().loadClass(dec, getClassLoader()); BCMethod[] meths = bc.getMethods(getMethodName(),getMethodParamNames()); if (meths.length == 0) return null; return meths[0]; }