*
* @param union the Union to return the common type for
* @return the common SimpleType for the Union.
*/
private static SimpleType findCommonType(Union union) {
SimpleType common = null;
Enumeration enumeration = union.getMemberTypes();
while (enumeration.hasMoreElements()) {
SimpleType type = (SimpleType)enumeration.nextElement();
type = type.getBuiltInBaseType();
if (common == null) common = type;
else {
common = compare(common, type);
//-- no common types
if (common == null) break;