mockito/mockito-scala

'Illegal reflective access operation has occurred' using WithObjectMocked

matt-calderaz opened this issue · 0 comments

Hi folks,

I'm using:

  • openJDK 11
  • scala 2.13.10
  • mockito-scala-cats 1.17.12
  • scalaTestPlus 5.1.0

I've added src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker to enable the inline mock maker. After doing so I am able to write a unit test using the withObjectMocked block; however I also notice the following warnings:

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.mockito.ReflectionUtils$ (file:/Users/mcalde28/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/mockito/mockito-scala_2.13/1.17.12/mockito-scala_2.13-1.17.12.jar) to method java.lang.Class.getDeclaredFields0(boolean) WARNING: Please consider reporting this to the maintainers of org.mockito.ReflectionUtils$ 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
Any remedy for this?

Thanks!