Try to fix attribute generation order - because POI is generating getter/setter for id attributes (long and/or string) in wrong order

git-svn-id: https://svn.apache.org/repos/asf/xmlbeans/trunk@1881518 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java b/src/main/java/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java
index 20d8ae1..902cba6 100644
--- a/src/main/java/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java
@@ -24,6 +24,7 @@
 import javax.xml.namespace.QName;
 import java.math.BigInteger;
 import java.util.*;
+import java.util.function.BinaryOperator;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -1382,9 +1383,13 @@
         list.add(part);
     }
 
+    private static <T> BinaryOperator<T> throwingMerger() {
+        return (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); };
+    }
+
     static Map<QName, SchemaProperty> buildAttributePropertyModelByQName(SchemaAttributeModel attrModel, SchemaType owner) {
         return Stream.of(attrModel.getAttributes())
-            .collect(Collectors.toMap(SchemaLocalAttribute::getName, a -> buildUseProperty(a, owner)));
+            .collect(Collectors.toMap(SchemaLocalAttribute::getName, a -> buildUseProperty(a, owner), throwingMerger(), LinkedHashMap::new));
     }
 
     static Map<QName, SchemaProperty> buildContentPropertyModelByQName(SchemaParticle part, SchemaType owner) {