Closed Ihromant closed 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.
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)
What Java version are you using? Is it 21? Gradle does not support Java 21 yet, so you should run from 17
Yes, it's 21.
Still, it worked earlier on 21. But ok, will downgrade for tests.
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.
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
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
Thanks, setting this properties helped. Now checkstyle and build are successful.
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: