konsoletyper / teavm

Compiles Java bytecode to JavaScript, WebAssembly and C
https://teavm.org
Apache License 2.0
2.55k stars 261 forks source link

Error when compiling project with teavm 0.10.0-dev-2 #860

Closed Ihromant closed 7 months ago

Ihromant commented 7 months ago

Tried to compile private large project with teavm 0.10.0-dev-2. Got the following error: Screenshot_2023-11-14_22-35-28 Will try to reproduce it on smaller publishable project.

Ihromant commented 7 months ago

In smaller project it adds zero correctly to second identifier: Screenshot_2023-11-14_22-58-13

konsoletyper commented 7 months ago

You can try to debug it on the project that you have

Ihromant commented 7 months ago

Could you please give a hint where this names are generated?

konsoletyper commented 7 months ago

DefaultAliasProvider, in particular you can place conditional breakpoint on getStaticMethodAlias. Also, DefaultNamingStrategy: getFullNameFor(MethodReference method) and getNameForInit(MethodReference method)

Ihromant commented 7 months ago

I have another question. I have multi-module maven project. How to launch TeaVM compiler against it in debug mode preferrably in IDEA?

konsoletyper commented 7 months ago

By "In debug mode" you mean to attach debugger to TeaVM compiler? In Gradle there's a daemonPort property or something like this, which allows to attach with remote debugger (you should also turn on out-of-process build). In case of Maven you can just open TeaVM project and create a Maven run configuration, which builds your project and debug this run configuration - but make sure you turned off out-of-process build.

Ihromant commented 7 months ago

Ideally it would be

public static void main(String[] args) {
// configure classpath, TeaVM options, paths etc.
doBuild(); // what should it be?
}

Usually it's faster than configure remote debug, connect, fight against source-class mismatch etc.

konsoletyper commented 7 months ago

It would be TeaVMBuilder, see Maven plugin implementation.

Ihromant commented 7 months ago

Many thanks. Hope that I'll be able to run my project in 0.10.0-dev-4 at last.