Hello,
Is there a way to override overloads for standard library?
Below is part of my code which is not getting the expected result.
@NotNullprivatestaticfinalOverloadOVERLOAD_MATCHES = Overload.binary(Overloads.MatchesString, (lhs, rhs) -> {
System.out.println("---override matches---");
Stringinst = (String) lhs.value();
Stringtarget = (String) rhs.value();
booleanresult = target.matches(inst);
returnresult ? BoolT.True : BoolT.False;
});
@TestpublicvoidtestMatchs() {
booleanresult1 = XrayCEL.eval("'1234'.matches(r'\\d+')");
System.out.println(result1); // output: truebooleanresult2 = XrayCEL.eval("r'\\d+'.matches('1234')");
System.out.println(result2); // output: false
}My override for matches is not be called, the log message are not be printed , it still used standard library's matches.
- Standard ->
string.matches(regexString) - Expected ->
regexString.matches(string)
Hello,
Is there a way to override overloads for standard library?
Below is part of my code which is not getting the expected result.
My override for
matchesis not be called, the log message are not be printed , it still used standard library'smatches.string.matches(regexString)regexString.matches(string)