public static <T extends Annotation> T methodFindAnnotation(MethodSignature sig, Class<T> annotation) { try { Method m = asmMethodSignatureToReflectionMethod(sig); return m.getAnnotation(annotation); } catch (ClassNotFoundException | NoSuchMethodException e) { e.printStackTrace(); return null; } } }
@Override public OperationSideEffect isMethodSafe(MethodSignature m, TypedValue base, List<TypedValue> args) { if (metamodel.isSafeMethod(m)) { return OperationSideEffect.NONE; } else { // Use reflection to get info about the method (or would it be better // to do this through direct bytecode inspection?) try { Method reflectedMethod = Annotations.asmMethodSignatureToReflectionMethod(m); return Annotations.methodHasSomeAnnotations(reflectedMethod, metamodel.getSafeMethodAnnotations()) ? OperationSideEffect.NONE : OperationSideEffect.UNSAFE; } catch (ClassNotFoundException|NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } return OperationSideEffect.UNSAFE; } }
@Override public OperationSideEffect isMethodSafe(MethodSignature m, TypedValue base, List<TypedValue> args) { if (metamodel.isSafeMethod(m)) { return OperationSideEffect.NONE; } else { // Use reflection to get info about the method (or would it be better // to do this through direct bytecode inspection?) try { Method reflectedMethod = Annotations.asmMethodSignatureToReflectionMethod(m); return Annotations.methodHasSomeAnnotations(reflectedMethod, metamodel.getSafeMethodAnnotations()) ? OperationSideEffect.NONE : OperationSideEffect.UNSAFE; } catch (ClassNotFoundException|NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } return OperationSideEffect.UNSAFE; } }