javaintellij-ideajava.util.concurrentjava-21

IntelliJ IDEA + JDK 21 issue with java.util.concurrent package - TimeUnit class not available


I have an issue when I am trying to use TimeUnit class from java.util.concurrent. It happens with Oracle JDK 21.0.1 (configurations are below) + IntelliJ IDEA 2023.1.5 (Community Edition) - the latest update at the current moment (UPDATE: As I thought in the beginning since I've run update - look a solution below).

Configuration on my computer (get by java -version in console):

java version "21.0.1" 2023-10-17 LTS

Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)

Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)

And I've checked that I set up JDK 21 in IntelliJ Project Structure menu including Project and Modules sections.

On the screenshot below you can see a basic class created for test purposes. Some concurrent package classes are imported fine, but not TimeUnit class for some reason.

The issue screenshot

Meanwhile you can see on the screenshot that app works despite the issue when I run it.

When I am using java 17 in IDE configurations, I don't see the issue.

Could you please help to understand why this issue happens and how to fix it?

One more thing. When I go to "About IntelliJ IDEA" menu, I see the next configuration:

Runtime version: 17.0.7+10-b829.16 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

I am not sure why it says version 17, could it be a reason of the issue?


Solution

  • While searching, I found a solution.

    Following the same kind of issue discussed in this topic, I manually updated IntelliJ to version 2023.2.5 one more time, and now the issue is resolved.

    It appears that when updating IntelliJ, it may be necessary to perform the update process multiple times consecutively.