mirror of https://github.com/apache/openjpa.git
OPENJPA-2908 fix delayed collection proxies
some new methods in base interfaces did not get handled correctly
This commit is contained in:
parent
9a87badd3b
commit
6fc05e14d0
|
@ -350,9 +350,11 @@ public abstract class AbstractMetaDataDefaults
|
||||||
* user-defined.
|
* user-defined.
|
||||||
*/
|
*/
|
||||||
protected static boolean isUserDefined(Class<?> cls) {
|
protected static boolean isUserDefined(Class<?> cls) {
|
||||||
return cls != null && !cls.getName().startsWith("java.")
|
return cls != null
|
||||||
&& !cls.getName().startsWith ("javax.");
|
&& !cls.getName().startsWith("java.")
|
||||||
}
|
&& !cls.getName().startsWith ("javax.")
|
||||||
|
&& !cls.getName().startsWith ("jakarta.");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Affirms if the given method matches the following signature
|
* Affirms if the given method matches the following signature
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
import org.apache.openjpa.kernel.AutoDetach;
|
import org.apache.openjpa.kernel.AutoDetach;
|
||||||
import org.apache.openjpa.kernel.Broker;
|
import org.apache.openjpa.kernel.Broker;
|
||||||
|
@ -406,6 +407,14 @@ public class DelayedArrayListProxy extends ArrayList implements ProxyCollection,
|
||||||
return super.toArray(array);
|
return super.toArray(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] toArray(IntFunction generator) {
|
||||||
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
return super.toArray(generator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object paramObject) {
|
public boolean equals(Object paramObject) {
|
||||||
if (!_directAccess && isDelayLoad()) {
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
import org.apache.openjpa.kernel.AutoDetach;
|
import org.apache.openjpa.kernel.AutoDetach;
|
||||||
import org.apache.openjpa.kernel.Broker;
|
import org.apache.openjpa.kernel.Broker;
|
||||||
|
@ -276,6 +277,14 @@ public class DelayedHashSetProxy extends HashSet implements DelayedProxy, ProxyC
|
||||||
return super.toArray(a);
|
return super.toArray(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] toArray(IntFunction generator) {
|
||||||
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
return super.toArray(generator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsAll(Collection c) {
|
public boolean containsAll(Collection c) {
|
||||||
if (!_directAccess && isDelayLoad()) {
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
@ -284,6 +293,7 @@ public class DelayedHashSetProxy extends HashSet implements DelayedProxy, ProxyC
|
||||||
return super.containsAll(c);
|
return super.containsAll(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (!_directAccess && isDelayLoad()) {
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
import org.apache.openjpa.kernel.AutoDetach;
|
import org.apache.openjpa.kernel.AutoDetach;
|
||||||
import org.apache.openjpa.kernel.Broker;
|
import org.apache.openjpa.kernel.Broker;
|
||||||
|
@ -275,6 +276,14 @@ public class DelayedLinkedHashSetProxy extends LinkedHashSet implements DelayedP
|
||||||
return super.toArray(a);
|
return super.toArray(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] toArray(IntFunction generator) {
|
||||||
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
return super.toArray(generator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsAll(Collection c) {
|
public boolean containsAll(Collection c) {
|
||||||
if (!_directAccess && isDelayLoad()) {
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
import org.apache.openjpa.kernel.AutoDetach;
|
import org.apache.openjpa.kernel.AutoDetach;
|
||||||
import org.apache.openjpa.kernel.Broker;
|
import org.apache.openjpa.kernel.Broker;
|
||||||
|
@ -568,6 +569,14 @@ public class DelayedLinkedListProxy extends LinkedList implements ProxyCollectio
|
||||||
return super.toArray(array);
|
return super.toArray(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] toArray(IntFunction generator) {
|
||||||
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
return super.toArray(generator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object object) {
|
public boolean contains(Object object) {
|
||||||
if (!_directAccess && isDelayLoad()) {
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.PriorityQueue;
|
import java.util.PriorityQueue;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
import org.apache.openjpa.kernel.AutoDetach;
|
import org.apache.openjpa.kernel.AutoDetach;
|
||||||
import org.apache.openjpa.kernel.Broker;
|
import org.apache.openjpa.kernel.Broker;
|
||||||
|
@ -330,6 +331,14 @@ public class DelayedPriorityQueueProxy extends PriorityQueue implements ProxyCol
|
||||||
return super.toArray(array);
|
return super.toArray(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] toArray(IntFunction generator) {
|
||||||
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
return super.toArray(generator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsAll(Collection c) {
|
public boolean containsAll(Collection c) {
|
||||||
if (!_directAccess && isDelayLoad()) {
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Iterator;
|
||||||
import java.util.NavigableSet;
|
import java.util.NavigableSet;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
import org.apache.openjpa.kernel.AutoDetach;
|
import org.apache.openjpa.kernel.AutoDetach;
|
||||||
import org.apache.openjpa.kernel.Broker;
|
import org.apache.openjpa.kernel.Broker;
|
||||||
|
@ -315,6 +316,14 @@ public class DelayedTreeSetProxy extends TreeSet implements ProxyCollection, Del
|
||||||
return super.toArray(array);
|
return super.toArray(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] toArray(IntFunction generator) {
|
||||||
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
return super.toArray(generator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Comparator comparator() {
|
public Comparator comparator() {
|
||||||
if (!_directAccess && isDelayLoad()) {
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
import org.apache.openjpa.kernel.AutoDetach;
|
import org.apache.openjpa.kernel.AutoDetach;
|
||||||
import org.apache.openjpa.kernel.Broker;
|
import org.apache.openjpa.kernel.Broker;
|
||||||
|
@ -525,6 +526,14 @@ public class DelayedVectorProxy extends Vector implements ProxyCollection, Delay
|
||||||
return super.toArray(array);
|
return super.toArray(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] toArray(IntFunction generator) {
|
||||||
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
return super.toArray(generator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean equals(Object paramObject) {
|
public synchronized boolean equals(Object paramObject) {
|
||||||
if (!_directAccess && isDelayLoad()) {
|
if (!_directAccess && isDelayLoad()) {
|
||||||
|
|
|
@ -769,7 +769,7 @@ public class ConfigurationImpl
|
||||||
/**
|
/**
|
||||||
* Adds a prefix <code>"openjpa."</code> to the given key, if necessary. A key is
|
* Adds a prefix <code>"openjpa."</code> to the given key, if necessary. A key is
|
||||||
* considered without prefix if it starts neither of <code>"openjpa."</code>,
|
* considered without prefix if it starts neither of <code>"openjpa."</code>,
|
||||||
* <code>"java."</code> and <code>"javax."</code>.
|
* <code>"java."</code>, <code>"javax."</code> and {@code "jakarta."}.
|
||||||
*/
|
*/
|
||||||
String fixPrefix(String key) {
|
String fixPrefix(String key) {
|
||||||
return (key == null || hasKnownPrefix(key)) ? key : "openjpa."+key;
|
return (key == null || hasKnownPrefix(key)) ? key : "openjpa."+key;
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class ClassMetaDataIterator implements MetaDataIterator {
|
||||||
ClassLoader loader, boolean topDown) {
|
ClassLoader loader, boolean topDown) {
|
||||||
// skip classes that can't have metadata
|
// skip classes that can't have metadata
|
||||||
if (cls != null && (cls.isPrimitive()
|
if (cls != null && (cls.isPrimitive()
|
||||||
|
|| cls.getName().startsWith("jakarta.")
|
||||||
|| cls.getName().startsWith("java.")
|
|| cls.getName().startsWith("java.")
|
||||||
|| cls.getName().startsWith("javax."))) {
|
|| cls.getName().startsWith("javax."))) {
|
||||||
_loader = null;
|
_loader = null;
|
||||||
|
|
|
@ -55,7 +55,8 @@ public class TemporaryClassLoader extends ClassLoader {
|
||||||
// "sun." is required for JDK 1.4, which has an access check for
|
// "sun." is required for JDK 1.4, which has an access check for
|
||||||
// sun.reflect.GeneratedSerializationConstructorAccessor1
|
// sun.reflect.GeneratedSerializationConstructorAccessor1
|
||||||
if (name.startsWith("java.") || name.startsWith("javax.")
|
if (name.startsWith("java.") || name.startsWith("javax.")
|
||||||
|| name.startsWith("sun.") || name.startsWith("jdk.")) {
|
|| name.startsWith("sun.") || name.startsWith("jdk.")
|
||||||
|
|| name.startsWith("jakarta.") ) {
|
||||||
return Class.forName(name, resolve, getClass().getClassLoader());
|
return Class.forName(name, resolve, getClass().getClassLoader());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue