JDK-8139430 : Refactor test library to decrease module dependencies of tests
  • Type: Bug
  • Component: core-libs
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-10-12
  • Updated: 2017-07-25
  • Resolved: 2015-11-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b96Fixed
Related Reports
Relates :  
Relates :  
Description
Some tests in jdk/test build the whole library like this:
@build jdk.testlibrary.*
thus inheriting module dependencies of all classes within the library.

One particular example is these tests:
test/java/io/InputStream/ReadAllBytes.java
test/java/io/InputStream/ReadNBytes.java
which inherit dependencies on java.management module through jdk.testlibrary.InputArguments class

Another example is this: 
jdk.testlibrary.ProcessTools.getProcessId() depends on java.management.
jdk.testlibrary.Utils.tryFindJvmPid(String) depends ProcessTools
jdk.testlibrary.OutputAnalyzer.asLines(String) depends on Utils
This makes all tests depending on OutputAnalyzer to depend on java.management.
Comments
This is a good example one why you don't want to put too many different classes providing different functionality in one library.
12-10-2015