I have been looking at doing the same thing as Thomas. Would it make
sense to modify the compiler so that if a javascript function does not
contain a return statement, the corresponding Java method gets a
return type of void?

Raphael

On Dec 7 2008, 2:27 pm, Norris Boyd <[email protected]> wrote:
> On Dec 5, 6:10 am, Thomas Kappler <[email protected]> wrote:
>
>
>
> > On Dec 5, 4:22 am, Norris Boyd <[email protected]> wrote:
>
> > > On Dec 4, 9:26 am, Thomas Kappler <[email protected]> wrote:
>
> > > > Hi,
>
> > > > I'm extending a Java class via the -extends argument to the debugger.
>
> > > Did you mean compiler instead of debugger?
>
> > Yes, sorry!
>
> > > > Is there a way to let the compiled method be of type void?
>
> > > You could define an interface
>
> > > interface Foo {
> > >   public void myFunc();
> > > }
>
> > > and then compile the JavaScript with -implements Foo. I haven't tried
> > > it, but I think it will force Rhino to match the void return type in
> > > the interface.
>
> > That works, thanks. It's a bit cumbersome for my use case, but not too
> > bad.
>
> > I'm trying to write JUnit (Java) test cases in Javascript, importing
> > junit.framework.Assert and compiling with -extends
> > junit.framework.TestCase. So I have to declare every testFoo() method
> > in a corresponding interface, because the JUnit test runner picks up
> > only methods conforming to "public void testFoo".
>
> > Thomas
>
> That is awkward to have to declare an additional interface like that.
>
> Have you looked at org.mozilla.javascript.tests.JsTests or
> org.mozilla.javascript.tests.DocTestsTest? Those are a couple other
> ways to write JUnit tests in JavaScript. 
> Seehttp://blog.norrisboyd.com/2008/03/doctest-in-rhino.html.
>
> --N

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to