konsoletyper / teavm

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

Tree map fixes #813

Closed Ihromant closed 8 months ago

Ihromant commented 8 months ago

Added lots of various fixes for TreeMap. Explanation. I get https://github.com/pulseenergy/harmony-treemap/blob/master/src/test/java/org/apache/harmony/java/util/TreeMapTest.java this file (Apache 2.0 licensed), renamed it to TreeMapTest1, adapted to our testcases and noticed multiple failures. Then I fixed them one by one. So, now 2 options are possible:

  1. Have two test files for TreeMap, one normal and one "verbose".
  2. Remove this TreeMapTest1 file. Personally I don't want to extract exact cases that are failing or merge this tests because this is stupid work IMHO.
konsoletyper commented 8 months ago

I don't like the idea of committing this TreeMapTest1, but if you don't want to merge it with TreeMapTest, at least please resolve checkstyle issues.

Ihromant commented 8 months ago

Could you please fix checkstyle in gradle? When I'm running ./gradlew check it fails with:

FAILURE: Build failed with an exception.

* What went wrong:
Could not load the value of field `aliasSet` of `sun.nio.cs.UTF_8` bean found in field `charset` of `org.gradle.api.internal.resources.FileCollectionBackedTextResource` bean found in field `config` of task `:classlib:checkstyleMain` of type `org.gradle.api.plugins.quality.Checkstyle`.
> java.lang.reflect.InvocationTargetException (no error message)
konsoletyper commented 8 months ago

What Java version are you using? Is it 21? Gradle does not support Java 21 yet, so you should run from 17

Ihromant commented 8 months ago

Yes, it's 21.

Ihromant commented 8 months ago

Still, it worked earlier on 21. But ok, will downgrade for tests.

konsoletyper commented 8 months ago

I did not change anything significant here. The error is in Gradle, and it clearly states, that Java 21 is unsupported. Gradle doc also says that there's no support for running Gradle on Java 21 yet. I don't know what has changed, perhaps some random caching issues.

Ihromant commented 8 months ago

Now when I'm compiling with 17 Java it fails with

> Task :tests:compileTestJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tests:compileTestJava'.
> error: invalid source release: 21
konsoletyper commented 8 months ago

Please, read this article: https://docs.gradle.org/current/userguide/toolchains.html

Personally, I run Gradle from IDEA and specify JDK 17 as Gradle run JDK, but project has both 17 and 21 installed, so Gradle toolchains work properly. If it's not an option, I don't have a quick answer.

You can also try keep running on 21, but play with these lines in gradle.properties:

org.gradle.caching=true
org.gradle.unsafe.configuration-cache=true

especially, with the second one

Ihromant commented 8 months ago

Thanks, setting this properties helped. Now checkstyle and build are successful.