Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java @ 18770:2c669386b5d0
Truffle-DSL: fix crash if type in rewriteOn is not of type Throwable. Improved error messages for Specialization#rewriteOn.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 02 Jan 2015 14:31:51 +0100 |
parents | a665483c3881 |
children | c0fb70634640 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java Wed Dec 31 17:35:10 2014 +0000 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java Fri Jan 02 14:31:51 2015 +0100 @@ -988,9 +988,7 @@ } // search for any super types - TypeElement exceptionTypeElement = fromTypeMirror(exceptionType); - List<TypeElement> superTypes = getSuperTypes(exceptionTypeElement); - for (TypeElement typeElement : superTypes) { + for (TypeElement typeElement : getSuperTypes(fromTypeMirror(exceptionType))) { if (ElementUtils.containsType(thrownTypes, typeElement.asType())) { return true; } @@ -1022,11 +1020,7 @@ private static boolean isRuntimeException(TypeMirror type) { Set<String> typeSuperSet = new HashSet<>(getQualifiedSuperTypeNames(fromTypeMirror(type))); - String typeName = getQualifiedName(type); - if (!typeSuperSet.contains(Throwable.class.getCanonicalName()) && !typeName.equals(Throwable.class.getCanonicalName())) { - throw new IllegalArgumentException("Given type does not extend Throwable."); - } - return typeSuperSet.contains(RuntimeException.class.getCanonicalName()) || typeName.equals(RuntimeException.class.getCanonicalName()); + return typeSuperSet.contains(RuntimeException.class.getCanonicalName()) || getQualifiedName(type).equals(RuntimeException.class.getCanonicalName()); } private static boolean containsType(Collection<? extends TypeMirror> collection, TypeMirror type) {