Empty module-info and classpath / modulepath
Hello,
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.
Thanks
请先登录再写评论。
Could you please share the sample project so we can look at it?
Yes of course, here it is : https://www.dropbox.com/s/qnbo2fe761e61tk/test_modules.zip?dl=0
we've created the issue to investigate, pls follow it here https://youtrack.jetbrains.com/issue/IDEA-302680