Skip to content
Advertisement

Tag: java-17

Unable to make field final transient java.lang.Class java.util.EnumSet.elementType accessible: module java.base does not “opens java.util” to unnamed

I get this error when I run this test using JDK 17: I tried adding this to my pom.xml based on other answers: But when I build, I now get this error: Answer @Holger is right, you should not hack into JDK internals. He also explained correctly that –add-opens is not a valid Maven Compiler option. Because he did not

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

UnknownElementException on Java 17 record class

With excitement I downloaded Java 17 today and got a simple record class However when doing mvn compile, it throws me error Fatal error compiling: javax.lang.model.element.UnknownElementException: Unknown element: “com.xxx.TestCls” I double checked java -version and it looks right to me: Would anyone have a clue? Thanks in advance! Supplements: my maven version is 3.5.4. maven settings in pom file: I’m

Advertisement