uschindler commented on pull request #572: URL: https://github.com/apache/lucene/pull/572#issuecomment-1002098455
> > They don't have to be - you can "overlay" test classes over main or the other way around. What you can't do is "merge" two module descriptors - and you need additional opens/ module dependencies for running tests > > If my understanding is correct I was thinking similar things (opening packages in a module to its test module to allow reflective accesses for tests), but I'm a bit afraid that it could make the purpose of the modular tests unclear - it should be kept as black-box tests for APIs to outside modules to me. But this is a different concern here and should be discussed in another issue. Actually the "patch-module" command line option allows to "patch" a module for testing (it was invented just for that). It allows to pass another JAR file or a file system directory that "overlays" the original module. So that means you can patch in all test classes into lucene.core, so they can run as if they were in the core module. This is how Maven manages the testing of modules (actually Maven people invented that in a meeting with Mark Reinhold, Alan Bateman and we discussed it including me on a OpenJDK committers meeting a few years ago). As Dawid said, the problem is that test may need to patch module-info.java, too. I think this should work, too, but you have to have a separate module.info.java in the tests that gets patched over the existing one. I have not tested this. My problem is code duplication, but maybe we can use some ASM trick to add the "requires" directives or we do this on test startup using a config file (you can still change the module layer at runtime). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
