JDK-8176900 : TreePosTest should disable annotation processing
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2017-03-16
  • Updated: 2017-03-25
  • Resolved: 2017-03-16
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 10 JDK 9
10Fixed 9 b162Fixed
Related Reports
Relates :  
Relates :  
Description
TreePosTest creates lots of JavacTask, as part of its testing, and by default, each task allows for the use of annotation processors. This causes each task to create a classloader, to check it for annotation processors, but because of the nature of TreePosTest, it doesn't do a full compilation, and so doesn't close resources in the normal manner.

The net effect is to create substantial garbage containing open classloaders, which cases performance problems, such as seen in JDK-8175116.

The solution is to disable the checking of anno processors for TreePosTest. This reduces the number of classloaders created in TreePosTest from 6463 to just 1
Comments
Here is a bug for that - JDK-8177014
16-03-2017

Webrev: http://cr.openjdk.java.net/~jjg/8176900/webrev.00/
16-03-2017

Fix: $ hg diff -R langtools diff -r 7a7efd549ab6 test/tools/javac/tree/TreePosTest.java --- a/test/tools/javac/tree/TreePosTest.java Thu Mar 16 17:56:00 2017 +0000 +++ b/test/tools/javac/tree/TreePosTest.java Thu Mar 16 13:57:05 2017 -0700 @@ -281,7 +281,8 @@ JavacTool tool = JavacTool.create(); r.errors = 0; Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file); - JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), null, files); + JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), + List.of("-proc:none"), files); Iterable<? extends CompilationUnitTree> trees = task.parse(); pw.flush(); if (r.errors > 0)
16-03-2017