-
Notifications
You must be signed in to change notification settings - Fork 236
Open
Description
I'm trying to use records with easy-random 5.0.0, but I was unable to run properly, as you can see in the following code.
public record MyRecord(Long b, String a) {
}
And the runner is
final var testing = new EasyRandom().nextObject(MyRecord.class);
And I got this error:
org.jeasy.random.ObjectCreationException: Unable to create a random instance of type class foo.bar.MyRecord
Caused by: java.lang.IllegalAccessException: Can not set final java.lang.Long field foo.bar.MyRecord.a to java.lang.Long
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:76)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:80)
at java.base/jdk.internal.reflect.UnsafeQualifiedObjectFieldAccessorImpl.set(UnsafeQualifiedObjectFieldAccessorImpl.java:79)
My Java version
java version "17.0.10" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 17.0.10+11-LTS-240)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.10+11-LTS-240, mixed mode, sharing)
Thank U
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels