Closed acarioni closed 11 months ago
This looks like a bug in the JVM target itself and you would need to report it directly at https://github.com/HaxeFoundation/haxe/issues. Does it work with the Java target?
The java target is deprecated and my project can't compile with it.
@acarioni can you give me a code example where the compilation fails. I am somehow not able to reproduce it.
The following compiles fine for me when using the jvm target.
import hx.concurrent.executor.Executor;
class Test {
static final executor = Executor.create(2);
public static function main() {
executor.submit(function() {
trace("hi");
}, FIXED_RATE(100));
}
}
I tried hard to reproduce the issue by means of a simple example but unfortunately I wasn’t able. However I can reproduce it systematically when I compile my open source project. In order to compile my project, you need to install a few tools (like Ant), but I can assist you if you need help. You can find some other details in the issue thread on the haxe project.
If you locally modify the ThreadPool.hx file and replace the occurrences of (function() {
with (function():Void {
, does it then work?
I replaced the (only) occurrence of Threads.spawn(function() {
with Threads.spawn(function(): Void {
but I have the same error (I use hx.concurrent 5.1.3).
Ok, then I am out of ideas. I hoped by adding the return type explicitly it may help the Haxe compiler to generate code that is compatible with the java Runnable interface. Then we have to wait that the upstream issue you reported gets resolved directly by the haxe team
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If the issue is still valid, please add a respective comment to prevent this issue from being closed automatically. Thank you for your contributions.
When I run my tests with haxe-concurrent 5.1.3 and haxe 4.3.1, I get the following error. However if I compile the same tests with haxe 4.3-rc.1, they work fine. Unfortunately I am not able to reproduce the error by means of a simple test, but the basic execution flow is trivial: I create an instance of Executor in a static variable and, when I try to call the method submit on it from the method Test.delay, the exception ExceptionInInitializerError is thrown.