Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Java 17 #40

Open
deepakab03 opened this issue Apr 24, 2024 · 0 comments
Open

Support Java 17 #40

deepakab03 opened this issue Apr 24, 2024 · 0 comments

Comments

@deepakab03
Copy link

Trying to run a test that uses sameBeanAs() on Java 17 - using JUnit 5- fails with a InaccessibleObjectException

java.lang.reflect.InaccessibleObjectException: Unable to make field private static final long java.time.Duration.serialVersionUID accessible: module java.base does not "opens java.time" to unnamed module @527740a2
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
at com.shazam.shazamcrest.CyclicReferenceDetector.detectCircularReferenceOnFields(CyclicReferenceDetector.java:72)
at com.shazam.shazamcrest.CyclicReferenceDetector.detectCircularReferenceOnObject(CyclicReferenceDetector.java:119)
at com.shazam.shazamcrest.CyclicReferenceDetector.detectCircularReferenceOnFields(CyclicReferenceDetector.java:78)
at com.shazam.shazamcrest.CyclicReferenceDetector.detectCircularReferenceOnObject(CyclicReferenceDetector.java:119)
at com.shazam.shazamcrest.CyclicReferenceDetector.detectCircularReferenceOnFields(CyclicReferenceDetector.java:78)
at com.shazam.shazamcrest.CyclicReferenceDetector.detectCircularReferenceOnObject(CyclicReferenceDetector.java:119)
at com.shazam.shazamcrest.CyclicReferenceDetector.detectCircularReferenceOnFields(CyclicReferenceDetector.java:78)
at com.shazam.shazamcrest.CyclicReferenceDetector.detectCircularReferenceOnObject(CyclicReferenceDetector.java:119)
at com.shazam.shazamcrest.CyclicReferenceDetector.getClassesWithCircularReferences(CyclicReferenceDetector.java:40)
at com.shazam.shazamcrest.matcher.DiagnosingCustomisableMatcher.matches(DiagnosingCustomisableMatcher.java:64)
at org.hamcrest.DiagnosingMatcher.matches(DiagnosingMatcher.java:12)
at org.hamcrest.core.Is.matches(Is.java:25)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:10)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
at com.emc.symmwin.scheduler.db.controller.SchedulerDataFacadeIT.whenFetchTaskRun_givenPresent_shouldWork(SchedulerDataFacadeIT.java:343)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Looks like shazamcrest should not be looking at static fields and honour the Java module access specifiers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant