src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocMemberEnter.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -21,11 +21,11 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
-package com.sun.tools.javadoc;
+package jdk.javadoc.internal.tool;
 
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.code.Flags;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.comp.MemberEnter;

@@ -74,17 +74,16 @@
     public void visitMethodDef(JCMethodDecl tree) {
         super.visitMethodDef(tree);
         MethodSymbol meth = tree.sym;
         if (meth == null || meth.kind != MTH) return;
         TreePath treePath = docenv.getTreePath(env.toplevel, env.enclClass, tree);
-        if (meth.isConstructor())
-            docenv.makeConstructorDoc(meth, treePath);
-        else if (isAnnotationTypeElement(meth))
-            docenv.makeAnnotationTypeElementDoc(meth, treePath);
-        else
-            docenv.makeMethodDoc(meth, treePath);
-
+        // do not add those methods that may be mandated by the spec,
+        // or those that are synthesized, thus if it does not exist in
+        // tree best to let other logic determine the TreePath.
+        if (env.enclClass.defs.contains(tree)) {
+            docenv.setElementToTreePath(meth, treePath);
+        }
         // release resources
         tree.body = null;
     }
 
     @Override

@@ -99,21 +98,15 @@
                 // method bodies are also removed, in visitMethodDef.
                 tree.init = null;
             }
         }
         super.visitVarDef(tree);
-        if (tree.sym != null &&
-                tree.sym.kind == VAR &&
-                !isParameter(tree.sym)) {
-            docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
+        if (tree.sym != null && tree.sym.kind == VAR && !isParameter(tree.sym)) {
+            docenv.setElementToTreePath(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
         }
     }
 
-    private static boolean isAnnotationTypeElement(MethodSymbol meth) {
-        return ClassDocImpl.isAnnotationType(meth.enclClass());
-    }
-
     private static boolean isParameter(VarSymbol var) {
         return (var.flags() & Flags.PARAMETER) != 0;
     }
 
     /**