langtools/test/tools/lib/toolbox/JavadocTask.java
changeset 41633 eec0f5b0465f
parent 39105 956490b8da9c
child 42277 2668b0bc7ad7
equal deleted inserted replaced
41632:c599331f6040 41633:eec0f5b0465f
    36 import java.util.Map;
    36 import java.util.Map;
    37 import java.util.stream.Collectors;
    37 import java.util.stream.Collectors;
    38 import java.util.stream.Stream;
    38 import java.util.stream.Stream;
    39 
    39 
    40 import javax.tools.DocumentationTool.DocumentationTask;
    40 import javax.tools.DocumentationTool.DocumentationTask;
       
    41 import javax.tools.DocumentationTool;
    41 import javax.tools.JavaFileManager;
    42 import javax.tools.JavaFileManager;
       
    43 import javax.tools.JavaFileManager.Location;
    42 import javax.tools.JavaFileObject;
    44 import javax.tools.JavaFileObject;
    43 import javax.tools.StandardJavaFileManager;
    45 import javax.tools.StandardJavaFileManager;
    44 import javax.tools.StandardLocation;
    46 import javax.tools.StandardLocation;
    45 import javax.tools.ToolProvider;
    47 import javax.tools.ToolProvider;
    46 
    48 
   301             jdtool = new JavadocTool();
   303             jdtool = new JavadocTool();
   302 
   304 
   303             if (fileManager == null)
   305             if (fileManager == null)
   304                 fileManager = internalFileManager = jdtool.getStandardFileManager(null, null, null);
   306                 fileManager = internalFileManager = jdtool.getStandardFileManager(null, null, null);
   305             if (outdir != null)
   307             if (outdir != null)
   306                 setLocationFromPaths(StandardLocation.CLASS_OUTPUT, Collections.singletonList(outdir));
   308                 setLocationFromPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT,
       
   309                         Collections.singletonList(outdir));
   307             if (classpath != null)
   310             if (classpath != null)
   308                 setLocationFromPaths(StandardLocation.CLASS_PATH, classpath);
   311                 setLocationFromPaths(StandardLocation.CLASS_PATH, classpath);
   309             if (sourcepath != null)
   312             if (sourcepath != null)
   310                 setLocationFromPaths(StandardLocation.SOURCE_PATH, sourcepath);
   313                 setLocationFromPaths(StandardLocation.SOURCE_PATH, sourcepath);
   311             List<String> allOpts = new ArrayList<>();
   314             List<String> allOpts = new ArrayList<>();
   324             if (internalFileManager != null)
   327             if (internalFileManager != null)
   325                 internalFileManager.close();
   328                 internalFileManager.close();
   326         }
   329         }
   327     }
   330     }
   328 
   331 
   329     private void setLocationFromPaths(StandardLocation location, List<Path> files) throws IOException {
   332     private void setLocationFromPaths(Location location, List<Path> files) throws IOException {
   330         if (!(fileManager instanceof StandardJavaFileManager))
   333         if (!(fileManager instanceof StandardJavaFileManager))
   331             throw new IllegalStateException("not a StandardJavaFileManager");
   334             throw new IllegalStateException("not a StandardJavaFileManager");
   332         ((StandardJavaFileManager) fileManager).setLocationFromPaths(location, files);
   335         ((StandardJavaFileManager) fileManager).setLocationFromPaths(location, files);
   333     }
   336     }
   334 
   337