Mercurial > hg > graal-compiler
changeset 8442:580e876394e1
Fixed substitution verifier emitted wrong error.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 22 Mar 2013 15:09:38 +0100 |
parents | 2d0160c35f8f |
children | 9208719445e2 |
files | graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/ClassSubstitutionVerifier.java |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/ClassSubstitutionVerifier.java Fri Mar 22 13:18:12 2013 +0100 +++ b/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/ClassSubstitutionVerifier.java Fri Mar 22 15:09:38 2013 +0100 @@ -71,16 +71,19 @@ TypeMirror type = resolveAnnotationValue(TypeMirror.class, typeValue); String className = resolveAnnotationValue(String.class, stringValue); boolean optional = resolveAnnotationValue(Boolean.class, optionalValue); - if (!classSubstition.getAnnotationType().equals(type)) { + + if (type.getKind() != TypeKind.DECLARED) { + env.getMessager().printMessage(Kind.ERROR, "The provided class must be a declared type.", sourceElement, classSubstition, typeValue); + return null; + } + + if (!classSubstition.getAnnotationType().asElement().equals(((DeclaredType) type).asElement())) { if (!className.equals(STRING_VALUE_DEFAULT)) { String msg = "The usage of value and className is exclusive."; env.getMessager().printMessage(Kind.ERROR, msg, sourceElement, classSubstition, stringValue); env.getMessager().printMessage(Kind.ERROR, msg, sourceElement, classSubstition, typeValue); } - if (type.getKind() != TypeKind.DECLARED) { - env.getMessager().printMessage(Kind.ERROR, "The provided class must be a declared type.", sourceElement, classSubstition, typeValue); - return null; - } + return (TypeElement) ((DeclaredType) type).asElement(); }