Mercurial > hg > truffle
changeset 8453:ce7aae2d4fc7
Fixed type variables should be erased before comparing types in MethodSubstiutionVerifier.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 22 Mar 2013 16:02:43 +0100 |
parents | 9208719445e2 |
children | fec5ebd058b7 |
files | graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/MethodSubstitutionVerifier.java |
diffstat | 1 files changed, 4 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/MethodSubstitutionVerifier.java Fri Mar 22 15:09:53 2013 +0100 +++ b/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/MethodSubstitutionVerifier.java Fri Mar 22 16:02:43 2013 +0100 @@ -186,16 +186,10 @@ return originalMethod; } - private static boolean isTypeCompatible(TypeMirror originalType, TypeMirror substitutionType) { - /* - * TypeMirrors may contain generic types which deny the types to be equal. So if both types - * are declared we erase the generic types by comparing their corresponding declared - * element. - */ - if (originalType.getKind() == TypeKind.DECLARED && substitutionType.getKind() == TypeKind.DECLARED) { - return ((DeclaredType) originalType).asElement().equals(((DeclaredType) substitutionType).asElement()); - } - return originalType.equals(substitutionType); + private boolean isTypeCompatible(TypeMirror originalType, TypeMirror substitutionType) { + TypeMirror original = env.getTypeUtils().erasure(originalType); + TypeMirror substitution = env.getTypeUtils().erasure(substitutionType); + return env.getTypeUtils().isSameType(original, substitution); } private static TypeElement findEnclosingClass(Element element) {