Skip to content

Commit

Permalink
[Truffle] Fix FindBugs warning about unsafe cast.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Apr 16, 2015
1 parent edce1da commit 6a4cc60
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -76,7 +76,8 @@ private RubyClass metaClass(VirtualFrame frame, Object object) {
public RubyMethod bind(VirtualFrame frame, RubyUnboundMethod unboundMethod, Object object) {
notDesignedForCompilation();
RubyModule module = unboundMethod.getMethod().getDeclaringModule();
if (!ModuleOperations.canBindMethodTo(module, metaClass(frame, object))) {
// the (redundant) instanceof is to satisfy FindBugs with the following cast
if (module instanceof RubyClass && !ModuleOperations.canBindMethodTo(module, metaClass(frame, object))) {
CompilerDirectives.transferToInterpreter();
if (((RubyClass) module).isSingleton()) {
throw new RaiseException(getContext().getCoreLibrary().typeError("singleton method called for a different object", this));
Expand Down

0 comments on commit 6a4cc60

Please sign in to comment.