# HG changeset patch # User Christian Humer # Date 1381940831 -7200 # Node ID 8970574702a41ff485c0c9d2503ae5b0161dc039 # Parent 5f022aa4163162a350e049aa4f63d56a75b4edef Truffle-DSL: fixed type comparison of inner classes fails with ECJ when class was loaded from binary file. diff -r 5f022aa41631 -r 8970574702a4 graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/Utils.java --- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/Utils.java Wed Oct 16 18:25:16 2013 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/Utils.java Wed Oct 16 18:27:11 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);