Skip to content

Commit

Permalink
deprecation warning when using the old __jsend! internal method (no…
Browse files Browse the repository at this point in the history
… longer in 9K)
  • Loading branch information
kares committed Apr 24, 2015
1 parent 4752304 commit f7b8a8a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Expand Up @@ -393,12 +393,13 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
IRubyObject[] newArgs = new IRubyObject[args.length - 1];
System.arraycopy(args, 1, newArgs, 0, newArgs.length);

if(v < 0 || v == (newArgs.length)) {
context.runtime.getWarnings().warn("#__jsend! is deprecated (and will no longer work in 9K); use #java_send instead");

if (v < 0 || v == (newArgs.length)) {
return Helpers.invoke(context, self, callName, newArgs, Block.NULL_BLOCK);
} else {
RubyClass superClass = self.getMetaClass().getSuperClass();
return Helpers.invokeAs(context, superClass, self, callName, newArgs, Block.NULL_BLOCK);
}
RubyClass superClass = self.getMetaClass().getSuperClass();
return Helpers.invokeAs(context, superClass, self, callName, newArgs, Block.NULL_BLOCK);
}
});
}
Expand Down
7 changes: 7 additions & 0 deletions test/test_higher_javasupport.rb
Expand Up @@ -1259,6 +1259,13 @@ def test_null_toString
assert nil == org.jruby.javasupport.test.NullToString.new.to_s
end

def test___jsend! # expected to work (with a deprecation) under 1.7
verbose, $VERBOSE = $VERBOSE, nil
java.lang.Long.new(111).__jsend! :toString
ensure
$VERBOSE = verbose
end

# JRUBY-2277
# kind of a strange place for this test, but the error manifested
# when JI was enabled. the actual bug was a problem in alias_method,
Expand Down

0 comments on commit f7b8a8a

Please sign in to comment.