Running a test suite that leverages WithEnvironmentVariables in a docker container based on openjdk:11-jdk, I get the following warning:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.github.stefanbirkner.systemlambda.SystemLambda$WithEnvironmentVariables (file:/root/.gradle/caches/modules-2/files-2.1/com.github.stefanbirkner/system-lambda/1.1.0/488b3059b67701b821355dafd952c0c7110f7ba9/system-lambda-1.1.0.jar) to field java.util.Collections$UnmodifiableMap.m
WARNING: Please consider reporting this to the maintainers of com.github.stefanbirkner.systemlambda.SystemLambda$WithEnvironmentVariables
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
The code executes fine, but the warning is slightly concerning if in fact a future release of the JVM will break this library. Is there something I can do in my code to not cause the illegal access?
Unfortunately not. You're right. The code may break in a future JVM because the environment variables support relies on internal details. AFAIK there es no other way apart from mocking the System class.
Running a test suite that leverages
WithEnvironmentVariables
in a docker container based onopenjdk:11-jdk
, I get the following warning:The code executes fine, but the warning is slightly concerning if in fact a future release of the JVM will break this library. Is there something I can do in my code to not cause the illegal access?
Thanks!