Hi list!
Pretty new here, so sorry if what follows is already known/completely
wrong/etc :-)
There seems to be a problem with Scriptable objects that define both
the getter (jsGet_) and setter (jsSet_) methods for the same property.
In this case, the ScriptableObject.buildClassCtor method throws an
exception with the message:
Invalid method "{0}": name "{1}" is already in use.
While this is probably correct when handling methods, it looks like it
shouldn't apply when dealing with property. The patch in attachment
should fix the problem (it just moves the check for repeated names
after the block that handles properties).
Marco
Index: src/org/mozilla/javascript/ScriptableObject.java
===================================================================
RCS file:
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/ScriptableObject.java,v
retrieving revision 1.134
diff -u -r1.134 ScriptableObject.java
--- src/org/mozilla/javascript/ScriptableObject.java 3 Jul 2008 20:16:59
-0000 1.134
+++ src/org/mozilla/javascript/ScriptableObject.java 9 Jul 2008 23:07:07
-0000
@@ -1154,12 +1154,6 @@
} else {
continue;
}
- String propName = name.substring(prefix.length());
- if (names.contains(propName)) {
- throw Context.reportRuntimeError2("duplicate.defineClass.name",
- name, propName);
- }
- names.add(propName);
name = name.substring(prefix.length());
if (prefix == setterPrefix)
continue; // deal with set when we see get
@@ -1181,7 +1175,12 @@
attr);
continue;
}
-
+
+ if (names.contains(name)) {
+ throw Context.reportRuntimeError2("duplicate.defineClass.name",
+ name, name);
+ }
+ names.add(name);
FunctionObject f = new FunctionObject(name, methods[i], proto);
if (f.isVarArgsConstructor()) {
throw Context.reportRuntimeError1
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino