src/share/classes/com/sun/tools/javac/tree/Pretty.java

changeset 1280
5c0b3faeb0b0
parent 1143
ec59a2ce9114
child 1326
30c36e23f154
     1.1 --- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Tue Jun 19 13:25:58 2012 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Wed Jun 20 13:23:26 2012 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -29,14 +29,12 @@
    1.11  import java.util.*;
    1.12  
    1.13  import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
    1.14 -
    1.15 +import com.sun.tools.javac.code.*;
    1.16 +import com.sun.tools.javac.code.Symbol.*;
    1.17 +import com.sun.tools.javac.parser.Tokens.Comment;
    1.18 +import com.sun.tools.javac.tree.JCTree.*;
    1.19  import com.sun.tools.javac.util.*;
    1.20  import com.sun.tools.javac.util.List;
    1.21 -import com.sun.tools.javac.code.*;
    1.22 -
    1.23 -import com.sun.tools.javac.code.Symbol.*;
    1.24 -import com.sun.tools.javac.tree.JCTree.*;
    1.25 -
    1.26  import static com.sun.tools.javac.code.Flags.*;
    1.27  import static com.sun.tools.javac.code.Flags.ANNOTATION;
    1.28  import static com.sun.tools.javac.tree.JCTree.Tag.*;
    1.29 @@ -78,10 +76,10 @@
    1.30       */
    1.31      Name enclClassName;
    1.32  
    1.33 -    /** A hashtable mapping trees to their documentation comments
    1.34 +    /** A table mapping trees to their documentation comments
    1.35       *  (can be null)
    1.36       */
    1.37 -    Map<JCTree, String> docComments = null;
    1.38 +    DocCommentTable docComments = null;
    1.39  
    1.40      /** Align code to be indented to left margin.
    1.41       */
    1.42 @@ -233,7 +231,7 @@
    1.43       */
    1.44      public void printDocComment(JCTree tree) throws IOException {
    1.45          if (docComments != null) {
    1.46 -            String dc = docComments.get(tree);
    1.47 +            String dc = docComments.getCommentText(tree);
    1.48              if (dc != null) {
    1.49                  print("/**"); println();
    1.50                  int pos = 0;
    1.51 @@ -480,7 +478,7 @@
    1.52  
    1.53      public void visitVarDef(JCVariableDecl tree) {
    1.54          try {
    1.55 -            if (docComments != null && docComments.get(tree) != null) {
    1.56 +            if (docComments != null && docComments.hasComment(tree)) {
    1.57                  println(); align();
    1.58              }
    1.59              printDocComment(tree);

mercurial