DATACMNS-441 - Fixed potential NullPointerException in query method detection on Java 8 compiled code.

We now skip bridge methods for query method processing in order to circumvent the changed behavior of Class#getMethods() in Java 8 (when the code was compiled with target byte code level 1.8). On Java 8 this results in bridge methods being found and inspected for query method annotations. Since we currently cannot analyze generic return types of bridge methods this results in NullPointerExceptions being thrown at a later stage in AbstractRepositoryMetadata#getReturnedDomainClass(…).

Original pull request: #64.
Related issue: DATAJPA-465.
This commit is contained in:
Thomas Darimont
2014-02-18 14:55:50 +01:00
committed by Oliver Gierke
parent 931a697ec5
commit f047cce7c3
2 changed files with 25 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2013 the original author or authors.
* Copyright 2011-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -172,7 +172,8 @@ class DefaultRepositoryInformation implements RepositoryInformation {
* @return
*/
private boolean isQueryMethodCandidate(Method method) {
return isQueryAnnotationPresentOn(method) || !isCustomMethod(method) && !isBaseClassMethod(method);
return !method.isBridge() //
&& (isQueryAnnotationPresentOn(method) || !isCustomMethod(method) && !isBaseClassMethod(method));
}
/**