private boolean isStringAppend(Instruction ins, ConstantPoolGen cpg) { if (ins instanceof INVOKEVIRTUAL) { INVOKEVIRTUAL invoke = (INVOKEVIRTUAL) ins; if ("append".equals(invoke.getMethodName(cpg)) && invoke.getClassName(cpg).startsWith("java.lang.StringB")) { String sig = invoke.getSignature(cpg); char firstChar = sig.charAt(1); return firstChar == '[' || firstChar == 'L'; } } return false; }
Number n = null; if ("(I)V".equals(invoke.getSignature(cpg))) { n = ByteCode.getPushNumber(location.getHandle().getPrev()); else if ("(ILjava/security/SecureRandom;)V".equals(invoke.getSignature(cpg))) {
String methodSig = invokeVirtual.getSignature(classContext.getConstantPoolGen()); if (!"close".equals(methodName)) { return false;
String methodSig = iv.getSignature(cpg); if ("wait".equals(methodName) && ("()V".equals(methodSig) || "(J)V".equals(methodSig) || "(JI)V".equals(methodSig))
String methodSig = inv.getSignature(cpg);
private boolean isStringAppend(Instruction ins, ConstantPoolGen cpg) { if (ins instanceof INVOKEVIRTUAL) { INVOKEVIRTUAL invoke = (INVOKEVIRTUAL) ins; if ("append".equals(invoke.getMethodName(cpg)) && invoke.getClassName(cpg).startsWith("java.lang.StringB")) { String sig = invoke.getSignature(cpg); char firstChar = sig.charAt(1); return firstChar == '[' || firstChar == 'L'; } } return false; }
public static String getCallSignature(Instruction ins, ConstantPoolGen cp) { if (ins instanceof INVOKESTATIC) { INVOKESTATIC invst = (INVOKESTATIC) ins; return invst.getSignature(cp); } else if (ins instanceof INVOKEVIRTUAL) { INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins; return invst.getSignature(cp); } else if (ins instanceof INVOKEINTERFACE) { INVOKEINTERFACE invst = (INVOKEINTERFACE) ins; return invst.getSignature(cp); } else if (ins instanceof INVOKESPECIAL) { INVOKESPECIAL invst = (INVOKESPECIAL) ins; return invst.getSignature(cp); } else { return null; } }
String methodDesc = is.getName(cpg) + is.getSignature(cpg); Set<String> fields = methodFieldModifiers.get(methodDesc); if (fields != null) {
Number n = null; if ("(I)V".equals(invoke.getSignature(cpg))) { n = ByteCode.getPushNumber(location.getHandle().getPrev()); else if ("(ILjava/security/SecureRandom;)V".equals(invoke.getSignature(cpg))) {
String methodDesc = is.getName(cpg) + is.getSignature(cpg); Set<String> fields = methodFieldModifiers.get(methodDesc); if (fields != null) {
Number n = null; if ("(I)V".equals(invoke.getSignature(cpg))) { n = ByteCode.getPushNumber(location.getHandle().getPrev()); else if ("(ILjava/security/SecureRandom;)V".equals(invoke.getSignature(cpg))) {
Number n = null; if ("(I)V".equals(invoke.getSignature(cpg))) { n = ByteCode.getPushNumber(location.getHandle().getPrev()); else if ("(ILjava/security/SecureRandom;)V".equals(invoke.getSignature(cpg))) {
String methodSig = invokeVirtual.getSignature(classContext.getConstantPoolGen()); if (!"close".equals(methodName)) { return false;
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */ @Override public void visitINVOKEVIRTUAL(final INVOKEVIRTUAL o) { try { // INVOKEVIRTUAL is a LoadClass; the Class where the referenced method is declared in, // is therefore resolved/verified. // INVOKEVIRTUAL is an InvokeInstruction, the argument and return types are resolved/verified, // too. So are the allowed method names. final String classname = o.getClassName(cpg); final JavaClass jc = Repository.lookupClass(classname); final Method m = getMethodRecursive(jc, o); if (m == null) { constraintViolated(o, "Referenced method '"+o.getMethodName(cpg)+"' with expected signature '"+ o.getSignature(cpg)+"' not found in class '"+jc.getClassName()+"'."); } if (! (jc.isClass())) { constraintViolated(o, "Referenced class '"+jc.getClassName()+"' is an interface, but not a class as expected."); } } catch (final ClassNotFoundException e) { // FIXME: maybe not the best way to handle this throw new AssertionViolatedException("Missing class: " + e, e); } }
String methodSig = iv.getSignature(cpg); if ("wait".equals(methodName) && ("()V".equals(methodSig) || "(J)V".equals(methodSig) || "(JI)V".equals(methodSig))
String methodSig = inv.getSignature(cpg);