New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IllegalArgumentException in java 11 using RC3 #612
Comments
OULALA. T'es sur que c'était une bonne idée cette version 3 finalement ;)
:D
…On Fri, Jul 31, 2020 at 1:08 PM Andrea ***@***.***> wrote:
Hi,
I'm using jsweet in an eclipse project using you project (
https://github.com/cincheo/jsweet-eclipse-plugin).
Actually running it with java 8 everything works perfectly.
Now I'm migrating to java 11+ but I'm having some issues.
I' replaced the old jsweet-transpiler-latest-jar-with-dependencies.jar
with the new release candidate
jsweet-transpiler-3.0.0-RC3-jar-with-dependencies.jar
I changed the call to Utils.addFiles to Utils.Static.addFiles and removed
the call to JSweetConfig.jinitClassPath(jdkHome).
But when I run the transpilation this error occurs that doesn't seem to be
part of what I changed.
Can I have any help?
Thanks
dumping transpiler's strack trace:
[JCMethodDecl] public <init>() {... (myHome/myProject/src/main/java/myClass.java(6,8))
[JCClassDecl] public class IsAccTraIdSettedC... (myHome/myProject/src/main/java/myClass.java(6,1))
[JCCompilationUnit] package it.smi.galileo.acc.acc... (myHome/myProject/src/main/java/myClass.java(1,1))
java.lang.RuntimeException: Cannot call internal Javac API :( please adapt this code if API changed
at org.jsweet.transpiler.util.Util.isGeneratedConstructor(Util.java:2194)
at org.jsweet.transpiler.Java2TypeScriptTranslator.visitMethod(Java2TypeScriptTranslator.java:2163)
at org.jsweet.transpiler.Java2TypeScriptTranslator.visitMethod(Java2TypeScriptTranslator.java:146)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:898)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at org.jsweet.transpiler.util.AbstractTreeScanner.scan(AbstractTreeScanner.java:269)
at org.jsweet.transpiler.util.AbstractTreePrinter.print(AbstractTreePrinter.java:121)
at org.jsweet.transpiler.Java2TypeScriptTranslator.visitClass(Java2TypeScriptTranslator.java:1746)
at org.jsweet.transpiler.Java2TypeScriptTranslator.visitClass(Java2TypeScriptTranslator.java:146)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:808)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at org.jsweet.transpiler.util.AbstractTreeScanner.scan(AbstractTreeScanner.java:269)
at org.jsweet.transpiler.util.AbstractTreePrinter.print(AbstractTreePrinter.java:121)
at org.jsweet.transpiler.Java2TypeScriptTranslator.visitCompilationUnit(Java2TypeScriptTranslator.java:857)
at org.jsweet.transpiler.Java2TypeScriptTranslator.visitCompilationUnit(Java2TypeScriptTranslator.java:146)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:591)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at org.jsweet.transpiler.util.AbstractTreeScanner.scan(AbstractTreeScanner.java:269)
at org.jsweet.transpiler.util.AbstractTreePrinter.print(AbstractTreePrinter.java:121)
at org.jsweet.transpiler.JSweetTranspiler.generateTsFiles(JSweetTranspiler.java:880)
at org.jsweet.transpiler.JSweetTranspiler.java2ts(JSweetTranspiler.java:843)
at org.jsweet.transpiler.JSweetTranspiler.transpile(JSweetTranspiler.java:771)
at org.jsweet.plugin.builder.JSweetBuilderJob.transpileFiles(JSweetBuilderJob.java:300)
at org.jsweet.plugin.builder.JSweetBuilderJob.run(JSweetBuilderJob.java:126)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.IllegalArgumentException: Can not set int field com.sun.tools.javac.tree.JCTree.pos to com.sun.tools.javac.tree.JCTree$JCMethodDecl
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)
at java.base/jdk.internal.reflect.UnsafeIntegerFieldAccessorImpl.getInt(UnsafeIntegerFieldAccessorImpl.java:56)
at java.base/jdk.internal.reflect.UnsafeIntegerFieldAccessorImpl.get(UnsafeIntegerFieldAccessorImpl.java:36)
at java.base/java.lang.reflect.Field.get(Field.java:418)
at org.jsweet.transpiler.util.Util.isGeneratedConstructor(Util.java:2189)
... 24 more
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#612>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABP7FPPXAQ4RHL2OED6IFDLR6KQ37ANCNFSM4PQBMTAA>
.
--
Renaud Pawlak
Founder, Ph.D. - CINCHEO
renaud.pawlak@gmail.com
|
Hemmm... what do you mean? |
@regrog Even if Eclipse plugin is not officially supported yet with JSweet 3. It seems that you hit an intersting bug. Thanks for reporting. @renaudpawlak I assume this was meant to be a PM? :) |
Great! |
@regrog Could you please post here the code which caused this error |
Well...I can't replicate on my own but one of my colleague can...
Tomorrow I will try to understand more |
Thanks for your reply. If you try again, please start from this branch: Many errors have been fixed recently |
Can you please publish a new RC for jsweet 3.0.0 so I can include it in my project? |
Absolutely. We are currently doing a lot of stabilisation work on JSweet 3. I will publish it right after |
Hello again @regrog I hope it will work for you |
Hello @lgrignon |
Thanks @regrog ! |
3.0.0-RC5 is deployed, if you test please do it on this version. |
Actually the test is not going anywhere... |
Oh, shoot I use Node 12.18.3 See you soon. |
Hello @regrog Did you find time to investigate further? |
Hi sorry for the delay but this thing is really annoying me... |
No problem, there is no rush. I just want to understand what's going on because this is the only repro I have for this problem. |
Yes we are using the same JDK: https://adoptopenjdk.net/ |
I am looking forward to learn more about this. It could reveal some unexpected problems. |
Hey. Did you find time to try again? :) |
Not yet sorry. |
Maybe this can be useful for some debug or improvement. This warning shows up in console (on a working machine):
|
Thanks. |
Maybe the warning can lead to somethings. The stack trace is changed with the latest jdk 11 and the 3.1.0-SNAPSHOT
|
This stacktrace is interesting. This should not happen. Thanks for your efforts on this :) |
Beware that JSweetBuilderJob is something we created to run in eclipse plugin. We basically duplicated the JSweetBuilder to use as a job in eclipse because we use that on multiple projects. |
Ok, I hope this can help a bit and maybe you can merge my PR. |
Are you saying that you do not face this error with jsweet maven plugin for instance? |
I'm 110% sure eclipse is started with jdk >= 11 as you can see the stacktrace shows java modules and I only have java 8 or java 11 on my machine.
I only used jsweet from the eclipse plugin, I will provide an example as soon as I can not using the plugin but the gradle/maven plugin. |
Hello. I noticed your PR on the gradle plugin :) Did you give it a try for your project? |
Yes, I'm trying to use the gradle plugin to create a sample to test on other machines. |
lgrignon/jsweet-gradle-plugin#32 |
Hi, I am the colleague with the "problematic" environment. 😄 We managed to find some time to go a bit deeper into this problem, and I'm sorry to report that I still encounter the issue with the eclipse plugin. To streamline everything and see if we were doing something wrong, we decided to:
Jsweet runs fine on the same project when using the Gradle plugin, but I get the error reported above with We debugged into the
Breakpoint's screenshot from the jsweet-transpiler 3.0.0 sources: The strangest thing, though, is that the "same" type We believe this is the cause of the issue we encounter with the eclipse plugin. In the instances where Sample project: example.zip |
Thanks a lot @niktekusho for your time on this, and your explanation I just deployed this commit 5a81ff7 which in our opinion could fix your problem. Could you please try again with latest 3.1.0-SNAPSHOT? Let's cross fingers 🤞 |
Still something not working ;(
|
Hi |
Thanks for the update |
Hi,
I'm using jsweet in an eclipse project using you project (https://github.com/cincheo/jsweet-eclipse-plugin).
Actually running it with java 8 everything works perfectly.
Now I'm migrating to java 11+ but I'm having some issues.
I' replaced the old jsweet-transpiler-latest-jar-with-dependencies.jar with the new release candidate jsweet-transpiler-3.0.0-RC3-jar-with-dependencies.jar
I changed the call to Utils.addFiles to Utils.Static.addFiles and removed the call to JSweetConfig.jinitClassPath(jdkHome).
But when I run the transpilation this error occurs that doesn't seem to be part of what I changed.
Can I have any help?
Thanks
The text was updated successfully, but these errors were encountered: