I get this error when I run this test using JDK 17:
java.lang.reflect.InaccessibleObjectException: Unable to make field final transient java.lang.Class java.util.EnumSet.elementType accessible: module java.base does not "opens java.util" to unnamed module @60addb54
    @Test
    public void testThatDeepCopyCopiesEmptySet() {
        SetOfEnumUserType setOfEnumUserType = createSetOfEnumUserType();
        EnumSet<PaymentMethodType> src = EnumSet.noneOf(PaymentMethodType.class);
        EnumSet<?> dest = (EnumSet<?>) setOfEnumUserType.deepCopy(src);
        assertThat(dest, (is(src)));
        assertThat(dest, not(isSameInstanceAs(src)));
        Class<?> srcType = (Class<?>) ReflectionTestUtils.getField(src, "elementType");
        Class<?> destType = (Class<?>) ReflectionTestUtils.getField(dest, "elementType");
        assertThat(srcType, (is(destType)));
    }
I tried adding this to my pom.xml based on other answers:
           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                    <compilerArgs>
                        <arg>--add-opens java.base/java.lang=ALL-UNNAMED</arg>
                        <arg>--add-opens java.base/java.util=ALL-UNNAMED</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
                <configuration>
                    <argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
                    <argLine>--add-opens java.base/java.util=ALL-UNNAMED</argLine>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <inherited />
                    </execution>
                </executions>
            </plugin>
But when I build, I now get this error:
Fatal error compiling: error: invalid flag: --add-opens java.base/java.lang=ALL-UNNAMED
