mirror of https://github.com/apache/openjpa.git
OPENJPA-2305: Canonical MetaModel class generation should not use inhertence - applied Pinaki's trunk changes to 2.1.x.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.1.x@1469090 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d3c68ad3bb
commit
59322050ed
|
@ -238,6 +238,9 @@ class PathImpl<Z,X> extends ExpressionImpl<X> implements Path<X> {
|
|||
* Gets a new path that represents the given single-valued attribute from this path.
|
||||
*/
|
||||
public <Y> Path<Y> get(SingularAttribute<? super X, Y> attr) {
|
||||
if (getType() != attr.getDeclaringType()) {
|
||||
attr = (SingularAttribute)((ManagedType)getType()).getAttribute(attr.getName());
|
||||
}
|
||||
return new PathImpl<X,Y>(this, (Members.SingularAttributeImpl<? super X, Y>)attr, attr.getJavaType());
|
||||
}
|
||||
|
||||
|
@ -245,6 +248,9 @@ class PathImpl<Z,X> extends ExpressionImpl<X> implements Path<X> {
|
|||
* Gets a new path that represents the given multi-valued attribute from this path.
|
||||
*/
|
||||
public <E, C extends java.util.Collection<E>> Expression<C> get(PluralAttribute<X, C, E> coll) {
|
||||
if (getType() != coll.getDeclaringType()) {
|
||||
coll = (PluralAttribute)((ManagedType)getType()).getAttribute(coll.getName());
|
||||
}
|
||||
return new PathImpl<X,C>(this, (Members.PluralAttributeImpl<? super X, C, E>)coll, coll.getJavaType());
|
||||
}
|
||||
|
||||
|
@ -252,6 +258,9 @@ class PathImpl<Z,X> extends ExpressionImpl<X> implements Path<X> {
|
|||
* Gets a new path that represents the given map-valued attribute from this path.
|
||||
*/
|
||||
public <K, V, M extends java.util.Map<K, V>> Expression<M> get(MapAttribute<X, K, V> map) {
|
||||
if (getType() != map.getDeclaringType()) {
|
||||
map = (MapAttribute)((ManagedType)getType()).getAttribute(map.getName());
|
||||
}
|
||||
return new PathImpl<X,M>(this, (Members.MapAttributeImpl<? super X,K,V>)map, (Class<M>)map.getJavaType());
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@ import org.apache.openjpa.persistence.util.SourceCode;
|
|||
"openjpa.header",
|
||||
"openjpa.metamodel"
|
||||
})
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
|
||||
public class AnnotationProcessor6 extends AbstractProcessor {
|
||||
private SourceAnnotationHandler handler;
|
||||
|
|
|
@ -41,6 +41,7 @@ import javax.lang.model.element.TypeElement;
|
|||
import javax.lang.model.element.VariableElement;
|
||||
import javax.lang.model.type.ArrayType;
|
||||
import javax.lang.model.type.DeclaredType;
|
||||
import javax.lang.model.type.NoType;
|
||||
import javax.lang.model.type.PrimitiveType;
|
||||
import javax.lang.model.type.TypeKind;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
|
@ -642,11 +643,11 @@ public class SourceAnnotationHandler
|
|||
}
|
||||
|
||||
public TypeElement getPersistentSupertype(TypeElement cls) {
|
||||
if (cls == null) return null;
|
||||
TypeMirror sup = cls.getSuperclass();
|
||||
if (sup == null || isRootObject(sup))
|
||||
if (sup == null || sup.getKind() == TypeKind.NONE || isRootObject(sup))
|
||||
return null;
|
||||
TypeElement supe =
|
||||
(TypeElement) processingEnv.getTypeUtils().asElement(sup);
|
||||
TypeElement supe = (TypeElement) processingEnv.getTypeUtils().asElement(sup);
|
||||
if (isAnnotatedAsEntity(supe))
|
||||
return supe;
|
||||
return getPersistentSupertype(supe);
|
||||
|
|
Loading…
Reference in New Issue