7174143: encapsulate doc comment table

Reviewed-by: ksrini, mcimadamore
This commit is contained in:
Jonathan Gibbons 2012-06-20 13:23:26 -07:00
parent 288480e312
commit f2cefcbfad
24 changed files with 252 additions and 113 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
@ -25,13 +25,14 @@
package com.sun.tools.javadoc;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Position;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Kinds;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.comp.MemberEnter;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.tree.TreeInfo;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Position;
/**
* Javadoc's own memberEnter phase does a few things above and beyond that
@ -61,11 +62,12 @@ public class JavadocMemberEnter extends MemberEnter {
docenv = DocEnv.instance(context);
}
@Override
public void visitMethodDef(JCMethodDecl tree) {
super.visitMethodDef(tree);
MethodSymbol meth = tree.sym;
if (meth == null || meth.kind != Kinds.MTH) return;
String docComment = env.toplevel.docComments.get(tree);
String docComment = TreeInfo.getCommentText(env, tree);
Position.LineMap lineMap = env.toplevel.lineMap;
if (meth.isConstructor())
docenv.makeConstructorDoc(meth, docComment, tree, lineMap);
@ -75,12 +77,13 @@ public class JavadocMemberEnter extends MemberEnter {
docenv.makeMethodDoc(meth, docComment, tree, lineMap);
}
@Override
public void visitVarDef(JCVariableDecl tree) {
super.visitVarDef(tree);
if (tree.sym != null &&
tree.sym.kind == Kinds.VAR &&
!isParameter(tree.sym)) {
String docComment = env.toplevel.docComments.get(tree);
String docComment = TreeInfo.getCommentText(env, tree);
Position.LineMap lineMap = env.toplevel.lineMap;
docenv.makeFieldDoc(tree.sym, docComment, tree, lineMap);
}