RFR: 7902847: Class directory of a test case should be always used to compile a library

Jonathan Gibbons jjg3 at pobox.com
Tue Apr 1 19:04:49 UTC 2025


On 3/25/25 10:52 AM, Leonid Mesnik wrote:
> The classes from test libraries can be compiled implicitly as a test dependency or explicitly with @build tag.
>
> For first case
> Test library used as a source path during test compilation  and library classes as well as test classes are compiled into class directory.

Implicit compilation of the library classes into the test class 
directory is deplorable and should not be encourages.


>
> For 2nd case
> The library classes are compiled using @build tag and library classes are placed into some shared location.

Generally, library classes should be independent of any test classes and 
test class directory. As such, @build is the recommended way to build 
libraries.


> Class directory of a test case should be always used to compile a library
That would be an anti-pattern to be discouraged. Libraries are supposed 
to be shared between tests and as such, should not be beholden to any 
individual test class directory.

-- Jon





More information about the jtreg-dev mailing list