jparams / to-string-verifier

To String Verifier provides an easy and convenient way to test the toString method on your class.
MIT License
32 stars 6 forks source link

Illegal reflective access operation with Java 11 #61

Open Kobee1203 opened 1 year ago

Kobee1203 commented 1 year ago

I run the tests of my project with Java 11, and I have the following warnings:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jparams.object.builder.provider.ObjectProvider (file:/C:/Users/.../.m2/repository/com/jparams/object-builder/2.3.1/object-builder-2.3.1.jar) to constructor java.lang.Class(java.lang.ClassLoader,java.lang.Class)
WARNING: Please consider reporting this to the maintainers of com.jparams.object.builder.provider.ObjectProvider
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Could you fix this problem to remain compatible with Java 11 and above?

JiangHongTiao commented 10 months ago

I'm experiencing this problem. I'm trying to migrate into Java 17, however my tests are failing:

java.lang.reflect.InaccessibleObjectException: Unable to make field private transient java.lang.Object java.lang.Throwable.backtrace accessible: module java.base does not "opens java.lang" to unnamed module @55fe41ea
    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.jparams.verifier.tostring.FieldsProvider.provide(FieldsProvider.java:36)
    at com.jparams.verifier.tostring.ToStringVerifier.verify(ToStringVerifier.java:438)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:662)
    at com.jparams.verifier.tostring.ToStringVerifier.verify(ToStringVerifier.java:399)
    at church.i18n.processing.ToStringTest.testProcessingExceptionToString(ToStringTest.java:56)
    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)

Do you consider to update the library?