Closed
Bug 350580
Opened 19 years ago
Closed 19 years ago
[PATCH] importPackage Ambiguous import error fix
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
1.6R6
People
(Reporter: lgawron, Unassigned)
Details
Attachments
(1 file, 1 obsolete file)
|
1.82 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Build Identifier: Rhino 1.6R2 (R3 also)
Originally reported at:
http://groups.google.com/group/netscape.public.mozilla.jseng/browse_frm/thread/9551fca1f6200746/4c8cf0604bcd79ca?lnk=gst&q=ambiguous+import&rnum=1#4c8cf0604bcd79ca
quote:
Attached is a patch to fix importPackage to not import the
same package more than once. This fixes an error that
shows up if a call to importPackage is encountered twice
before classes from the package actually get referenced.
I encountered this error while working with a flowscript
(Cocoon's name for javascript+continuations) for a set of
Cocoon forms. Quickly starting more than one instance of
a form triggers this bug.
The patch replaces a comparison using '=' between two
NativeJavaPackage's with a comparison using string equality.
This effectively compares the package names instead of
checking for object identity.
The other thing which we might need to check is that the
two NativeJavaPackage's both use the same classloader.
I would appreciate it if somebody more knowledgeable of
Rhino internals could sanity check this patch.
Reproducible: Couldn't Reproduce
| Reporter | ||
Comment 1•19 years ago
|
||
this is the original patch posted by Tim Larson on 2005-03-22 to jseng news list. It is truly a one liner.
Comment 2•19 years ago
|
||
Actually, this is a bit problematic, as you can have a border case where the two NativeJavaPackage objects are for the same package but loaded through different class loaders. The real solution is to implement equals() and hashCode() on the NativeJavaPackage so that it compares both the name and the class loader, see attached patch -- comments welcome.
Attachment #235905 -
Attachment is obsolete: true
Comment 3•19 years ago
|
||
Committed patch to CVS HEAD
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 4•18 years ago
|
||
Adding target milestone of 1.6R6 based on the date this bug was resolved FIXED.
Target Milestone: --- → 1.6R6
You need to log in
before you can comment on or make changes to this bug.
Description
•