Closed gjoseph closed 4 years ago
Actually - the IllegalStateExceptions in question were thrown by default
methods on the interface that Foo
implements, in the example above. Removing those fixes transpilation.
So maybe that's a problem with JSweet's support of default methods? If this isn't a known issue, happy to try and isolate it in a sample repo, let me know.
Hey, thanks for reporting. J4TS is actually currently not supported with JSweet 3. Overriding JDK classes with modules requires a lot of work, if even possible.
If you plan to use J4TS, I would recommend to stick to stable 2.3.x
But JSweet 2.x doesn't support Java 11, does it ?:)
Nope, there is currently no easy way to use j4ts with Java 9+, sorry about that.
If you are willing to contribute, you can give it a shot. We have a j4ts branch with some pending work in progress (which I could explain). That would be amazing :)
Closing as moved to J4TS: https://github.com/j4ts/j4ts/issues/56
Sorry in advance - this might be the wrong repo to report this issue, since it involves JSweet, the maven plugin, and j4ts. Happy to move it elsewhere, let me know!
I am trying to generate/transpile some Java 11 code to typescript, so I'm giving 3.0.0-RC1 a shot. The transpiler seems to be choking on runtime exceptions, specifically code like
throw new IllegalStateException("this should not happen")
, and it does so with an NPE unfortunately:This is happening with
<tsOnly>true</tsOnly>
- interestingly enough, if I remove the j4ts dependency, the build passes. But the ts-to-js compilation fails miserably becauseCannot find name 'java'.
. I'm not sure I understand why the transpile phase fails when I introduce j4ts.FWIW I'm using j4ts 0.6.0.
Is this simply because j4ts doesn't know about IllegalStateException? (I tried throw RuntimeException, which was easy to change without having to patch everything, but that failed the same way)