test/tools/apt/Basic/print.sh is a golden file test. It uses jtreg @build to compile a file Aggregate.java, and then uses apt to print it. The result is compared against a golden file. The problem is that @build will use jtreg compiler options and so may or may not include -g. This affects the debugging info written to the class file, and so affects the apt outut.
The test should be rewritten to compile the file directly, and not use @build.