diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeParser.java @ 20960:6fe8d8a248ba

Truffle-DSL: fix generic types are not unique in javac.
author Christian Humer <christian.humer@gmail.com>
date Wed, 15 Apr 2015 00:16:01 +0200
parents 833e088ee7d3
children 05a2b72c071f
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeParser.java	Tue Apr 14 23:13:47 2015 +0200
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeParser.java	Wed Apr 15 00:16:01 2015 +0200
@@ -1332,13 +1332,14 @@
 
         List<VariableElement> types = new ArrayList<>();
 
-        Set<TypeMirror> frameTypes = new HashSet<>();
+        Collection<TypeMirror> frameTypes = new HashSet<>();
         for (SpecializationData specialization : node.getSpecializations()) {
             if (specialization.getFrame() != null) {
                 frameTypes.add(specialization.getFrame().getType());
             }
         }
         if (!frameTypes.isEmpty()) {
+            frameTypes = ElementUtils.uniqueSortedTypes(frameTypes);
             TypeMirror frameType;
             if (frameTypes.size() == 1) {
                 frameType = frameTypes.iterator().next();
@@ -1359,7 +1360,7 @@
             if (!genericParameter.getSpecification().isSignature()) {
                 polymorphicType = genericParameter.getType();
             } else {
-                Set<TypeMirror> usedTypes = new HashSet<>();
+                Collection<TypeMirror> usedTypes = new HashSet<>();
                 for (SpecializationData specialization : node.getSpecializations()) {
                     if (specialization.isUninitialized()) {
                         continue;
@@ -1373,6 +1374,7 @@
                     }
                     usedTypes.add(parameter.getType());
                 }
+                usedTypes = ElementUtils.uniqueSortedTypes(usedTypes);
 
                 if (usedTypes.size() == 1) {
                     polymorphicType = usedTypes.iterator().next();