Skip to content

checkArity confusingly raises line of outer caller for nested calls #5103

Description

@andrewvc

Environment

Provide at least:

  • JRuby version: 9.1.13.0
  • Mac OSX

Expected Behavior

I have code something like:

#Java interface
interface MyJavaInterface {
  void interfaceMethod(argItTakes)
}

#Ruby
class MyClass
  include org.example.MyJavaInterface

  # Note that we accidentally specify an extra arg here
  def interfaceMethod(argItTakes, extraArgThatIsAccident)
  end

  def someOtherMethod
    callJavaMethodThatInvokesAboveInterfaceMethodButWithOnlyOneArg
  end
end

Actual Behavior

JRuby generates an ArgumentError: wrong number of arguments (1 for 2) that points to the line in someOtherMethod, when the real error is that we implemented the interface incorrectly. The stack trace shouldn't filter out the java in this case, but do the full stack trace to expose this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions