@Override public void validate(Body body, List<ValidationException> exceptions) { SootMethod method = body.getMethod(); if (method != null) { if (!method.getReturnType().isAllowedInFinalCode()) { exceptions.add(new ValidationException(method, "Return type not allowed in final code: " + method.getReturnType(), "return type not allowed in final code:" + method.getReturnType() + "\n method: " + method)); } for (Type t : method.getParameterTypes()) { if (!t.isAllowedInFinalCode()) { exceptions.add(new ValidationException(method, "Parameter type not allowed in final code: " + t, "parameter type not allowed in final code:" + t + "\n method: " + method)); } } } for (Local l : body.getLocals()) { Type t = l.getType(); if (!t.isAllowedInFinalCode()) { exceptions.add(new ValidationException(l, "Local type not allowed in final code: " + t, "(" + method + ") local type not allowed in final code: " + t + " local: " + l)); } } }
@Override public void validate(SootClass sc, List<ValidationException> exceptions) { if (sc.isConcrete()) { for (SootMethod sm : sc.getMethods()) { for (Type tp : sm.getParameterTypes()) { if (tp == null) { exceptions.add(new ValidationException(sm, "Null parameter types are invalid")); } if (tp instanceof VoidType) { exceptions.add(new ValidationException(sm, "Void parameter types are invalid")); } if (!tp.isAllowedInFinalCode()) { exceptions.add(new ValidationException(sm, "Parameter type not allowed in final code")); } } } } }