non-static variable-argument methods



14 years ago
12 years ago


(Reporter: djgredler, Unassigned)


Windows 2000




14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

When creating Rhino host objects, implementing variable-argument methods
requires that the methods be static and accept four standard parameters: a
Context, a Scriptable, an Object[] and a Function. Implementing the methods as
non-static with only the desired parameters results in Rhino only finding one of
the methods.

It would be nice if, in order to add MyHostObject.doThis(arg1, [arg2]), you
could do this:

public Object jsFunction_doThis(Object arg1){}
public Object jsFunction_doThis(Object arg1, Object arg2){}

rather than:

public static Object jsFunction_doThis(Context c, Scriptable s, Object[] args,
Function f) {}

Reproducible: Always

Steps to Reproduce:
1. Implement a var-arg method by adding multiple methods of the same name but
different signatures.
2. Try to use the different methods.

Actual Results:  
Only one of the methods of the specified name was picked up by Rhino.

Expected Results:  
All methods of the specified name are picked up by Rhino.

Comment 1

13 years ago
Reassigning to pending resolution of bug 288433
Assignee: igor.bukanov → please_see_bug_288433
Assignee: please_see_bug_288433 → nobody

Comment 2

12 years ago
Changing priority to P5 based on recent bug triage.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.