Skip to content

Improve support for Java varargs methods #469

Open
@slavchev

Description

@slavchev

Java supports varargs methods. For example, [Class.getMethod](https://developer.android.com/reference/java/lang/Class.html#getMethod%28java.lang.String, java.lang.Class<?>...%29)

Method getMethod (String name, Class...<?> parameterTypes)

This is syntax sugar for the actual method signature which is

Method getMethod (String name, Class<?>[] parameterTypes)

Currently, NativeScript for Android does not support calling such method with implicit parameter

var klass = java.lang.Object.class;

// option 1) not supported
var method = klass.getMethod("hasCode");

// option 2) supported
var method = klass.getMethod("hasCode", null);

We can provide another implementation for the current method resolution algorithm so it tries to find a method with one additional parameter (array) as a fallback and if this fail then the method resolution fails as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions