Looks like elasticsearch:securemock is using an old version of mockito.
Using an older mockito version produces warnings in newer Java versions (Java 11):
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.mockito.cglib.core.ReflectUtils$2 (file:../.gradle/caches/modules-2/files-2.1/org.elasticsearch/securemock/1.2/98201d4ad5ac93f6b415ae9172d52b5e7cda490e/securemock-1.2.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.mockito.cglib.core.ReflectUtils$2
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
Looks like the updating to a newer version of mockito should prevent these warnings.
Pinging @elastic/es-core-infra
We definitely should update at some point. There are other benefits to being on Mockito 2.x. There are some breaking changes though so it might not just be a simple version bump considering it's a major version change.
https://github.com/mockito/mockito/wiki/What%27s-new-in-Mockito-2#incompatible
As Mark surmised, it is not a simple version bump. I attempted this a few months ago. IIRC the difficulty was in the internal changes, since we must wrap in appropriate doPriv blocks.