modulepath and classpath mixture

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Feb 23 21:20:39 UTC 2016



On 02/23/2016 01:10 PM, Robert Scholte wrote:
>
> And maybe this is the key question: if src/main/java is a module, 
> should we handle src/test/java as a module too or leave it as a 
> classpath based project?
>
> thanks,
> Robert 


You list 2 choices, but there's 3 possible answers here.

If you're writing a test that only exercises the public/exported API of 
the module, it could either be written as code in the unnamed module (a 
"classpath based project"), or it could be written as a separate, named 
module.

If your test is using the pattern of putting test classes in the same 
package as that which is being tested, then the test has to be part of 
the module being tested, which means you get into using -Xmodule at 
compile time and -Xpatch at runtime.

-- Jon



More information about the jigsaw-dev mailing list