I have a static HashMap<UUID, MyObject> ALL = new HashMap<>(); which is used in multi-threading. To reproduce the error, I made this code: But, after some seconds (around 10), I get this error with Java 16 and Java 17: With Java 8, I get this: To test, I remove synchronized key-word, then try again in Java 17 and I get
Tag: java-17
Java 17: java: invalid source release 7 with –enable-preview (preview language features are only supported for release 17)
I am using IntelliJ IDEA 2021.2.3 , JDK 17. I have code snippet in Java 17 pom.xm Error How to fix it? Answer Set and and Now we can run/debug Java code in Java language level 17 success
Why RecordComponent doesn’t have annotation info that is defined in the Records class in Java 17?
I play with records and found something that doesn’t look logical to me: Record: Code: However, if I do: Is that expected? Because RecordComponent implements AnnotatedElement, so I thought RecordComponent should have info about annotations. Are my expectations wrong? Answer This depends on the specified permitted targets of the annotation. The record component has an associated constructor parameter, field, accessor