java-21 Questions

4

After upgrading my code from Java 17 and Spring-boot 3.1.3 to Java 21 and String-boot 3.2.0, I've started to see errors like the ones below, when calling the REST APIs: UPDATE: After running some m...
Dyslexia asked 10/12, 2023 at 18:34

3

I'm am using parboiled as a dependency: // https://mvnrepository.com/artifact/org.parboiled/parboiled-java api 'org.parboiled:parboiled-java:1.4.1' After updating from java 17 to 21 I am getting t...
Endopeptidase asked 24/9, 2023 at 0:56

3

When I execute mvn install -DskipTests Maven gives me an error related to virtual threads [ERROR] /E:/mycode/javaproject/rms/rms-parse/src/main/java/com/example/config/AsyncConfig.java:[19,49] 鎵句笉鍒...
Guerrero asked 15/10, 2023 at 3:44

2

I am using an api written in Java in an Android project. This api is restricted to Java 8 features. Until recently, this worked fine. The api was compiled using OpenJDK 17 so far. Now, the project ...
Polygamy asked 9/1 at 16:9

7

Solved

When trying to configure the project using Java 21 I'm getting the error: Unsupported Java. Your build is currently configured to use Java 21 and Gradle 8.3. Unfortunately, there is no informatio...
Bernhardt asked 20/9, 2023 at 7:52

4

Solved

I'm using macOS and I want to try Java 21 in IntelliJ IDEA. I believe I have done all the required steps to change Java version of a project / module. Nevertheless I still can't use new Java 21 Fea...
Kelso asked 20/9, 2023 at 10:2

3

Solved

I'm rather new to parallel code, and I tried to convert some code based on executors to structured concurrency, but I lost an important property that I must somehow keep. Given the following code u...

2

Solved

I have just upgraded our Spring Boot applications to Java 21. As a part of that, I have also done changes to use virtual threads. Both when serving API requests and when doing async operations inte...
Ablation asked 26/2 at 12:51

10

Solved

After upgrading to JDK 21, I have the following compilation error in my Spring Boot project: Fatal error compiling: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does n...
Stat asked 25/9, 2023 at 9:5

2

When Java 21 introduced sequenced collections, I was really excited to start using them. But then I quickly found that there are various corners of the JDK where it seems like the new sequenced int...
Xanthochroism asked 19/1 at 17:58

2

Solved

I have an @Async task executing some database related background work. After enabling virtual threads (spring.threads.virtual.enabled: true) the number of Async jobs executed in parallel is no long...

2

I do understand that platform threads are expensive as it needs more memory and it's prone to CPU context switching. But in case of virtual threads where an unimaginably large number of virtual thr...

2

Solved

It' s recommended by JDK developers that virtual threads should never be pooled, because they are really cheap to create and destroy. I am a little confusing about the pooling idea, since pooling u...

1

In this case, i need to propagating some state like tracer/span or request context per request. The jdk env is 21.0.1-preview. I try to propagate any state between thread and virtual thread by a co...
Valse asked 26/12, 2023 at 8:10

3

As of 2023/JDK21, what @Nullable to use in Java? Many online materials don't even mention which import to use. So it is now (dark) history in what order those annotation appeared. I hope for gener...
Monophagous asked 6/7, 2023 at 15:33

2

I migrated to spring boot 3 and java 21. Since I have a patch rest call to make, i needed the dependency org.apache.httpcomponents.client5:httpclient5:5.2.2. But with that dependency, I get a &quot...

1

Solved

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 lat...
Trajan asked 26/11, 2023 at 10:34

1

Solved

Has anyone else also noticed changes in Java's generics in Java 21? We're using Jdbi for database access and when updating to Java 21 things go wrong because a generic type cannot be determined any...
Reddin asked 16/11, 2023 at 15:21

1

Solved

I'm using Spring Boot 3.1.5, Java 21 and maven 3.9.5. I've got the following error when running mvn spring-boot:build-image [INFO] > Pulling builder image 'docker.io/paketobuildpacks/builder:bas...
Carbone asked 27/10, 2023 at 18:4

1

Solved

Is there a standard built-in Spring Boot configuration parameter to tell whether to use virtual threads or platform threads for rest controller? Or is the only way to create configuration beans, li...

1

Solved

I'm using Java Corretto 21.0.0.35.1 build 21+35-LTS, and the built-in Java HTTP client to retrieve a response as an InputStream. I'm making parallel requests using virtual threads, and for the most...
Paratroops asked 18/10, 2023 at 11:28

2

This is my code import java.util.Date; import java.text.DateFormat; class DateTime { public static void main(String[] args) { String dt = DateFormat.getDateTimeInstance().format(new Date()); Sy...
Genesis asked 3/10, 2023 at 23:14

1

Solved

I started to play with the new Java 21 feature - pattern matching. public class Main { public static void main(String[] args) { RecordB recordB = new RecordB(true); switch(recordB) { case Re...
Curculio asked 27/9, 2023 at 16:46

1

Solved

Java 21 record patterns promises the introduction of destructuring to the Java language. However, it seems to be tightly coupled to pattern matching that can only be used as part of instanceof comp...
Plater asked 22/9, 2023 at 12:53
1

© 2022 - 2024 — McMap. All rights reserved.