8038732: [javadoc] NetBeans IDE target does not build doclets
authorksrini
Wed, 27 Aug 2014 06:25:17 -0700
changeset 26268 620556167c08
parent 26267 4ebd9393b373
child 26269 0d8efbb110b4
8038732: [javadoc] NetBeans IDE target does not build doclets Reviewed-by: jjg, jlahoda
langtools/make/build.properties
langtools/make/build.xml
langtools/make/tools/anttasks/GenStubsTask.java
langtools/make/tools/anttasks/SelectToolTask.java
--- a/langtools/make/build.properties	Wed Aug 27 11:41:03 2014 +0100
+++ b/langtools/make/build.properties	Wed Aug 27 06:25:17 2014 -0700
@@ -128,17 +128,11 @@
 
 javadoc.includes = \
         com/sun/javadoc/ \
-        com/sun/tools/javadoc/
+        com/sun/tools/javadoc/ \
+        com/sun/tools/doclets/
 
 javadoc.tests = \
-        tools/javadoc/
-
-#
-
-doclets.includes = \
-        com/sun/tools/doclets/
-
-doclets.tests = \
+        tools/javadoc/ \
         com/sun/javadoc/
 
 #
--- a/langtools/make/build.xml	Wed Aug 27 11:41:03 2014 +0100
+++ b/langtools/make/build.xml	Wed Aug 27 06:25:17 2014 -0700
@@ -83,7 +83,7 @@
  - global property definitions
  - general top level targets
  - general diagnostic/debugging targets
- - groups of targets for each tool: javac, javadoc, doclets, javah, javap
+ - groups of targets for each tool: javac, javadoc, javah, javap
     Within each group, the following targets are provided, where applicable
       build-bootstrap-TOOL      build the bootstrap version of the tool
       build-classes-TOOL        build the classes for the tool
@@ -252,15 +252,15 @@
     </target>
 
     <target name="build-bootstrap-tools"
-        depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah,build-bootstrap-sjavac"
+        depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-javah,build-bootstrap-sjavac"
     />
 
     <target name="build-all-tools"
-        depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-sjavac"
+        depends="build-javac,build-javadoc,build-javah,build-javap,build-sjavac"
     />
 
     <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
-        <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/>
+        <build-classes includes="${javac.includes} ${javadoc.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/>
     </target>
 
     <!-- clean -->
@@ -615,7 +615,7 @@
     <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
         <build-bootstrap-classes includes="${javadoc.includes}"/>
         <build-bootstrap-jar     name="javadoc" includes="${javadoc.includes}"
-                                 jarclasspath="javac.jar doclets.jar"/>
+                                 jarclasspath="javac.jar"/>
         <build-bootstrap-tool    name="javadoc"/>
     </target>
 
@@ -625,7 +625,7 @@
 
     <target name="build-javadoc" depends="build-javac,build-classes-javadoc">
         <build-jar  name="javadoc" includes="${javadoc.includes}"
-                    jarclasspath="javac.jar doclets.jar"/>
+                    jarclasspath="javac.jar"/>
         <build-tool name="javadoc"/>
     </target>
 
@@ -643,40 +643,6 @@
 
     <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
 
-
-    <!--
-    **** doclets targets.
-    -->
-
-    <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
-        <build-bootstrap-classes includes="${doclets.includes}"/>
-        <build-bootstrap-jar     name="doclets" includes="${doclets.includes}"
-                                 jarmainclass="com.sun.tools.javadoc.Main"
-                                 jarclasspath="javadoc.jar"/>
-    </target>
-
-    <target name="build-classes-doclets" depends="build-classes-javadoc">
-        <build-classes includes="${doclets.includes}"/>
-    </target>
-
-    <target name="build-doclets" depends="build-javadoc,build-classes-doclets">
-        <!-- just jar, no bin for doclets -->
-        <build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>
-    </target>
-
-    <!-- (no javadoc for doclets) -->
-
-    <target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
-        <jtreg-tool name="doclets" tests="${doclets.tests}"/>
-    </target>
-
-    <target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
-        <findbugs-tool name="doclets"/>
-    </target>
-
-    <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
-
-
     <!--
     **** javah targets.
     -->
@@ -684,7 +650,7 @@
     <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
         <build-bootstrap-classes includes="${javah.includes}"/>
         <build-bootstrap-jar     name="javah" includes="${javah.includes}"
-                                 jarclasspath="javadoc.jar doclets.jar javac.jar"/>
+                                 jarclasspath="javadoc.jar javac.jar"/>
         <build-bootstrap-tool    name="javah"/>
     </target>
 
--- a/langtools/make/tools/anttasks/GenStubsTask.java	Wed Aug 27 11:41:03 2014 +0100
+++ b/langtools/make/tools/anttasks/GenStubsTask.java	Wed Aug 27 06:25:17 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,6 +82,7 @@
         createClasspath().setRefid(r);
     }
 
