Explicit exclusion of bridge methods in annotation post-processors (for Java 8 compatibility)

Issue: SPR-12187
(cherry picked from commit f4219ca)
This commit is contained in:
Juergen Hoeller
2014-09-18 23:45:42 +02:00
parent 60d5ff8dd5
commit 29abca5399
3 changed files with 64 additions and 5 deletions

View File

@@ -402,7 +402,7 @@ public class PersistenceAnnotationBeanPostProcessor
for (Method method : targetClass.getDeclaredMethods()) {
PersistenceContext pc = method.getAnnotation(PersistenceContext.class);
PersistenceUnit pu = method.getAnnotation(PersistenceUnit.class);
if ((pc != null || pu != null) &&
if ((pc != null || pu != null) && !method.isBridge() &&
method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
if (Modifier.isStatic(method.getModifiers())) {
throw new IllegalStateException("Persistence annotations are not supported on static methods");