Skip to content

Arguments not being passed to vararg methods correctly #100

@tpoliaw

Description

@tpoliaw

If a Java method such as

public static void foo(Object... args) {}

is called from Jython as

foo(1, 2, [3,4])

The call should be valid and the argsthat gets passed to the Java method should be [1, 2, [3, 4]].

The current method checks the final arg to check if it's a sequence and assumes the varargs are already being passed as a list so the call fails. A similar call without the list (eg foo(1, 2, 3)) works as expected.

A similar bug (but the other way around) can be see by calling a Java method such as

static void foo(int[] a, int... b) {}

as

foo([1,2,3])

which should be valid, but needs an additional empty list added to fit the vararg signature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions