Skip to content

Commit 6a4cc60

Browse files
committed
[Truffle] Fix FindBugs warning about unsafe cast.
1 parent edce1da commit 6a4cc60

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

truffle/src/main/java/org/jruby/truffle/nodes/core/UnboundMethodNodes.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ private RubyClass metaClass(VirtualFrame frame, Object object) {
7676
public RubyMethod bind(VirtualFrame frame, RubyUnboundMethod unboundMethod, Object object) {
7777
notDesignedForCompilation();
7878
RubyModule module = unboundMethod.getMethod().getDeclaringModule();
79-
if (!ModuleOperations.canBindMethodTo(module, metaClass(frame, object))) {
79+
// the (redundant) instanceof is to satisfy FindBugs with the following cast
80+
if (module instanceof RubyClass && !ModuleOperations.canBindMethodTo(module, metaClass(frame, object))) {
8081
CompilerDirectives.transferToInterpreter();
8182
if (((RubyClass) module).isSingleton()) {
8283
throw new RaiseException(getContext().getCoreLibrary().typeError("singleton method called for a different object", this));

0 commit comments

Comments
 (0)