Skip to content

'Illegal reflective access operation has occurred' using WithObjectMocked #489

@matt-calderaz

Description

@matt-calderaz

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions