Closed Bug 280799 Opened 20 years ago Closed 5 years ago

non-static variable-argument methods

Categories

(Rhino Graveyard :: Core, enhancement, P5)

1.6R1
x86
Windows 2000
enhancement

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: djgredler, Unassigned)

Details

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.
Reassigning to please_see_bug_288433@eml.cc pending resolution of bug 288433
Assignee: igor.bukanov → please_see_bug_288433
Assignee: please_see_bug_288433 → nobody
Changing priority to P5 based on recent bug triage.
Priority: -- → P5

Closing. Bug management is now done here:
https://github.com/mozilla/rhino

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.