+    @Override
     public void setIncludes(String includes) {
         super.setIncludes(includes);
         this.includes = includes;
@@ -103,7 +104,7 @@
             return;
         System.out.println("Generating " + files.length + " stub files to " + destDir);
 
-        List<String> classNames = new ArrayList<String>();
+        List<String> classNames = new ArrayList<>();
         for (String file: files) {
             classNames.add(file.replaceAll(".java$", "").replace('/', '.'));
         }
@@ -114,7 +115,7 @@
             if (!ok)
                 throw new BuildException("genstubs failed");
         } else {
-            List<String> cmd = new ArrayList<String>();
+            List<String> cmd = new ArrayList<>();
             String java_home = System.getProperty("java.home");
             cmd.add(new File(new File(java_home, "bin"), "java").getPath());
             if (classpath != null)
@@ -130,20 +131,15 @@
             pb.redirectErrorStream(true);
             try {
                 Process p = pb.start();
-                BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
-                try {
+                try (BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
                     String line;
                     while ((line = in.readLine()) != null)
                         System.out.println(line);
-                } finally {
-                    in.close();
                 }
                 int rc = p.waitFor();
                 if (rc != 0)
                     throw new BuildException("genstubs failed");
-            } catch (IOException e) {
-                throw new BuildException("genstubs failed", e);
-            } catch (InterruptedException e) {
+            } catch (IOException | InterruptedException e) {
                 throw new BuildException("genstubs failed", e);
             }
         }
--- a/langtools/make/tools/anttasks/SelectToolTask.java	Wed Aug 27 11:41:03 2014 +0100
+++ b/langtools/make/tools/anttasks/SelectToolTask.java	Wed Aug 27 06:25:17 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,11 +41,9 @@
 import java.io.IOException;
 import java.io.Reader;
 import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.EnumSet;
-import java.util.List;
 import java.util.Properties;
+
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
@@ -56,6 +54,7 @@
 import javax.swing.JTextField;
 
 import javax.swing.SwingUtilities;
+
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
@@ -101,6 +100,7 @@
     /**
      * Set the location of the private properties file used to keep the retain
      * user preferences for this repository.
+     * @param propertyFile the private properties file
      */
     public void setPropertyFile(File propertyFile) {
         this.propertyFile = propertyFile;
@@ -110,6 +110,7 @@
      * Set the name of the property which will be set to the name of the
      * selected tool, if any. If no tool is selected, the property will
      * remain unset.
+     * @param toolProperty the tool name property
      */
     public void setToolProperty(String toolProperty) {
         this.toolProperty = toolProperty;
@@ -118,14 +119,16 @@
     /**
      * Set the name of the property which will be set to the execution args of the
      * selected tool, if any. The args default to an empty string.
+     * @param argsProperty the execution args property value
      */
     public void setArgsProperty(String argsProperty) {
         this.argsProperty = argsProperty;
     }
 
     /**
-     * Set the name of the property which will be set to the execution args of the
-     * selected tool, if any. The args default to an empty string.
+     * Set the name of the property which will be used to bootstrap the
+     * selected tool, if any. The property will remain unset.
+     * @param bootstrapProperty
      */
     public void setBootstrapProperty(String bootstrapProperty) {
         this.bootstrapProperty = bootstrapProperty;
@@ -134,6 +137,7 @@
     /**
      * Specify whether or not to pop up a dialog if the user has not specified
      * a default value for a property.
+     * @param askIfUnset a boolean flag indicating to prompt the user or not
      */
     public void setAskIfUnset(boolean askIfUnset) {
         this.askIfUnset = askIfUnset;
@@ -208,10 +212,11 @@
         body.add(toolLabel, lc);
         EnumSet<ToolChoices> toolChoices = toolProperty == null ?
                 EnumSet.allOf(ToolChoices.class) : EnumSet.range(ToolChoices.JAVAC, ToolChoices.JAVAP);
-        toolChoice = new JComboBox(toolChoices.toArray());
+        toolChoice = new JComboBox<>(toolChoices.toArray());
         if (toolName != null)
             toolChoice.setSelectedItem(ToolChoices.valueOf(toolName.toUpperCase()));
         toolChoice.addItemListener(new ItemListener() {
+            @Override
             public void itemStateChanged(ItemEvent e) {
                 String tn = ((ToolChoices)e.getItem()).toolName;
                 argsField.setText(getDefaultArgsForTool(props, tn));
@@ -237,8 +242,10 @@
             body.add(argsLabel, lc);
             body.add(argsField, fc);
             argsField.addFocusListener(new FocusListener() {
+                @Override
                 public void focusGained(FocusEvent e) {
                 }
+                @Override
                 public void focusLost(FocusEvent e) {
                     String toolName = ((ToolChoices)toolChoice.getSelectedItem()).toolName;
                     if (toolName.length() > 0)
@@ -257,6 +264,7 @@
         okButton = new JButton("OK");
         okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));
         okButton.addActionListener(new ActionListener() {
+            @Override
             public void actionPerformed(ActionEvent e) {
                 JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
                 d.setVisible(false);
@@ -326,7 +334,7 @@
     private File propertyFile;
 
     // GUI components
-    private JComboBox toolChoice;
+    private JComboBox<?> toolChoice;
     private JCheckBox bootstrapCheckbox;
     private JTextField argsField;
     private JCheckBox defaultCheck;