NativeScript / NativeScript/android
Improve support for Java varargs methods
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 563
- Forks
- 144
- Avg merge
- 10h 46m
- Merged PRs (30d)
- 14
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the current method resolution algorithm in the NativeScript Android runtime and trace how JavaScript calls are matched to Java methods. Verify the behavior against the implicit and explicit varargs examples in the issue. Done means an omitted varargs argument resolves through the array-parameter fallback while unresolved methods still fail normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, java, javascript
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100