The @build tags are used quite haphazardly in the RMI regression tests. Several things need to be done.
1) Tests that uses TestLibrary should list TestLibrary first. This is because of order dependencies in jtreg that might cause subsequent tests to break. See CODETOOLS-7900024. Briefly, if a test uses library classes, jtreg is supposed to compile those library classes and store the results in a place where they can be reused by subsequent tests. Unfortunately, if the test's @build tags compile test classes first, the library classes get compiled implicitly and get stored in the wrong location. Apparently jtreg remembers that it compiled them but since they're in the wrong location, subsequent tests may fail with NoClassDefFoundError. The workaround is to list library classes first in @build directives.
2) Classes that are explicitly depended upon by the test should be listed in @build, but not second-level dependencies in the library (e.g. StreamPipe).
3) It is not necessary to list the main test class in a @build tag, since the @run tag will build it implicitly.
4) Several classes should be consolidated onto a single @build line where possible, as this seems to speed up the test run a bit.
5) Every test should have a @run tag. This isn't strictly necessary, but it helps to avoid errors. If a test has no @run tag, jtreg will implicitly just run it. But if a maintainer were to add a @build tag (shorthand for @run build) the build step will be executed and jtreg's implicit run behavior will not occur. Thus the test will not be run!