changeset 12590:ce82cdbffe47

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 16 Oct 2013 21:44:51 +0200
parents f1b7b7d2dad5 (current diff) ce4836e0212d (diff)
children 33fe56e68abd
files
diffstat 2 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/Utils.java	Wed Oct 16 17:26:51 2013 +0200
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/Utils.java	Wed Oct 16 21:44:51 2013 +0200
@@ -400,7 +400,19 @@
     }
 
     public static String getQualifiedName(TypeElement element) {
-        return element.getQualifiedName().toString();
+        String qualifiedName = element.getQualifiedName().toString();
+        if (qualifiedName.contains("$")) {
+            /*
+             * If a class gets loaded in its binary form by the ECJ compiler it fails to produce the
+             * proper canonical class name. It leaves the $ in the qualified name of the class. So
+             * one instance of a TypeElement may be loaded in binary and one in source form. The
+             * current type comparison in #typeEquals compares by the qualified name so the
+             * qualified name must match. This is basically a hack to fix the returned qualified
+             * name of eclipse.
+             */
+            qualifiedName = qualifiedName.replace('$', '.');
+        }
+        return qualifiedName;
     }
 
     public static String getQualifiedName(TypeMirror mirror) {
@@ -866,6 +878,8 @@
             return true;
         } else if (type1 == null || type2 == null) {
             return false;
+        } else if (type1 == type2) {
+            return true;
         }
         String qualified1 = getQualifiedName(type1);
         String qualified2 = getQualifiedName(type2);
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/ImplicitCastData.java	Wed Oct 16 17:26:51 2013 +0200
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/ImplicitCastData.java	Wed Oct 16 21:44:51 2013 +0200
@@ -45,13 +45,14 @@
 
     @Override
     public int compareTo(TemplateMethod o) {
-        if (o instanceof ImplicitCastData) {
+        if (o instanceof ImplicitCastData && sourceType != null) {
             // implicit casts are ordered by source type since
             // its also the order in which they are checked.
             TypeData otherSourceType = ((ImplicitCastData) o).getSourceType();
-            return this.sourceType.compareTo(otherSourceType);
+            if (otherSourceType != null) {
+                return this.sourceType.compareTo(otherSourceType);
+            }
         }
         return super.compareTo(o);
     }
-
 }