Okay, so Iterator(obj) was introduced in 1.7. But I'm running at language version 1.2... shouldn't that 'protect' me?
Clearly not. When I remove the importClass call, I can set Iterator = null in script, or call scope.removeObject( "Iterator" ). Logging the value of "Iterator" after either of these operations shows it's null, but introducing importClass causes the same failure. Frustrating. On Mon, Mar 29, 2010 at 12:08 PM, Mark Storer <[email protected]> wrote: > Including the above line in a script causes an ECMA exception: > > com.cardiff.js.EcmaException: Cannot import "Iterator" since a property by > that > name is already defined. > at com.cardiff.js.ErrorHandler.runtimeError(ErrorHandler.java:76) > at > org.mozilla.javascript.Context.reportRuntimeError(Context.java:938) > at > org.mozilla.javascript.Context.reportRuntimeError(Context.java:994) > at > org.mozilla.javascript.Context.reportRuntimeError1(Context.java:957) > at > org.mozilla.javascript.ImporterTopLevel.importClass(ImporterTopLevel.java:239) > at > org.mozilla.javascript.ImporterTopLevel.js_importClass(ImporterTopLevel.java:200) > at > org.mozilla.javascript.ImporterTopLevel.execIdCall(ImporterTopLevel.java:272) > at > org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) > at > org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97) > at org.mozilla.javascript.gen.c85._c0(Unknown Source) > at org.mozilla.javascript.gen.c85.call(Unknown Source) > at > org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398) > at > org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065) > at org.mozilla.javascript.gen.c85.call(Unknown Source) > at org.mozilla.javascript.gen.c85.exec(Unknown Source) > ... > at com.cardiff.js.Interpreter.execute(Interpreter.java:431) > > > > > Dumping Iterator to the console produces: > > function Iterator() { [native code for Iterator.Iterator, arity=2] } > > Is there a way to change the name of something as it is imported to avoid > such collisions, or is it just "illegal" now to import Iterator? > > -- > --Mark Storer > Senior Software Engineer > Autonomy Cardiff > --Mark Storer Senior Software Engineer Autonomy Cardiff _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
