mirror of https://github.com/apache/openjpa.git
OPENJPA-2492. Committing a variation of the patch as provided by Romain Manni-Bucau. This patch clears up the ConcurrentHashMap issues relating to the KeySetView return type. This patch also adds a couple of asserts to an existing testcase to verify the results.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1589187 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8aa54b6989
commit
b664f187d3
|
@ -1331,6 +1331,9 @@ public class ProxyManagerImpl
|
|||
Method match;
|
||||
Method after;
|
||||
for (int i = 0; i < meths.length; i++) {
|
||||
// Java 8 methods with a return type of KeySetView do not need to be proxied
|
||||
if (meths[i].getReturnType().getName().contains("KeySetView")) continue;
|
||||
|
||||
params = toHelperParameters(meths[i].getParameterTypes(),
|
||||
proxyType);
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@ public class ProxyMaps
|
|||
*/
|
||||
public static boolean beforeGet(ProxyMap map, Object key) {
|
||||
assertAllowedType(key, map.getKeyType());
|
||||
return map.containsKey(key);
|
||||
// Java 8 solution/workaround due to containsKey() calling get!=null, which could cause infinite loop
|
||||
return map.keySet().contains(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,5 +44,8 @@ public class TestConcurrentMap extends SingleEMTestCase {
|
|||
right.getLeftEntityMap().put(left.getStrData(), left);
|
||||
|
||||
em.getTransaction().commit();
|
||||
|
||||
assertEquals(1, right.getLeftEntityMap().size());
|
||||
assertEquals(1, right.getLeftEntityMap().get(left.getStrData()).getId());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue