@SuppressWarnings("unchecked")
List<AnnotationValue> eventHandlerAnnotationValues = (List<AnnotationValue>) eventHandlerAnnotationValue.getValue();
for (AnnotationValue av : eventHandlerAnnotationValues) {
String referencedFieldName = (String) av.getValue();
Element referencedField = getField(enclosingClassElement, referencedFieldName);
if (referencedField == null || (!types.isAssignable(referencedField.asType(), gwtWidgetType) &&!types.isAssignable(referencedField.asType(), gwtElementType))) {
processingEnv.getMessager().printMessage(
Kind.ERROR, "\"" + referencedFieldName + "\" must refer to a field of type Widget or Element. To reference template elements directly, use @SinkNative.",
target, eventHandlerAnnotation, av);
}
}