I am not really familiar with this project, but I assume it should check for numArgs >= 2 (instead of == 2)?
Otherwise the calculation numArgs-2 in the error message is redundant because it would always be 0.
It might also be good to throw a more specific exception, e.g. IllegalArgumentException.
(Same for the other methods throwing RuntimeException when illegal arguments are provided)
It appears the argument validation logic in
RuntimeUtils.msg(...)
might be faulty: https://github.com/shannah/Java-Objective-C-Bridge/blob/473221aeef8f12ca9a659d899f3ca7092aed27ef/src/main/java/ca/weblite/objc/RuntimeUtils.java#L587-L589I am not really familiar with this project, but I assume it should check for
numArgs >= 2
(instead of== 2
)? Otherwise the calculationnumArgs-2
in the error message is redundant because it would always be 0.It might also be good to throw a more specific exception, e.g.
IllegalArgumentException
. (Same for the other methods throwingRuntimeException
when illegal arguments are provided)