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

Wed, 27 Apr 2016 01:34:52 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:34:52 +0800
changeset 0
959103a6100f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 package com.sun.tools.javac.tree;
aoqi@0 27
aoqi@0 28
aoqi@0 29 import javax.tools.Diagnostic;
aoqi@0 30
aoqi@0 31 import com.sun.source.doctree.*;
aoqi@0 32 import com.sun.tools.javac.parser.Tokens.Comment;
aoqi@0 33 import com.sun.tools.javac.util.Assert;
aoqi@0 34 import com.sun.tools.javac.util.DiagnosticSource;
aoqi@0 35 import com.sun.tools.javac.util.JCDiagnostic;
aoqi@0 36 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
aoqi@0 37 import com.sun.tools.javac.util.List;
aoqi@0 38 import com.sun.tools.javac.util.Name;
aoqi@0 39 import com.sun.tools.javac.util.Position;
aoqi@0 40 import java.io.IOException;
aoqi@0 41 import java.io.StringWriter;
aoqi@0 42 import javax.tools.JavaFileObject;
aoqi@0 43
aoqi@0 44 /**
aoqi@0 45 * <p><b>This is NOT part of any supported API.
aoqi@0 46 * If you write code that depends on this, you do so at your own risk.
aoqi@0 47 * This code and its internal interfaces are subject to change or
aoqi@0 48 * deletion without notice.</b>
aoqi@0 49 */
aoqi@0 50 public abstract class DCTree implements DocTree {
aoqi@0 51
aoqi@0 52 /**
aoqi@0 53 * The position in the comment string.
aoqi@0 54 * Use {@link #getSourcePosition getSourcePosition} to convert
aoqi@0 55 * it to a position in the source file.
aoqi@0 56 *
aoqi@0 57 * TODO: why not simply translate all these values into
aoqi@0 58 * source file positions? Is it useful to have string-offset
aoqi@0 59 * positions as well?
aoqi@0 60 */
aoqi@0 61 public int pos;
aoqi@0 62
aoqi@0 63 public long getSourcePosition(DCDocComment dc) {
aoqi@0 64 return dc.comment.getSourcePos(pos);
aoqi@0 65 }
aoqi@0 66
aoqi@0 67 public JCDiagnostic.DiagnosticPosition pos(DCDocComment dc) {
aoqi@0 68 return new SimpleDiagnosticPosition(dc.comment.getSourcePos(pos));
aoqi@0 69 }
aoqi@0 70
aoqi@0 71 /** Convert a tree to a pretty-printed string. */
aoqi@0 72 @Override
aoqi@0 73 public String toString() {
aoqi@0 74 StringWriter s = new StringWriter();
aoqi@0 75 try {
aoqi@0 76 new DocPretty(s).print(this);
aoqi@0 77 }
aoqi@0 78 catch (IOException e) {
aoqi@0 79 // should never happen, because StringWriter is defined
aoqi@0 80 // never to throw any IOExceptions
aoqi@0 81 throw new AssertionError(e);
aoqi@0 82 }
aoqi@0 83 return s.toString();
aoqi@0 84 }
aoqi@0 85
aoqi@0 86 public static abstract class DCEndPosTree<T extends DCEndPosTree<T>> extends DCTree {
aoqi@0 87
aoqi@0 88 private int endPos = Position.NOPOS;
aoqi@0 89
aoqi@0 90 public int getEndPos(DCDocComment dc) {
aoqi@0 91 return dc.comment.getSourcePos(endPos);
aoqi@0 92 }
aoqi@0 93
aoqi@0 94 @SuppressWarnings("unchecked")
aoqi@0 95 public T setEndPos(int endPos) {
aoqi@0 96 this.endPos = endPos;
aoqi@0 97 return (T) this;
aoqi@0 98 }
aoqi@0 99
aoqi@0 100 }
aoqi@0 101
aoqi@0 102 public static class DCDocComment extends DCTree implements DocCommentTree {
aoqi@0 103 public final Comment comment; // required for the implicit source pos table
aoqi@0 104
aoqi@0 105 public final List<DCTree> firstSentence;
aoqi@0 106 public final List<DCTree> body;
aoqi@0 107 public final List<DCTree> tags;
aoqi@0 108
aoqi@0 109 public DCDocComment(Comment comment,
aoqi@0 110 List<DCTree> firstSentence, List<DCTree> body, List<DCTree> tags) {
aoqi@0 111 this.comment = comment;
aoqi@0 112 this.firstSentence = firstSentence;
aoqi@0 113 this.body = body;
aoqi@0 114 this.tags = tags;
aoqi@0 115 }
aoqi@0 116
aoqi@0 117 public Kind getKind() {
aoqi@0 118 return Kind.DOC_COMMENT;
aoqi@0 119 }
aoqi@0 120
aoqi@0 121 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 122 return v.visitDocComment(this, d);
aoqi@0 123 }
aoqi@0 124
aoqi@0 125 public List<? extends DocTree> getFirstSentence() {
aoqi@0 126 return firstSentence;
aoqi@0 127 }
aoqi@0 128
aoqi@0 129 public List<? extends DocTree> getBody() {
aoqi@0 130 return body;
aoqi@0 131 }
aoqi@0 132
aoqi@0 133 public List<? extends DocTree> getBlockTags() {
aoqi@0 134 return tags;
aoqi@0 135 }
aoqi@0 136
aoqi@0 137 }
aoqi@0 138
aoqi@0 139 public static abstract class DCBlockTag extends DCTree implements BlockTagTree {
aoqi@0 140 public String getTagName() {
aoqi@0 141 return getKind().tagName;
aoqi@0 142 }
aoqi@0 143 }
aoqi@0 144
aoqi@0 145 public static abstract class DCInlineTag extends DCEndPosTree<DCInlineTag> implements InlineTagTree {
aoqi@0 146 public String getTagName() {
aoqi@0 147 return getKind().tagName;
aoqi@0 148 }
aoqi@0 149 }
aoqi@0 150
aoqi@0 151 public static class DCAttribute extends DCTree implements AttributeTree {
aoqi@0 152 public final Name name;
aoqi@0 153 public final ValueKind vkind;
aoqi@0 154 public final List<DCTree> value;
aoqi@0 155
aoqi@0 156 DCAttribute(Name name, ValueKind vkind, List<DCTree> value) {
aoqi@0 157 Assert.check((vkind == ValueKind.EMPTY) ? (value == null) : (value != null));
aoqi@0 158 this.name = name;
aoqi@0 159 this.vkind = vkind;
aoqi@0 160 this.value = value;
aoqi@0 161 }
aoqi@0 162
aoqi@0 163 @Override
aoqi@0 164 public Kind getKind() {
aoqi@0 165 return Kind.ATTRIBUTE;
aoqi@0 166 }
aoqi@0 167
aoqi@0 168 @Override
aoqi@0 169 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 170 return v.visitAttribute(this, d);
aoqi@0 171 }
aoqi@0 172
aoqi@0 173 @Override
aoqi@0 174 public Name getName() {
aoqi@0 175 return name;
aoqi@0 176 }
aoqi@0 177
aoqi@0 178 @Override
aoqi@0 179 public ValueKind getValueKind() {
aoqi@0 180 return vkind;
aoqi@0 181 }
aoqi@0 182
aoqi@0 183 @Override
aoqi@0 184 public List<DCTree> getValue() {
aoqi@0 185 return value;
aoqi@0 186 }
aoqi@0 187 }
aoqi@0 188
aoqi@0 189 public static class DCAuthor extends DCBlockTag implements AuthorTree {
aoqi@0 190 public final List<DCTree> name;
aoqi@0 191
aoqi@0 192 DCAuthor(List<DCTree> name) {
aoqi@0 193 this.name = name;
aoqi@0 194 }
aoqi@0 195
aoqi@0 196 @Override
aoqi@0 197 public Kind getKind() {
aoqi@0 198 return Kind.AUTHOR;
aoqi@0 199 }
aoqi@0 200
aoqi@0 201 @Override
aoqi@0 202 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 203 return v.visitAuthor(this, d);
aoqi@0 204 }
aoqi@0 205
aoqi@0 206 @Override
aoqi@0 207 public List<? extends DocTree> getName() {
aoqi@0 208 return name;
aoqi@0 209 }
aoqi@0 210 }
aoqi@0 211
aoqi@0 212 public static class DCComment extends DCTree implements CommentTree {
aoqi@0 213 public final String body;
aoqi@0 214
aoqi@0 215 DCComment(String body) {
aoqi@0 216 this.body = body;
aoqi@0 217 }
aoqi@0 218
aoqi@0 219 @Override
aoqi@0 220 public Kind getKind() {
aoqi@0 221 return Kind.COMMENT;
aoqi@0 222 }
aoqi@0 223
aoqi@0 224 @Override
aoqi@0 225 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 226 return v.visitComment(this, d);
aoqi@0 227 }
aoqi@0 228
aoqi@0 229 @Override
aoqi@0 230 public String getBody() {
aoqi@0 231 return body;
aoqi@0 232 }
aoqi@0 233 }
aoqi@0 234
aoqi@0 235 public static class DCDeprecated extends DCBlockTag implements DeprecatedTree {
aoqi@0 236 public final List<DCTree> body;
aoqi@0 237
aoqi@0 238 DCDeprecated(List<DCTree> body) {
aoqi@0 239 this.body = body;
aoqi@0 240 }
aoqi@0 241
aoqi@0 242 @Override
aoqi@0 243 public Kind getKind() {
aoqi@0 244 return Kind.DEPRECATED;
aoqi@0 245 }
aoqi@0 246
aoqi@0 247 @Override
aoqi@0 248 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 249 return v.visitDeprecated(this, d);
aoqi@0 250 }
aoqi@0 251
aoqi@0 252 @Override
aoqi@0 253 public List<? extends DocTree> getBody() {
aoqi@0 254 return body;
aoqi@0 255 }
aoqi@0 256 }
aoqi@0 257
aoqi@0 258 public static class DCDocRoot extends DCInlineTag implements DocRootTree {
aoqi@0 259
aoqi@0 260 @Override
aoqi@0 261 public Kind getKind() {
aoqi@0 262 return Kind.DOC_ROOT;
aoqi@0 263 }
aoqi@0 264
aoqi@0 265 @Override
aoqi@0 266 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 267 return v.visitDocRoot(this, d);
aoqi@0 268 }
aoqi@0 269 }
aoqi@0 270
aoqi@0 271 public static class DCEndElement extends DCTree implements EndElementTree {
aoqi@0 272 public final Name name;
aoqi@0 273
aoqi@0 274 DCEndElement(Name name) {
aoqi@0 275 this.name = name;
aoqi@0 276 }
aoqi@0 277
aoqi@0 278 @Override
aoqi@0 279 public Kind getKind() {
aoqi@0 280 return Kind.END_ELEMENT;
aoqi@0 281 }
aoqi@0 282
aoqi@0 283 @Override
aoqi@0 284 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 285 return v.visitEndElement(this, d);
aoqi@0 286 }
aoqi@0 287
aoqi@0 288 @Override
aoqi@0 289 public Name getName() {
aoqi@0 290 return name;
aoqi@0 291 }
aoqi@0 292 }
aoqi@0 293
aoqi@0 294 public static class DCEntity extends DCTree implements EntityTree {
aoqi@0 295 public final Name name;
aoqi@0 296
aoqi@0 297 DCEntity(Name name) {
aoqi@0 298 this.name = name;
aoqi@0 299 }
aoqi@0 300
aoqi@0 301 @Override
aoqi@0 302 public Kind getKind() {
aoqi@0 303 return Kind.ENTITY;
aoqi@0 304 }
aoqi@0 305
aoqi@0 306 @Override
aoqi@0 307 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 308 return v.visitEntity(this, d);
aoqi@0 309 }
aoqi@0 310
aoqi@0 311 @Override
aoqi@0 312 public Name getName() {
aoqi@0 313 return name;
aoqi@0 314 }
aoqi@0 315 }
aoqi@0 316
aoqi@0 317 public static class DCErroneous extends DCTree implements ErroneousTree, JCDiagnostic.DiagnosticPosition {
aoqi@0 318 public final String body;
aoqi@0 319 public final JCDiagnostic diag;
aoqi@0 320
aoqi@0 321 DCErroneous(String body, JCDiagnostic.Factory diags, DiagnosticSource diagSource, String code, Object... args) {
aoqi@0 322 this.body = body;
aoqi@0 323 this.diag = diags.error(diagSource, this, code, args);
aoqi@0 324 }
aoqi@0 325
aoqi@0 326 @Override
aoqi@0 327 public Kind getKind() {
aoqi@0 328 return Kind.ERRONEOUS;
aoqi@0 329 }
aoqi@0 330
aoqi@0 331 @Override
aoqi@0 332 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 333 return v.visitErroneous(this, d);
aoqi@0 334 }
aoqi@0 335
aoqi@0 336 @Override
aoqi@0 337 public String getBody() {
aoqi@0 338 return body;
aoqi@0 339 }
aoqi@0 340
aoqi@0 341 @Override
aoqi@0 342 public Diagnostic<JavaFileObject> getDiagnostic() {
aoqi@0 343 return diag;
aoqi@0 344 }
aoqi@0 345
aoqi@0 346 @Override
aoqi@0 347 public JCTree getTree() {
aoqi@0 348 return null;
aoqi@0 349 }
aoqi@0 350
aoqi@0 351 @Override
aoqi@0 352 public int getStartPosition() {
aoqi@0 353 return pos;
aoqi@0 354 }
aoqi@0 355
aoqi@0 356 @Override
aoqi@0 357 public int getPreferredPosition() {
aoqi@0 358 return pos + body.length() - 1;
aoqi@0 359 }
aoqi@0 360
aoqi@0 361 @Override
aoqi@0 362 public int getEndPosition(EndPosTable endPosTable) {
aoqi@0 363 return pos + body.length();
aoqi@0 364 }
aoqi@0 365
aoqi@0 366 }
aoqi@0 367
aoqi@0 368 public static class DCIdentifier extends DCTree implements IdentifierTree {
aoqi@0 369 public final Name name;
aoqi@0 370
aoqi@0 371 DCIdentifier(Name name) {
aoqi@0 372 this.name = name;
aoqi@0 373 }
aoqi@0 374
aoqi@0 375 @Override
aoqi@0 376 public Kind getKind() {
aoqi@0 377 return Kind.IDENTIFIER;
aoqi@0 378 }
aoqi@0 379
aoqi@0 380 @Override
aoqi@0 381 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 382 return v.visitIdentifier(this, d);
aoqi@0 383 }
aoqi@0 384
aoqi@0 385 @Override
aoqi@0 386 public Name getName() {
aoqi@0 387 return name;
aoqi@0 388 }
aoqi@0 389 }
aoqi@0 390
aoqi@0 391 public static class DCInheritDoc extends DCInlineTag implements InheritDocTree {
aoqi@0 392 @Override
aoqi@0 393 public Kind getKind() {
aoqi@0 394 return Kind.INHERIT_DOC;
aoqi@0 395 }
aoqi@0 396
aoqi@0 397 @Override
aoqi@0 398 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 399 return v.visitInheritDoc(this, d);
aoqi@0 400 }
aoqi@0 401 }
aoqi@0 402
aoqi@0 403 public static class DCLink extends DCInlineTag implements LinkTree {
aoqi@0 404 public final Kind kind;
aoqi@0 405 public final DCReference ref;
aoqi@0 406 public final List<DCTree> label;
aoqi@0 407
aoqi@0 408 DCLink(Kind kind, DCReference ref, List<DCTree> label) {
aoqi@0 409 Assert.check(kind == Kind.LINK || kind == Kind.LINK_PLAIN);
aoqi@0 410 this.kind = kind;
aoqi@0 411 this.ref = ref;
aoqi@0 412 this.label = label;
aoqi@0 413 }
aoqi@0 414
aoqi@0 415 @Override
aoqi@0 416 public Kind getKind() {
aoqi@0 417 return kind;
aoqi@0 418 }
aoqi@0 419
aoqi@0 420 @Override
aoqi@0 421 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 422 return v.visitLink(this, d);
aoqi@0 423 }
aoqi@0 424
aoqi@0 425 @Override
aoqi@0 426 public ReferenceTree getReference() {
aoqi@0 427 return ref;
aoqi@0 428 }
aoqi@0 429
aoqi@0 430 @Override
aoqi@0 431 public List<? extends DocTree> getLabel() {
aoqi@0 432 return label;
aoqi@0 433 }
aoqi@0 434 }
aoqi@0 435
aoqi@0 436 public static class DCLiteral extends DCInlineTag implements LiteralTree {
aoqi@0 437 public final Kind kind;
aoqi@0 438 public final DCText body;
aoqi@0 439
aoqi@0 440 DCLiteral(Kind kind, DCText body) {
aoqi@0 441 Assert.check(kind == Kind.CODE || kind == Kind.LITERAL);
aoqi@0 442 this.kind = kind;
aoqi@0 443 this.body = body;
aoqi@0 444 }
aoqi@0 445
aoqi@0 446 @Override
aoqi@0 447 public Kind getKind() {
aoqi@0 448 return kind;
aoqi@0 449 }
aoqi@0 450
aoqi@0 451 @Override
aoqi@0 452 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 453 return v.visitLiteral(this, d);
aoqi@0 454 }
aoqi@0 455
aoqi@0 456 @Override
aoqi@0 457 public DCText getBody() {
aoqi@0 458 return body;
aoqi@0 459 }
aoqi@0 460 }
aoqi@0 461
aoqi@0 462 public static class DCParam extends DCBlockTag implements ParamTree {
aoqi@0 463 public final boolean isTypeParameter;
aoqi@0 464 public final DCIdentifier name;
aoqi@0 465 public final List<DCTree> description;
aoqi@0 466
aoqi@0 467 DCParam(boolean isTypeParameter, DCIdentifier name, List<DCTree> description) {
aoqi@0 468 this.isTypeParameter = isTypeParameter;
aoqi@0 469 this.name = name;
aoqi@0 470 this.description = description;
aoqi@0 471 }
aoqi@0 472
aoqi@0 473 @Override
aoqi@0 474 public Kind getKind() {
aoqi@0 475 return Kind.PARAM;
aoqi@0 476 }
aoqi@0 477
aoqi@0 478 @Override
aoqi@0 479 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 480 return v.visitParam(this, d);
aoqi@0 481 }
aoqi@0 482
aoqi@0 483 @Override
aoqi@0 484 public boolean isTypeParameter() {
aoqi@0 485 return isTypeParameter;
aoqi@0 486 }
aoqi@0 487
aoqi@0 488 @Override
aoqi@0 489 public IdentifierTree getName() {
aoqi@0 490 return name;
aoqi@0 491 }
aoqi@0 492
aoqi@0 493 @Override
aoqi@0 494 public List<? extends DocTree> getDescription() {
aoqi@0 495 return description;
aoqi@0 496 }
aoqi@0 497 }
aoqi@0 498
aoqi@0 499 public static class DCReference extends DCEndPosTree<DCReference> implements ReferenceTree {
aoqi@0 500 public final String signature;
aoqi@0 501
aoqi@0 502 // The following are not directly exposed through ReferenceTree
aoqi@0 503 // use DocTrees.getElement(TreePath,ReferenceTree)
aoqi@0 504 public final JCTree qualifierExpression;
aoqi@0 505 public final Name memberName;
aoqi@0 506 public final List<JCTree> paramTypes;
aoqi@0 507
aoqi@0 508
aoqi@0 509 DCReference(String signature, JCTree qualExpr, Name member, List<JCTree> paramTypes) {
aoqi@0 510 this.signature = signature;
aoqi@0 511 qualifierExpression = qualExpr;
aoqi@0 512 memberName = member;
aoqi@0 513 this.paramTypes = paramTypes;
aoqi@0 514 }
aoqi@0 515
aoqi@0 516 @Override
aoqi@0 517 public Kind getKind() {
aoqi@0 518 return Kind.REFERENCE;
aoqi@0 519 }
aoqi@0 520
aoqi@0 521 @Override
aoqi@0 522 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 523 return v.visitReference(this, d);
aoqi@0 524 }
aoqi@0 525
aoqi@0 526 @Override
aoqi@0 527 public String getSignature() {
aoqi@0 528 return signature;
aoqi@0 529 }
aoqi@0 530 }
aoqi@0 531
aoqi@0 532 public static class DCReturn extends DCBlockTag implements ReturnTree {
aoqi@0 533 public final List<DCTree> description;
aoqi@0 534
aoqi@0 535 DCReturn(List<DCTree> description) {
aoqi@0 536 this.description = description;
aoqi@0 537 }
aoqi@0 538
aoqi@0 539 @Override
aoqi@0 540 public Kind getKind() {
aoqi@0 541 return Kind.RETURN;
aoqi@0 542 }
aoqi@0 543
aoqi@0 544 @Override
aoqi@0 545 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 546 return v.visitReturn(this, d);
aoqi@0 547 }
aoqi@0 548
aoqi@0 549 @Override
aoqi@0 550 public List<? extends DocTree> getDescription() {
aoqi@0 551 return description;
aoqi@0 552 }
aoqi@0 553 }
aoqi@0 554
aoqi@0 555 public static class DCSee extends DCBlockTag implements SeeTree {
aoqi@0 556 public final List<DCTree> reference;
aoqi@0 557
aoqi@0 558 DCSee(List<DCTree> reference) {
aoqi@0 559 this.reference = reference;
aoqi@0 560 }
aoqi@0 561
aoqi@0 562 @Override
aoqi@0 563 public Kind getKind() {
aoqi@0 564 return Kind.SEE;
aoqi@0 565 }
aoqi@0 566
aoqi@0 567 @Override
aoqi@0 568 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 569 return v.visitSee(this, d);
aoqi@0 570 }
aoqi@0 571
aoqi@0 572 @Override
aoqi@0 573 public List<? extends DocTree> getReference() {
aoqi@0 574 return reference;
aoqi@0 575 }
aoqi@0 576 }
aoqi@0 577
aoqi@0 578 public static class DCSerial extends DCBlockTag implements SerialTree {
aoqi@0 579 public final List<DCTree> description;
aoqi@0 580
aoqi@0 581 DCSerial(List<DCTree> description) {
aoqi@0 582 this.description = description;
aoqi@0 583 }
aoqi@0 584
aoqi@0 585 @Override
aoqi@0 586 public Kind getKind() {
aoqi@0 587 return Kind.SERIAL;
aoqi@0 588 }
aoqi@0 589
aoqi@0 590 @Override
aoqi@0 591 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 592 return v.visitSerial(this, d);
aoqi@0 593 }
aoqi@0 594
aoqi@0 595 @Override
aoqi@0 596 public List<? extends DocTree> getDescription() {
aoqi@0 597 return description;
aoqi@0 598 }
aoqi@0 599 }
aoqi@0 600
aoqi@0 601 public static class DCSerialData extends DCBlockTag implements SerialDataTree {
aoqi@0 602 public final List<DCTree> description;
aoqi@0 603
aoqi@0 604 DCSerialData(List<DCTree> description) {
aoqi@0 605 this.description = description;
aoqi@0 606 }
aoqi@0 607
aoqi@0 608 @Override
aoqi@0 609 public Kind getKind() {
aoqi@0 610 return Kind.SERIAL_DATA;
aoqi@0 611 }
aoqi@0 612
aoqi@0 613 @Override
aoqi@0 614 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 615 return v.visitSerialData(this, d);
aoqi@0 616 }
aoqi@0 617
aoqi@0 618 @Override
aoqi@0 619 public List<? extends DocTree> getDescription() {
aoqi@0 620 return description;
aoqi@0 621 }
aoqi@0 622 }
aoqi@0 623
aoqi@0 624 public static class DCSerialField extends DCBlockTag implements SerialFieldTree {
aoqi@0 625 public final DCIdentifier name;
aoqi@0 626 public final DCReference type;
aoqi@0 627 public final List<DCTree> description;
aoqi@0 628
aoqi@0 629 DCSerialField(DCIdentifier name, DCReference type, List<DCTree> description) {
aoqi@0 630 this.description = description;
aoqi@0 631 this.name = name;
aoqi@0 632 this.type = type;
aoqi@0 633 }
aoqi@0 634
aoqi@0 635 @Override
aoqi@0 636 public Kind getKind() {
aoqi@0 637 return Kind.SERIAL_FIELD;
aoqi@0 638 }
aoqi@0 639
aoqi@0 640 @Override
aoqi@0 641 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 642 return v.visitSerialField(this, d);
aoqi@0 643 }
aoqi@0 644
aoqi@0 645 @Override
aoqi@0 646 public List<? extends DocTree> getDescription() {
aoqi@0 647 return description;
aoqi@0 648 }
aoqi@0 649
aoqi@0 650 @Override
aoqi@0 651 public IdentifierTree getName() {
aoqi@0 652 return name;
aoqi@0 653 }
aoqi@0 654
aoqi@0 655 @Override
aoqi@0 656 public ReferenceTree getType() {
aoqi@0 657 return type;
aoqi@0 658 }
aoqi@0 659 }
aoqi@0 660
aoqi@0 661 public static class DCSince extends DCBlockTag implements SinceTree {
aoqi@0 662 public final List<DCTree> body;
aoqi@0 663
aoqi@0 664 DCSince(List<DCTree> body) {
aoqi@0 665 this.body = body;
aoqi@0 666 }
aoqi@0 667
aoqi@0 668 @Override
aoqi@0 669 public Kind getKind() {
aoqi@0 670 return Kind.SINCE;
aoqi@0 671 }
aoqi@0 672
aoqi@0 673 @Override
aoqi@0 674 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 675 return v.visitSince(this, d);
aoqi@0 676 }
aoqi@0 677
aoqi@0 678 @Override
aoqi@0 679 public List<? extends DocTree> getBody() {
aoqi@0 680 return body;
aoqi@0 681 }
aoqi@0 682 }
aoqi@0 683
aoqi@0 684 public static class DCStartElement extends DCEndPosTree<DCStartElement> implements StartElementTree {
aoqi@0 685 public final Name name;
aoqi@0 686 public final List<DCTree> attrs;
aoqi@0 687 public final boolean selfClosing;
aoqi@0 688
aoqi@0 689 DCStartElement(Name name, List<DCTree> attrs, boolean selfClosing) {
aoqi@0 690 this.name = name;
aoqi@0 691 this.attrs = attrs;
aoqi@0 692 this.selfClosing = selfClosing;
aoqi@0 693 }
aoqi@0 694
aoqi@0 695 @Override
aoqi@0 696 public Kind getKind() {
aoqi@0 697 return Kind.START_ELEMENT;
aoqi@0 698 }
aoqi@0 699
aoqi@0 700 @Override
aoqi@0 701 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 702 return v.visitStartElement(this, d);
aoqi@0 703 }
aoqi@0 704
aoqi@0 705 @Override
aoqi@0 706 public Name getName() {
aoqi@0 707 return name;
aoqi@0 708 }
aoqi@0 709
aoqi@0 710 @Override
aoqi@0 711 public List<? extends DocTree> getAttributes() {
aoqi@0 712 return attrs;
aoqi@0 713 }
aoqi@0 714
aoqi@0 715 @Override
aoqi@0 716 public boolean isSelfClosing() {
aoqi@0 717 return selfClosing;
aoqi@0 718 }
aoqi@0 719 }
aoqi@0 720
aoqi@0 721 public static class DCText extends DCTree implements TextTree {
aoqi@0 722 public final String text;
aoqi@0 723
aoqi@0 724 DCText(String text) {
aoqi@0 725 this.text = text;
aoqi@0 726 }
aoqi@0 727
aoqi@0 728 @Override
aoqi@0 729 public Kind getKind() {
aoqi@0 730 return Kind.TEXT;
aoqi@0 731 }
aoqi@0 732
aoqi@0 733 @Override
aoqi@0 734 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 735 return v.visitText(this, d);
aoqi@0 736 }
aoqi@0 737
aoqi@0 738 @Override
aoqi@0 739 public String getBody() {
aoqi@0 740 return text;
aoqi@0 741 }
aoqi@0 742 }
aoqi@0 743
aoqi@0 744 public static class DCThrows extends DCBlockTag implements ThrowsTree {
aoqi@0 745 public final Kind kind;
aoqi@0 746 public final DCReference name;
aoqi@0 747 public final List<DCTree> description;
aoqi@0 748
aoqi@0 749 DCThrows(Kind kind, DCReference name, List<DCTree> description) {
aoqi@0 750 Assert.check(kind == Kind.EXCEPTION || kind == Kind.THROWS);
aoqi@0 751 this.kind = kind;
aoqi@0 752 this.name = name;
aoqi@0 753 this.description = description;
aoqi@0 754 }
aoqi@0 755
aoqi@0 756 @Override
aoqi@0 757 public Kind getKind() {
aoqi@0 758 return kind;
aoqi@0 759 }
aoqi@0 760
aoqi@0 761 @Override
aoqi@0 762 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 763 return v.visitThrows(this, d);
aoqi@0 764 }
aoqi@0 765
aoqi@0 766 @Override
aoqi@0 767 public ReferenceTree getExceptionName() {
aoqi@0 768 return name;
aoqi@0 769 }
aoqi@0 770
aoqi@0 771 @Override
aoqi@0 772 public List<? extends DocTree> getDescription() {
aoqi@0 773 return description;
aoqi@0 774 }
aoqi@0 775 }
aoqi@0 776
aoqi@0 777 public static class DCUnknownBlockTag extends DCBlockTag implements UnknownBlockTagTree {
aoqi@0 778 public final Name name;
aoqi@0 779 public final List<DCTree> content;
aoqi@0 780
aoqi@0 781 DCUnknownBlockTag(Name name, List<DCTree> content) {
aoqi@0 782 this.name = name;
aoqi@0 783 this.content = content;
aoqi@0 784 }
aoqi@0 785
aoqi@0 786 @Override
aoqi@0 787 public Kind getKind() {
aoqi@0 788 return Kind.UNKNOWN_BLOCK_TAG;
aoqi@0 789 }
aoqi@0 790
aoqi@0 791 @Override
aoqi@0 792 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 793 return v.visitUnknownBlockTag(this, d);
aoqi@0 794 }
aoqi@0 795
aoqi@0 796 @Override
aoqi@0 797 public String getTagName() {
aoqi@0 798 return name.toString();
aoqi@0 799 }
aoqi@0 800
aoqi@0 801 @Override
aoqi@0 802 public List<? extends DocTree> getContent() {
aoqi@0 803 return content;
aoqi@0 804 }
aoqi@0 805 }
aoqi@0 806
aoqi@0 807 public static class DCUnknownInlineTag extends DCInlineTag implements UnknownInlineTagTree {
aoqi@0 808 public final Name name;
aoqi@0 809 public final List<DCTree> content;
aoqi@0 810
aoqi@0 811 DCUnknownInlineTag(Name name, List<DCTree> content) {
aoqi@0 812 this.name = name;
aoqi@0 813 this.content = content;
aoqi@0 814 }
aoqi@0 815
aoqi@0 816 @Override
aoqi@0 817 public Kind getKind() {
aoqi@0 818 return Kind.UNKNOWN_INLINE_TAG;
aoqi@0 819 }
aoqi@0 820
aoqi@0 821 @Override
aoqi@0 822 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 823 return v.visitUnknownInlineTag(this, d);
aoqi@0 824 }
aoqi@0 825
aoqi@0 826 @Override
aoqi@0 827 public String getTagName() {
aoqi@0 828 return name.toString();
aoqi@0 829 }
aoqi@0 830
aoqi@0 831 @Override
aoqi@0 832 public List<? extends DocTree> getContent() {
aoqi@0 833 return content;
aoqi@0 834 }
aoqi@0 835 }
aoqi@0 836
aoqi@0 837 public static class DCValue extends DCInlineTag implements ValueTree {
aoqi@0 838 public final DCReference ref;
aoqi@0 839
aoqi@0 840 DCValue(DCReference ref) {
aoqi@0 841 this.ref = ref;
aoqi@0 842 }
aoqi@0 843
aoqi@0 844 @Override
aoqi@0 845 public Kind getKind() {
aoqi@0 846 return Kind.VALUE;
aoqi@0 847 }
aoqi@0 848
aoqi@0 849 @Override
aoqi@0 850 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 851 return v.visitValue(this, d);
aoqi@0 852 }
aoqi@0 853
aoqi@0 854 @Override
aoqi@0 855 public ReferenceTree getReference() {
aoqi@0 856 return ref;
aoqi@0 857 }
aoqi@0 858 }
aoqi@0 859
aoqi@0 860 public static class DCVersion extends DCBlockTag implements VersionTree {
aoqi@0 861 public final List<DCTree> body;
aoqi@0 862
aoqi@0 863 DCVersion(List<DCTree> body) {
aoqi@0 864 this.body = body;
aoqi@0 865 }
aoqi@0 866
aoqi@0 867 @Override
aoqi@0 868 public Kind getKind() {
aoqi@0 869 return Kind.VERSION;
aoqi@0 870 }
aoqi@0 871
aoqi@0 872 @Override
aoqi@0 873 public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
aoqi@0 874 return v.visitVersion(this, d);
aoqi@0 875 }
aoqi@0 876
aoqi@0 877 @Override
aoqi@0 878 public List<? extends DocTree> getBody() {
aoqi@0 879 return body;
aoqi@0 880 }
aoqi@0 881 }
aoqi@0 882
aoqi@0 883 }

mercurial