public final class ArityException extends InteropException
Modifier and Type | Method and Description |
---|---|
static ArityException |
create(int expectedMinArity,
int expectedMaxArity,
int actualArity)
Creates an
ArityException to indicate that the wrong number of arguments were
provided. |
static ArityException |
create(int expectedMinArity,
int expectedMaxArity,
int actualArity,
Throwable cause)
Creates an
ArityException to indicate that the wrong number of arguments were
provided. |
int |
getActualArity()
Returns the actual number of arguments provided by the foreign access.
|
int |
getExpectedMaxArity()
Returns the maximum number of arguments that are expected.
|
int |
getExpectedMinArity()
Returns the minimum number of arguments that are expected.
|
String |
getMessage() |
fillInStackTrace, getCause
addSuppressed, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public String getMessage()
getMessage
in class Throwable
public int getExpectedMinArity()
public int getExpectedMaxArity()
public int getActualArity()
public static ArityException create(int expectedMinArity, int expectedMaxArity, int actualArity)
ArityException
to indicate that the wrong number of arguments were
provided. Throws an IllegalArgumentException
if the arguments are invalid and
assertions (-ea) are enabled.
This method is designed to be used in compiled
code paths.
expectedMinArity
- (inclusive) the minimum number of arguments expected by the
executable. Must be greater or equal to zero.expectedMaxArity
- (inclusive) the maximum number of arguments expected by the
executable. If the maximum is negative then an infinite number of arguments is
expected. If the number is positive then the maximum must be greater or equal to
expectedMinArity
.actualArity
- the number of provided by the executable. The actual arity must not be
within range of the expected min and max arity.public static ArityException create(int expectedMinArity, int expectedMaxArity, int actualArity, Throwable cause)
ArityException
to indicate that the wrong number of arguments were
provided. Throws an IllegalArgumentException
if the arguments are invalid and
assertions (-ea) are enabled.
In addition a cause may be provided. The cause should only be set if the guest language code
caused this problem. An example for this is a language specific proxy mechanism that invokes
guest language code to describe an object. If the guest language code fails to execute and
this interop exception is a valid interpretation of the error, then the error should be
provided as cause. The cause can then be used by the source language as new exception cause
if the InteropException
is translated to a source language error. If the
InteropException
is discarded, then the cause will most likely get discarded by the
source language as well. Note that the cause must be of type
AbstractTruffleException
otherwise an
IllegalArgumentException
is thrown.
This method is designed to be used in compiled
code paths.
expectedMinArity
- (inclusive) the minimum number of arguments expected by the
executable. Must be greater or equal to zero.expectedMaxArity
- (inclusive) the maximum number of arguments expected by the
executable. If the maximum is negative then an infinite number of arguments is
expected. If the number is positive then the maximum must be greater or equal to
expectedMinArity
.actualArity
- the number of provided by the executable. The actual arity must not be
within range of the expected min and max arity.cause
- the guest language exception that caused the error.