< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java

Print this page

        

@@ -76,10 +76,11 @@
 import com.sun.source.tree.LineMap;
 import com.sun.source.util.DocSourcePositions;
 import com.sun.source.util.DocTrees;
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.model.JavacTypes;
+import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
 import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.WorkArounds;
 import jdk.javadoc.internal.tool.DocEnvImpl;

@@ -890,13 +891,16 @@
                 t = getSuperType(asTypeElement(t))) {
             TypeElement te = asTypeElement(t);
             if (te == null) {
                 return null;
             }
-            List<? extends Element> methods = te.getEnclosedElements();
+            VisibleMemberMap vmm = configuration.getVisibleMemberMap(te,
+                    VisibleMemberMap.Kind.METHODS);
+            List<? extends Element> methods = vmm.getMembers(te);
             for (ExecutableElement ee : ElementFilter.methodsIn(methods)) {
-                if (configuration.workArounds.overrides(method, ee, origin)) {
+                if (configuration.workArounds.overrides(method, ee, origin) &&
+                        !isSimpleOverride(ee)) {
                     return ee;
                 }
             }
             if (t.equals(getObjectType()))
                 return null;

@@ -1460,13 +1464,15 @@
         for (Element e : getMethods(elem)) {
             ExecutableElement ee = (ExecutableElement)e;
             if (!getFullBody(e).isEmpty()) // ignore if already set
                 continue;
             if (ee.getSimpleName().contentEquals("values") && ee.getParameters().isEmpty()) {
+                removeCommentHelper(ee); // purge previous entry
                 configuration.cmtUtils.setEnumValuesTree(configuration, e);
             }
             if (ee.getSimpleName().contentEquals("valueOf") && ee.getParameters().size() == 1) {
+                removeCommentHelper(ee); // purge previous entry
                 configuration.cmtUtils.setEnumValueOfTree(configuration, e);
             }
         }
     }
 

@@ -1555,10 +1561,29 @@
             return true;
         }
         return hasBlockTag(e, DocTree.Kind.HIDDEN);
     }
 
+    /**
+     * Returns true if the method has no comments, or a lone @inheritDoc.
+     * @param m a method
+     * @return
+     */
+    public boolean isSimpleOverride(ExecutableElement m) {
+        if (!configuration.summarizeOverriddenMethods ||
+                !isIncluded(m)) {
+            return false;
+        }
+
+        if (!getBlockTags(m).isEmpty())
+            return false;
+
+        List<? extends DocTree> fullBody = getFullBody(m);
+        return fullBody.isEmpty() ||
+                (fullBody.size() == 1 && fullBody.get(0).getKind().equals(Kind.INHERIT_DOC));
+    }
+
     /**
      * In case of JavaFX mode on, filters out classes that are private,
      * package private, these are not documented in JavaFX mode, also
      * remove those classes that have @hidden or @treatAsPrivate comment tag.
      *
< prev index next >