private Object tryEvalAsMethod(Class<?> clazz,Object target,List<Object> args){
  Method method=findMethod(clazz,args);
  if (method == null) {
    return null;
  }
  try {
    return Values.ensureNotNull(location(),method.invoke(target,Values.convertArgs(location(),method.getParameterTypes(),args)));
  }
 catch (  IllegalAccessException|IllegalArgumentException e) {
    throw new EvalException(location(),"exception when accessing method '%s': %s.",name(),e.getMessage());
  }
catch (  InvocationTargetException e) {
    throw new EvalException(Issue.create(location(),"exception when invoking method '%s': %s.",name(),e.getCause()));
  }
}

private Object tryEvalAsMethod ( Class < ? > clazz , Object target , List < Object > args ) { Method method = findMethod ( clazz , args ) ; if ( method == null ) { return null ; } try { return Values . ensureNotNull ( location ( ) , method . invoke ( target , Values . convertArgs ( location ( ) , method . getParameterTypes ( ) , args ) ) ) ; } catch ( IllegalAccessException | IllegalArgumentException e ) { throw new EvalException ( location ( ) , "exception when accessing method '%s': %s." , name ( ) , e . getMessage ( ) ) ; } catch ( InvocationTargetException e ) { throw new EvalException ( Issue . create ( location ( ) , "exception when invoking method '%s': %s." , name ( ) , e . getCause ( ) ) ) ; } }
try to evaluate method .
