Buggy code:
public class Members { public abstract static class Member < X , Y > implements Comparable < Members . Member < X , Y > > , Attribute < X , Y > { public final AbstractManagedType < X > owner ; public final FieldMetaData fmd ; protected Member ( AbstractManagedType < X > owner , FieldMetaData fmd ) { } public final ManagedType < X > getDeclaringType ( ) { <START_BUG> return owner . model . type ( fmd . getDeclaringType ( ) ) ; <END_BUG> } public final java . lang . reflect . Member getJavaMember ( ) { } public final Class < Y > getJavaType ( ) { } public final String getName ( ) { } public final Type < Y > getType ( ) { } public final boolean isAssociation ( ) { } public final boolean isCollection ( ) { } public PersistentAttributeType getPersistentAttributeType ( ) { } public int compareTo ( Members . Member < X , Y > o ) { } } public static final class SingularAttributeImpl < X , T > extends Members . Member < X , T > implements SingularAttribute < X , T > { public SingularAttributeImpl ( AbstractManagedType < X > owner , FieldMetaData fmd ) { } public boolean isId ( ) { } public boolean isVersion ( ) { } public boolean isOptional ( ) { } public final BindableType getBindableType ( ) { } public final Class < T > getBindableJavaType ( ) { } public final PersistentAttributeType getPersistentAttributeType ( ) { } } public abstract static class PluralAttributeImpl < X , C , E > extends Members . Member < X , C > implements PluralAttribute < X , C , E > { public PluralAttributeImpl ( AbstractManagedType < X > owner , FieldMetaData fmd ) { } public final Type < E > getElementType ( ) { } public final BindableType getBindableType ( ) { } public Class < E > getBindableJavaType ( ) { } public PersistentAttributeType getPersistentAttributeType ( ) { } } public static class CollectionAttributeImpl < X , E > extends Members . PluralAttributeImpl < X , Collection < E > , E > implements CollectionAttribute < X , E > { public CollectionAttributeImpl ( AbstractManagedType < X > owner , FieldMetaData fmd ) { } public CollectionType getCollectionType ( ) { } } public static class ListAttributeImpl < X , E > extends Members . PluralAttributeImpl < X , List < E > , E > implements ListAttribute < X , E > { public ListAttributeImpl ( AbstractManagedType < X > owner , FieldMetaData fmd ) { } public CollectionType getCollectionType ( ) { } } public static class SetAttributeImpl < X , E > extends Members . PluralAttributeImpl < X , Set < E > , E > implements SetAttribute < X , E > { public SetAttributeImpl ( AbstractManagedType < X > owner , FieldMetaData fmd ) { } public CollectionType getCollectionType ( ) { } } public static class KeyAttributeImpl < X , K > extends Members . SetAttributeImpl < X , K > { public KeyAttributeImpl ( AbstractManagedType < X > owner , FieldMetaData fmd ) { } public Class < K > getBindableJavaType ( ) { } } public static class MapAttributeImpl < X , K , V > extends Members . PluralAttributeImpl < X , Map < K , V > , V > implements MapAttribute < X , K , V > { public MapAttributeImpl ( AbstractManagedType < X > owner , FieldMetaData fmd ) { } public CollectionType getCollectionType ( ) { } public Class < K > getKeyJavaType ( ) { } public Type < K > getKeyType ( ) { } public PersistentAttributeType getPersistentAttributeType ( ) { } } }

Fix:
return owner . model . managedType ( fmd . getDeclaringType ( ) ) ;