the goal is to be able to unify the following methods (in LoxNativeClass):
static LoxString assertString(LoxInstance instance) {
assert (instance instanceof LoxString)
: "instance was expected to be a LoxString";
return (LoxString)instance;
}
static LoxList assertList(LoxInstance instance) {
assert (instance instanceof LoxList)
: "instance was expected to be a LoxList";
return (LoxList)instance;
}
but using generics directly doesn't seem to work due to generic type erasure.
the goal is to be able to unify the following methods (in
LoxNativeClass
):but using generics directly doesn't seem to work due to generic type erasure.