Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit ffcae07

Browse files
committed
Adapt JRuby arity workaround to BlockSignature
The workaround looking up the corresponding Java class and looking at its methods only works for methods, and doesn't work for Proc, where there isn't a direct API to access the proxied Java class. While the same problem exists for Proc's, until jruby/jruby#2817 has been resolved, there isn't much that can be done for that case. However, the current code fails to run for all blocks with arity -1, so this tweak is necessary to ensure normal blocks work again. I couldn't find any specs for BlockSignature, so wasn't sure where it would be appropriate to add a test for this.
1 parent 383b4f9 commit ffcae07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rspec/support/method_signature_verifier.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class MethodSignature < remove_const(:MethodSignature)
186186

187187
def classify_parameters
188188
super
189-
return unless @method.arity == -1 && @method.owner.respond_to?(:java_class)
189+
return unless @method.arity == -1 && @method.respond_to?(:owner) && @method.owner.respond_to?(:java_class)
190190
java_instance_methods = @method.owner.java_class.java_instance_methods
191191
compatible_overloads = java_instance_methods.select do |java_method|
192192
@method == @method.owner.instance_method(java_method.name)

0 commit comments

Comments
 (0)