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

Leonid Mesnik lmesnik at openjdk.org
Fri Apr 18 01:28:01 UTC 2025


On Thu, 17 Apr 2025 22:48:52 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> The property controls only to where compile put compiled classes for `@build` tag. There are no changes related to source paths.  It remains completely the same and change shouldn't break any test.
>> 
>> The `might` in this part
>> 
>> A test that relies upon library classes might contain appropriate
>> <code>@build</code> directives to explicitly compile classes.
>> This might be useful when a test depends on library classes during runtime only.
>> 
>> just describes when `@build` tag still is useful useful. It might be not evident that testlibrary classes are not compiled if javac can't understand that they are used. 
>> Also, redundant `@build` is not an error, but not useful at all. 
>> 
>> Does it looks better?
>> 
>> 
>> A test that relies upon library classes that  are not implicitly resolved by during compilation should have appropriate
>> <code>@build</code> directives to explicitly compile required classes.
>> This is required when a test depends on library classes during runtime only.
>
> The only text below that described a change mentions "sourcepath" and does not mention the directories the files are compiled into.
> 
> I'm not sure what is being described below except to dispel the idea that @build is necessary.
> 
> I don't have better words at the moment but would probably mention classes that were referenced using Reflection or explicitly loaded.  But being direct about when @build is necessary will be clearer.

I see, the changes in this sentence are done just to more confident describe how the compilation with implicit library works. The actual behavior is not changed. 
The library is used as a sourcepath for javac allowing it to pick and compile classes required to compile test source code or build/compiles instructions.
It works exactly as described in the:
https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#additional-source-files
So I just mention how exactly commands are mapped to javac command.

-------------

PR Review Comment: https://git.openjdk.org/jtreg/pull/256#discussion_r2049815058


More information about the jtreg-dev mailing list