--- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Mon Oct 16 17:19:51 2017 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Mon Oct 16 17:19:51 2017 @@ -78,6 +78,7 @@ 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; @@ -892,9 +893,12 @@ if (te == null) { return null; } - List methods = te.getEnclosedElements(); + VisibleMemberMap vmm = configuration.getVisibleMemberMap(te, + VisibleMemberMap.Kind.METHODS); + List 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; } } @@ -1462,9 +1466,11 @@ 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); } } @@ -1557,6 +1563,25 @@ 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 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