-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
MainClass clinit does not initailize other classes in correct order #897
Comments
Can you provide any details on your code? I'm not interested in JVM version or operating system. What I'm interested in is the Java code you are trying to convert to JavaScript. It would be best if you could write a self-contained example that reproduces the issue. As for workaround, try placing something like |
I tried with trivial example like this: static {
System.out.println(Stream.of(1, 2, 3).collect(Collectors.toSet()));
} And what I get in entry point's
You can notice that calling initializer does not present in this list. This is expected, since it calls native method |
thanks for spending the time trying to reproduce, yes - I had trouble trying to produce a simple example that reproduces the issue.. I'll try again soon, my best guess currently is that if you export multiple methods they'd each have different initialization order - hence combining them needs to be done carefully. If this is true it would make sense because exporting multiple methods is new. |
If it's possible, you can post your original project. In case it's closed-source, you can reach me directly in Gitter and we'll discuss terms.
Your guess is wrong. The order of initializers does not depend on 'main' method or other entry points, but rather from relation of static initializers. |
version 0.10.0-dev-10
When I run my generated javascript I get this error:
This is happing because my class' clinit is called before Characteristics__clinit is called
I can workaround by manually reording code in the generated javascript, or re-write my java code to use a code path that doesnt require this code to be initialized.
Regards.
The text was updated successfully, but these errors were encountered: