Closed Bug 466207 Opened 16 years ago Closed 14 years ago

Implement java.util.List interface in NativeArray

Categories

(Rhino Graveyard :: Core, enhancement)

head
x86
All
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: hannesw, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

As proposed by Attila, JavaScript Arrays should implement the java.util.List interface like ScriptableObject implements java.util.Map (see bug 448816). This would make exchange of list-like date between JavaScript and Java in Rhino a breeze.
Turns out we can't make NativeArray implement java.util.List or even java.util.Collection since we made ScriptableObject implement java.util.Map with the patch for bug 448816, and Map has a remove(Object) method that is incompatible with that in List/Collection. I think what we should do is move the Map implementation from ScriptableObject to NativeObject. Making JS-Object -> java.util.Map conversion work for native JS Objects should cover most use cases, and it's not obvious a Function or Date object should auto-convert to a Map. Not sure about custom Host objects, but these can always implement Map or subclass NativeObject. I'm working on a patch, will post it shortly.
Status: NEW → ASSIGNED
As described in the previous comment, this moves the implementation of java.util.Map from ScriptableObject to NativeObject.
patch without the unrelated small optimization in NativeArray
Attachment #480945 - Attachment is obsolete: true
I committed the last patch.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: