RFR(M) : 8181761: add explicit @build actions for jdk.test.lib classes in all :tier2 tests

Hamlin Li huaming.li at oracle.com
Fri Jun 9 02:58:40 UTC 2017

Hi Igor,

I'm coping Jon as it needs Jon's comments.

Thank you for doing such a great refactoring, I believe it will make 
tests run more stable.

I saw you are adding explicit @build to lots of test, are you going to 
clean up all tests to add explicit @build? If the answer is "yes", then 
I have a possible simple solution for you to consider.


   1. refactor all test library classes in unnamed packages to named 

   2. just need to add explicit @build for every "import x.y.z;" in a 
test, means you only need to add @build for every test lib class 
directly used by your test, lib classes' dependency is not needed. e.g. 
there is a test containing only "import 
jdk.test.lib.process.ProcessTools;", then only need to add "@build 
jdk.test.lib.process.ProcessTools", and no @build is needed to be added 
for jdk.test.lib.process.StreamPumper, jdk.test.lib.JDKToolFinder and 
jdk.test.lib.Utils and further dependency if they have.

This solution is based on the situation that all tests will be added 
@build for all test lib classes they directly used, that means no test 
is allow to just add "@library xxx".

The advantage of this solution is:

   1. the rule is simple to follow, reduce the pain for engineer writing 
the tests.

   2. it might be possible to do it automatically, and have a tool to 
monitor all checked-in test code by this rule;

   3. no need to refactor the test lib too much, e.g. no need to remove 
the dependency between test lib packages;

Of course, Jon's original strict solution is absolutely correct: to add 
@build for all test lib classes even if for the implicitly dependent 
classes. Jon's strict solution is for a more complicated situation where 
some tests are using explicit @build, but others are not, in this mixed 
situation my solution will *NOT* work. But as you're cleaning up all the 
tests, I think it's not necessary to follow such a strict rule.

I might miss something, please correct me then.

Thank you


On 2017/6/8 15:20, Igor Ignatyev wrote:
> http://cr.openjdk.java.net/~iignatyev//8181761/webrev.00/index.html
>> 432 lines changed: 404 ins; 1 del; 27 mod;
> Hi all,
> could you please review this changeset which adds explicit @build actions to tier2 jdk tests? other tests will be updated by the corresponding sub-tasks of 8181758[1].
> webrev: http://cr.openjdk.java.net/~iignatyev//8181761/webrev.00/index.html
> jbs: https://bugs.openjdk.java.net/browse/JDK-8181761
> testing: :tier2 (in progress)
> [1] https://bugs.openjdk.java.net/browse/JDK-8181758
> Thanks,
> -- Igor

More information about the core-libs-dev mailing list