cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.45k stars 160 forks source link

com.sun.tools.javac.code.Type$ErrorType is in module jdk.compiler of loader 'app'; javax.lang.model.type.ExecutableType is in module java.compiler of loader 'platform' #658

Open lal12 opened 3 years ago

lal12 commented 3 years ago

I am trying to convert a java project to typescript (nodejs) as a starting point to port it. Though I got the following error:

[ERROR] transpilation failed
java.lang.ClassCastException: class com.sun.tools.javac.code.Type$ErrorType cannot be cast to class javax.lang.model.type.ExecutableType (com.sun.tools.javac.code.Type$ErrorType is in module jdk.compiler of loader 'app'; javax.lang.model.type.ExecutableType is in module java.compiler of loader 'platform')

I haven't found any (direct) usage of those classes in the code, so I guess they might be a throw type of something. And I don't really know where to look.

renaudpawlak commented 3 years ago

This kind of errors usually happens when you have Java compilation errors, most often when your classpath is missing some class. Please check that all the librairies you need to compile the Java source code are available in your classpath. Also, could you tell us which JSweet version you are using (so that we can eventually improve error reporting).

Edit: well, from the error message mentioning modules, I guess that you are using JSweet 3.0.0 and JDK 11, right?

lal12 commented 3 years ago

openjdk 11.0.9.1 2020-11-04 and yes JSweet 3.0, current master of jsweet-quickstart.

I will look into the classpath issue. Thanks!