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