Subj : NativeDate question regarding Rhino and Java interface To : netscape.public.mozilla.jseng From : barnabas.wolf@mssm.edu (Barnabas Wolf) Date : Thu Jan 30 2003 11:27 am I have been trying to figure out the best way to pass Dates from javascript to Java. Rhino does not convert NativeDate to Date on calling Java methods, nor does NativeDate not allow any introspection by Rhino-aware Java methods. I am aware of various workarounds in JavaScript, but considering everything else Rhino does Right, I find these workarounds ugly, inconvenient, and unintuitive. Plus, I would like to avoid re-writing a lot of JavaScript code that we already have. What solutions are there to this problem? It seems to me that two complementsry changes might be necessary in Rhino: 1. an addition to NativeJavaObject.coerceType to allow Rhino to do the conversion when trying to call methods that take a java.util.Date argument. 2. An addition to NativeDate, such as implementing the Wrapper interface, that can return new Date((long)this.date). This would allow Rhino-aware Java code to extract the information. I have implemented #2, since that is what I needed most. It seems to work, but I am not familiar enough with Rhino internals to tell whether the Wrapper interface could create some new problems. Any comments? Any other suggestions? Would anyone else be interested in patches that fix this problem? thanks, Barnabas .