#112 Raising descriptive exception in case a type couldn't be loaded by name

This commit is contained in:
Gunnar Morling 2014-01-28 22:13:05 +01:00
parent 768083039e
commit 6b28c161e9

View File

@ -35,7 +35,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
@ -96,6 +95,13 @@ public class TypeFactory {
public Type getType(String canonicalName) {
TypeElement typeElement = elementUtils.getTypeElement( canonicalName );
if ( typeElement == null ) {
throw new AnnotationProcessingException(
"Couldn't find type " + canonicalName + ". Are you missing a dependency on your classpath?"
);
}
return getType( typeElement );
}