Source:
Object call(Object obj, Object[] args, @Nullable Mutability mu) throws EvalException, InterruptedException { Preconditions.checkNotNull(obj); Object result; try { result = method.invoke(obj, args); } catch (IllegalAccessException ex) { throw new IllegalStateException(ex); } catch (IllegalArgumentException ex) { StringBuilder buf = new StringBuilder(); buf.append( String.format( "IllegalArgumentException (%s) in Starlark call of %s, obj=%s (%s), args=[", ex.getMessage(), method, Starlark.repr(obj), Starlark.type(obj))); String sep = ""; for (Object arg : args) { buf.append(String.format("%s%s (%s)", sep, Starlark.repr(arg), Starlark.type(arg))); sep = ", "; } buf.append(']'); throw new IllegalArgumentException(buf.toString()); } catch (InvocationTargetException ex) { Throwable e = ex.getCause(); if (e == null) { throw new IllegalStateException(e); } Throwables.throwIfUnchecked(e); if (e instanceof EvalException) { throw (EvalException) e; } else if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { throw new EvalException(e); } } switch (howToHandleReturn) { case RETURN_NONE: return Starlark.NONE; case NULL_TO_NONE: return result != null ? result : Starlark.NONE; case ERROR_ON_NULL: { if (result == null) { throw methodInvocationReturnedNull(args); } return result; } case RETURN: return result; case STARLARK_INT_OF_INT: return StarlarkInt.of((Integer) result); case FROM_JAVA: { if (result == null && !isAllowReturnNones()) { throw methodInvocationReturnedNull(args); } return Starlark.fromJava(result, mu); } default: throw new AssertionError("unreachable: " + howToHandleReturn); } }

Target:
Object call(Object obj, Object[] args, @Nullable Mutability mu) throws EvalException, InterruptedException { Preconditions.checkNotNull(obj); Object result; try { result = method.invoke(obj, args); } catch (IllegalAccessException ex) { throw new IllegalStateException(ex); } catch (IllegalArgumentException ex) { StringBuilder buf = new StringBuilder(); buf.append( String.format( "IllegalArgumentException (%s) in Starlark call of %s, obj=%s (%s), args=[", ex.getMessage(), method, Starlark.repr(obj), Starlark.type(obj))); String sep = ""; for (Object arg : args) { buf.append(String.format("%s%s (%s)", sep, Starlark.repr(arg), Starlark.type(arg))); sep = ", "; } buf.append(']'); throw new IllegalArgumentException(buf.toString()); } catch (InvocationTargetException ex) { Throwable e = ex.getCause(); if (e == null) { throw new IllegalStateException(e); } Throwables.throwIfUnchecked(e); if (e instanceof EvalException) { throw (EvalException) e; } else if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { throw new EvalException(e); } } switch (howToHandleReturn) { case NULL_TO_NONE: return result != null ? result : Starlark.NONE; case ERROR_ON_NULL: { if (result == null) { throw methodInvocationReturnedNull(args); } return result; } case STARLARK_INT_OF_INT: return StarlarkInt.of((Integer) result); case FROM_JAVA: { if (result == null && !isAllowReturnNones()) { throw methodInvocationReturnedNull(args); } return Starlark.fromJava(result, mu); } default: throw new AssertionError("unreachable: " + howToHandleReturn); } }