Empty module-info and classpath / modulepath


I am working with Java 9 Jigsaw modules and was trying out the reflexion behaviour with / without "opens" keyword. But I have a strange behaviour in IntelliJ (2022.2.2).


I built a project with a module-info.java file containing : 

module test_modules {


And another module called "module_2" with a module-info.java containing 

module module_2 {


Then finally added the module_2 in the dependenties of my project :


With that configuration, the reflexion of private methods with the use of "setAccessible" still works, as if there were not modules.

It seems that IntelliJ by default is adding the module_2 project to the classpath, so my reflexion of a class of module_2 is working ...


The linter is warning me of the issue though : 


As soon as I add a "requires module_2" in the module-info.java file, the compiler starts complaining as it should.


Is that a desired behaviour ? Or am I missing something ? In Eclipse, it would say that the class does not exist.




Could you please share the sample project so we can look at it?


we've created the issue to investigate, pls follow it here https://youtrack.jetbrains.com/issue/IDEA-302680