/** * Returns true if the called method is of a superclass of the current * class. */ public boolean isSuper() { return iterator.byteAt(currentPos) == INVOKESPECIAL && !where().getDeclaringClass().getName().equals(getClassName()); }
/** * Returns true if the called method is of a superclass of the current * class. */ public boolean isSuper() { return iterator.byteAt(currentPos) == INVOKESPECIAL && !where().getDeclaringClass().getName().equals(getClassName()); }
public Object visit(ASTWithincode node, Object data) { WithinMatcher within = null; try { within = new WithinMatcher(advisor, call.where(), null); } catch (NotFoundException e) { throw new RuntimeException(e); //To change body of catch statement use Options | File Templates. } return node.jjtAccept(within, null); }
public Object visit(ASTWithin node, Object data) { WithinMatcher within = null; try { within = new WithinMatcher(advisor, call.where(), null); } catch (NotFoundException e) { throw new RuntimeException(e); //To change body of catch statement use Options | File Templates. } return node.jjtAccept(within, null); }
/** * Returns true if the called method is of a superclass of the current * class. */ public boolean isSuper() { return iterator.byteAt(currentPos) == INVOKESPECIAL && !where().getDeclaringClass().getName().equals(getClassName()); }
/** * Returns true if the called method is of a superclass of the current * class. */ public boolean isSuper() { return iterator.byteAt(currentPos) == INVOKESPECIAL && !where().getDeclaringClass().getName().equals(getClassName()); }
/** * Returns true if the called method is of a superclass of the current * class. */ public boolean isSuper() { return iterator.byteAt(currentPos) == INVOKESPECIAL && !where().getDeclaringClass().getName().equals(getClassName()); }
/** * Returns true if the called method is of a superclass of the current * class. */ public boolean isSuper() { return iterator.byteAt(currentPos) == INVOKESPECIAL && !where().getDeclaringClass().getName().equals(getClassName()); }
/** * Returns true if the called method is of a superclass of the current * class. */ public boolean isSuper() { return iterator.byteAt(currentPos) == INVOKESPECIAL && !where().getDeclaringClass().getName().equals(getClassName()); }
ConstructorDetail(CallerExprEditor editor, MethodCall call, String classname)throws NotFoundException { this.call = call; con = (CtConstructor) call.where(); callingIndex = editor.constructors.indexOf(con); calledHash = JavassistMethodHashing.methodHash(call.getMethod()); callerInfoField = getMethodByConInfoName(callingIndex, classname, calledHash); calledMethod = call.getMethod(); this.classname = classname; } }
MethodDetail(CallerExprEditor editor, MethodCall call, String classname) throws NotFoundException { this.call = call; where = (CtMethod) call.where(); callingHash = JavassistMethodHashing.methodHash((where)); calledHash = JavassistMethodHashing.methodHash(call.getMethod()); callerInfoField = getMethodByMethodInfoName(callingHash, classname, calledHash); calledMethod = call.getMethod(); this.classname = classname; } }
new ExprEditor() { @Override public void edit(MethodCall m) throws CannotCompileException { try { if (m.where().getName().equals(sourceMethod)) { if (m.getMethod().getName().equals(methodcalltoReplace)) { if(lineNumberOfMethodcalltoReplace == m.getLineNumber()){ // The content of the hardcoded string can be replaced with runtime data m.replace("$_ = ($r)"+"new com.nuwaza.aqua.sample.SampleForMethodInvocationFieldAccess().helloworld();"); } } } } catch (NotFoundException e) { e.printStackTrace(); } super.edit(m); }
try { if (targetNames.contains(called.getClassName())) { Method callingMethod = getMethod(caller.getName(), called.where()); if (callingMethod != null && (getRecursive || !result.containsKey(callingMethod)) &&
CtBehavior caller = mcall.where(); if (caller instanceof CtConstructor)
CtBehavior behavior = call.where();
protected String getLatestArg(MethodCall call, int skip) throws BadBytecode { int[] indices = new int[skip + 1]; int counter = 0; MethodInfo info = ((CtMethod)call.where()).getMethodInfo(); CodeIterator iterator = info.getCodeAttribute().iterator(); int currentPos = call.indexOfBytecode(); while (iterator.hasNext()) { int pos = iterator.next(); if (pos >= currentPos) break; switch (iterator.byteAt(pos)) { case Opcode.LDC: indices[(counter++) % indices.length] = iterator.byteAt(pos + 1); break; case Opcode.LDC_W: indices[(counter++) % indices.length] = iterator.u16bitAt(pos + 1); break; } } if (counter < skip) return null; return info.getConstPool().getStringInfo(indices[(indices.length + counter - skip) % indices.length]); }
private String getLastConstantArgument(final MethodCall call, final int skip) throws BadBytecode { final int[] indices = new int[skip + 1]; int counter = 0; final MethodInfo info = ((CtMethod) call.where()).getMethodInfo(); final CodeIterator iterator = info.getCodeAttribute().iterator(); final int currentPos = call.indexOfBytecode(); while (iterator.hasNext()) { final int pos = iterator.next(); if (pos >= currentPos) break; switch (iterator.byteAt(pos)) { case Opcode.LDC: indices[(counter++) % indices.length] = iterator.byteAt(pos + 1); break; case Opcode.LDC_W: indices[(counter++) % indices.length] = iterator.u16bitAt(pos + 1); break; } } if (counter < skip) { return null; } counter %= indices.length; if (skip > 0) { counter -= skip; if (counter < 0) counter += indices.length; } return info.getConstPool().getStringInfo(indices[counter]); }
private String getLastConstantArgument(final MethodCall call, final int skip) throws BadBytecode { final int[] indices = new int[skip + 1]; int counter = 0; final MethodInfo info = ((CtMethod) call.where()).getMethodInfo(); final CodeIterator iterator = info.getCodeAttribute().iterator(); final int currentPos = call.indexOfBytecode(); while (iterator.hasNext()) { final int pos = iterator.next(); if (pos >= currentPos) break; switch (iterator.byteAt(pos)) { case Opcode.LDC: indices[(counter++) % indices.length] = iterator.byteAt(pos + 1); break; case Opcode.LDC_W: indices[(counter++) % indices.length] = iterator.u16bitAt(pos + 1); break; } } if (counter < skip) { return null; } counter %= indices.length; if (skip > 0) { counter -= skip; if (counter < 0) counter += indices.length; } return info.getConstPool().getStringInfo(indices[counter]); }