< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java

Print this page




 112 
 113     protected void printTagName(DocTree node) throws IOException {
 114         out.write("@");
 115         out.write(node.getKind().tagName);
 116     }
 117 
 118     final String lineSep = System.getProperty("line.separator");
 119 
 120     /**************************************************************************
 121      * Traversal methods
 122      *************************************************************************/
 123 
 124     /** Exception to propagate IOException through visitXXX methods */
 125     private static class UncheckedIOException extends Error {
 126         static final long serialVersionUID = -4032692679158424751L;
 127         UncheckedIOException(IOException e) {
 128             super(e.getMessage(), e);
 129         }
 130     }
 131 













 132     @Override @DefinedBy(Api.COMPILER_TREE)
 133     public Void visitAttribute(AttributeTree node, Void p) {
 134         try {
 135             print(node.getName());
 136             String quote;
 137             switch (node.getValueKind()) {
 138                 case EMPTY:
 139                     quote = null;
 140                     break;
 141                 case UNQUOTED:
 142                     quote = "";
 143                     break;
 144                 case SINGLE:
 145                     quote = "'";
 146                     break;
 147                 case DOUBLE:
 148                     quote = "\"";
 149                     break;
 150                 default:
 151                     throw new AssertionError();




 112 
 113     protected void printTagName(DocTree node) throws IOException {
 114         out.write("@");
 115         out.write(node.getKind().tagName);
 116     }
 117 
 118     final String lineSep = System.getProperty("line.separator");
 119 
 120     /**************************************************************************
 121      * Traversal methods
 122      *************************************************************************/
 123 
 124     /** Exception to propagate IOException through visitXXX methods */
 125     private static class UncheckedIOException extends Error {
 126         static final long serialVersionUID = -4032692679158424751L;
 127         UncheckedIOException(IOException e) {
 128             super(e.getMessage(), e);
 129         }
 130     }
 131 
 132     @Override
 133     public Void visitAccessor(AccessorTree node, Void aVoid) {
 134         try {
 135             print("{");
 136             printTagName(node);
 137             print(node.getDescription());
 138             print("}");
 139         } catch (IOException e) {
 140             throw new UncheckedIOException(e);
 141         }
 142         return null;
 143     }
 144 
 145     @Override @DefinedBy(Api.COMPILER_TREE)
 146     public Void visitAttribute(AttributeTree node, Void p) {
 147         try {
 148             print(node.getName());
 149             String quote;
 150             switch (node.getValueKind()) {
 151                 case EMPTY:
 152                     quote = null;
 153                     break;
 154                 case UNQUOTED:
 155                     quote = "";
 156                     break;
 157                 case SINGLE:
 158                     quote = "'";
 159                     break;
 160                 case DOUBLE:
 161                     quote = "\"";
 162                     break;
 163                 default:
 164                     throw new AssertionError();


< prev index next >