Only substantive change is flipping the order of the args in an

ImplHelper.isAssignable call in FetchConfigurationImpl.  We want to test 
whether the type we're traversing to is derived from the type we're traversing
from.



git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@508459 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
A. Abram White 2007-02-16 16:02:05 +00:00
parent 4efc5d6997
commit 8974a09908
3 changed files with 8 additions and 7 deletions

View File

@ -558,7 +558,7 @@ public class FetchConfigurationImpl
// see if there's a previous limit // see if there's a previous limit
int avail = Integer.MIN_VALUE; int avail = Integer.MIN_VALUE;
for (FetchConfigurationImpl f = this; f != null; f = f._parent) { for (FetchConfigurationImpl f = this; f != null; f = f._parent) {
if (ImplHelper.isAssignable(type, f._fromType)) { if (ImplHelper.isAssignable(f._fromType, type)) {
avail = f._availableRecursion; avail = f._availableRecursion;
if (traverse) if (traverse)
avail = reduce(avail); avail = reduce(avail);

View File

@ -205,11 +205,11 @@ public class ImplHelper {
* @return true if the "to" class is assignable to the "from" class * @return true if the "to" class is assignable to the "from" class
*/ */
public static boolean isAssignable(Class from, Class to) { public static boolean isAssignable(Class from, Class to) {
Boolean isAssignable = null;
if (from == null || to == null) if (from == null || to == null)
return false; return false;
Map assignableTo = (Map) _assignableTypes.get(from);
Boolean isAssignable = null;
Map assignableTo = (Map) _assignableTypes.get(from);
if (assignableTo == null) { // "to" cache doesn't exist, so create it... if (assignableTo == null) { // "to" cache doesn't exist, so create it...
assignableTo = new ConcurrentHashMap(); assignableTo = new ConcurrentHashMap();
_assignableTypes.put(from, assignableTo); _assignableTypes.put(from, assignableTo);
@ -218,7 +218,7 @@ public class ImplHelper {
} }
if (isAssignable == null) {// we don't have a record of this pair... if (isAssignable == null) {// we don't have a record of this pair...
isAssignable = new Boolean(from.isAssignableFrom(to)); isAssignable = Boolean.valueOf(from.isAssignableFrom(to));
assignableTo.put(to, isAssignable); assignableTo.put(to, isAssignable);
} }

View File

@ -28,15 +28,16 @@ import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap;
public abstract class OpenJPAId public abstract class OpenJPAId
implements Comparable, Serializable { implements Comparable, Serializable {
// cache the types' generated hashcodes
private static ConcurrentReferenceHashMap _typeCache =
new ConcurrentReferenceHashMap(ReferenceMap.WEAK, ReferenceMap.HARD);
protected Class type; protected Class type;
protected boolean subs = true; protected boolean subs = true;
// type has his based on the least-derived non-object class so that // type has his based on the least-derived non-object class so that
// user-given ids with non-exact types match ids with exact types // user-given ids with non-exact types match ids with exact types
private transient int _typeHash = 0; private transient int _typeHash = 0;
// cache the types' generated hashcodes
private static ConcurrentReferenceHashMap _typeCache =
new ConcurrentReferenceHashMap(ReferenceMap.WEAK, ReferenceMap.HARD);
protected OpenJPAId() { protected OpenJPAId() {
} }