Skip to content

Commit 012ab8d

Browse files
committed
Use shouldNotReachHere() instead of RuntimeException
1 parent f21fb1e commit 012ab8d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/truffleruby/cext/UnwrapNode.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import static org.truffleruby.cext.ValueWrapperManager.TRUE_HANDLE;
1414
import static org.truffleruby.cext.ValueWrapperManager.UNDEF_HANDLE;
1515

16+
import com.oracle.truffle.api.CompilerDirectives;
1617
import org.truffleruby.RubyContext;
1718
import org.truffleruby.RubyLanguage;
1819
import org.truffleruby.cext.UnwrapNodeGen.NativeToWrapperNodeGen;
@@ -88,15 +89,15 @@ protected Object unwrapTaggedObject(long handle,
8889

8990
@TruffleBoundary
9091
private void raiseError(long handle) {
91-
throw new RuntimeException("dead handle 0x" + Long.toHexString(handle));
92+
throw CompilerDirectives.shouldNotReachHere("dead handle 0x" + Long.toHexString(handle));
9293
}
9394

9495
@Fallback
9596
@TruffleBoundary
9697
protected ValueWrapper unWrapUnexpectedHandle(long handle) {
9798
// Avoid throwing a specialization exception when given an uninitialized or corrupt
9899
// handle.
99-
throw new RuntimeException("corrupt handle 0x" + Long.toHexString(handle));
100+
throw CompilerDirectives.shouldNotReachHere("corrupt handle 0x" + Long.toHexString(handle));
100101
}
101102

102103
public static UnwrapNativeNode create() {

0 commit comments

Comments
 (0)