Use the isAnnotationPresent method for annotation presence checking

This commit is contained in:
Ruben Dijkstra 2014-12-02 18:22:53 +01:00
parent c1343214fc
commit 48a88a60ac

View File

@ -37,11 +37,8 @@ public class JPAProviderRule implements MethodRule {
}
private <T extends Annotation> boolean hasAnnotation(FrameworkMethod method, Class<T> clazz) {
T rv = method.getMethod().getAnnotation(clazz);
if (rv == null) {
rv = method.getMethod().getDeclaringClass().getAnnotation(clazz);
}
return rv != null;
return method.getMethod().isAnnotationPresent(clazz)
|| method.getMethod().getDeclaringClass().isAnnotationPresent(clazz);
}
}