Skip to content

Commit f7b8a8a

Browse files
committed
deprecation warning when using the old __jsend! internal method (no longer in 9K)
1 parent 4752304 commit f7b8a8a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

core/src/main/java/org/jruby/javasupport/binding/Initializer.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,13 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
393393
IRubyObject[] newArgs = new IRubyObject[args.length - 1];
394394
System.arraycopy(args, 1, newArgs, 0, newArgs.length);
395395

396-
if(v < 0 || v == (newArgs.length)) {
396+
context.runtime.getWarnings().warn("#__jsend! is deprecated (and will no longer work in 9K); use #java_send instead");
397+
398+
if (v < 0 || v == (newArgs.length)) {
397399
return Helpers.invoke(context, self, callName, newArgs, Block.NULL_BLOCK);
398-
} else {
399-
RubyClass superClass = self.getMetaClass().getSuperClass();
400-
return Helpers.invokeAs(context, superClass, self, callName, newArgs, Block.NULL_BLOCK);
401400
}
401+
RubyClass superClass = self.getMetaClass().getSuperClass();
402+
return Helpers.invokeAs(context, superClass, self, callName, newArgs, Block.NULL_BLOCK);
402403
}
403404
});
404405
}

test/test_higher_javasupport.rb

+7
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,13 @@ def test_null_toString
12591259
assert nil == org.jruby.javasupport.test.NullToString.new.to_s
12601260
end
12611261

1262+
def test___jsend! # expected to work (with a deprecation) under 1.7
1263+
verbose, $VERBOSE = $VERBOSE, nil
1264+
java.lang.Long.new(111).__jsend! :toString
1265+
ensure
1266+
$VERBOSE = verbose
1267+
end
1268+
12621269
# JRUBY-2277
12631270
# kind of a strange place for this test, but the error manifested
12641271
# when JI was enabled. the actual bug was a problem in alias_method,

0 commit comments

Comments
 (0)