The DefaultStackTraceElementObject.getExecutableName
breaks the contract of InteropLibrary
#7359
Labels
DefaultStackTraceElementObject.getExecutableName
breaks the contract of InteropLibrary
#7359
I've been encountering this issue running the
OpenJDK Runtime Environment GraalVM CE 17.0.7+7.1 (build 17.0.7+7-jvmci-23.0-b12)
version, but I can confirm that it is still present in the latest sources on themaster
branch.graal/truffle/src/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/InteropLibrary.java
Lines 274 to 297 in f2bd761
The contract of
InteropLibrary
says that if the receiver has no executable name (i.e.hasExecutableName(receiver) == false
), thengetExecutableName
throwsUnsupportedMessageException
. It also says that otherwise, "The return value is an interop value that is guaranteed to returntrue
forisString
".However, the code for
DefaultStackTraceElementObject
violates this contract:graal/truffle/src/com.oracle.truffle.api.exception/src/com/oracle/truffle/api/exception/DefaultStackTraceElementObject.java
Lines 53 to 74 in f2bd761
When the
rootNode.getName() == null
, it does reporthasExecutableName
to befalse
, but asking for it, instead of throwingUnsupportedMessageException
as required by contract, it returnsnull
- which is not an interop value that "is guaranteed to returntrue
forisString
".Thus code relying on the contract of
InteropLibrary
, assuming thatgetExecutableName
either returns a valid text value or throws an exception, breaks when it encounters aDefaultStackTraceElementObject
whoserootNode.getName() == null
.The text was updated successfully, but these errors were encountered: