| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
package com.google.javascript.rhino; |
| 41 |
|
| 42 |
import com.google.common.base.Preconditions; |
| 43 |
import com.google.common.collect.ImmutableList; |
| 44 |
import com.google.common.collect.ImmutableSet; |
| 45 |
import com.google.common.collect.Lists; |
| 46 |
import com.google.common.collect.Sets; |
| 47 |
|
| 48 |
import java.io.Serializable; |
| 49 |
import java.util.Collection; |
| 50 |
import java.util.Collections; |
| 51 |
import java.util.LinkedHashMap; |
| 52 |
import java.util.List; |
| 53 |
import java.util.Map; |
| 54 |
import java.util.Set; |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
public class JSDocInfo implements Serializable { |
| 69 |
private static final long serialVersionUID = 1L; |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
public enum Visibility { |
| 78 |
PRIVATE, |
| 79 |
PROTECTED, |
| 80 |
PUBLIC, |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
INHERITED |
| 85 |
} |
| 86 |
|
| 87 |
private static final class LazilyInitializedInfo implements Serializable { |
| 88 |
private static final long serialVersionUID = 1L; |
| 89 |
|
| 90 |
|
| 91 |
JSTypeExpression baseType = null; |
| 92 |
List<JSTypeExpression> extendedInterfaces = null; |
| 93 |
List<JSTypeExpression> implementedInterfaces = null; |
| 94 |
Map<String, JSTypeExpression> parameters = null; |
| 95 |
List<JSTypeExpression> thrownTypes = null; |
| 96 |
ImmutableList<String> templateTypeNames = null; |
| 97 |
ImmutableList<String> classTemplateTypeNames = null; |
| 98 |
|
| 99 |
|
| 100 |
String description = null; |
| 101 |
String meaning = null; |
| 102 |
String deprecated = null; |
| 103 |
String license = null; |
| 104 |
Set<String> suppressions = null; |
| 105 |
Set<String> modifies = null; |
| 106 |
String lendsName = null; |
| 107 |
boolean ngInject = false; |
| 108 |
} |
| 109 |
|
| 110 |
private static final class LazilyInitializedDocumentation { |
| 111 |
String sourceComment = null; |
| 112 |
List<Marker> markers = null; |
| 113 |
|
| 114 |
Map<String, String> parameters = null; |
| 115 |
Map<JSTypeExpression, String> throwsDescriptions = null; |
| 116 |
String blockDescription = null; |
| 117 |
String fileOverview = null; |
| 118 |
String returnDescription = null; |
| 119 |
String version = null; |
| 120 |
|
| 121 |
List<String> authors = null; |
| 122 |
List<String> sees = null; |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
public static class StringPosition extends SourcePosition<String> { |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
static class TrimmedStringPosition extends StringPosition { |
| 137 |
@Override public void setItem(String item) { |
| 138 |
Preconditions.checkArgument( |
| 139 |
item.charAt(0) != ' ' && |
| 140 |
item.charAt(item.length() - 1) != ' ', |
| 141 |
"String has leading or trailing whitespace"); |
| 142 |
super.setItem(item); |
| 143 |
} |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
public static class NamePosition extends SourcePosition<Node> {} |
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
public static class TypePosition extends SourcePosition<Node> { |
| 157 |
private boolean brackets = false; |
| 158 |
|
| 159 |
|
| 160 |
public boolean hasBrackets() { |
| 161 |
return brackets; |
| 162 |
} |
| 163 |
|
| 164 |
void setHasBrackets(boolean newVal) { |
| 165 |
brackets = newVal; |
| 166 |
} |
| 167 |
} |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
public static final class Marker { |
| 180 |
private TrimmedStringPosition annotation = null; |
| 181 |
private TrimmedStringPosition name = null; |
| 182 |
private SourcePosition<Node> nameNode = null; |
| 183 |
private StringPosition description = null; |
| 184 |
private TypePosition type = null; |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
public StringPosition getAnnotation() { |
| 190 |
return annotation; |
| 191 |
} |
| 192 |
|
| 193 |
void setAnnotation(TrimmedStringPosition p) { |
| 194 |
annotation = p; |
| 195 |
} |
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
@Deprecated |
| 203 |
public StringPosition getName() { |
| 204 |
return name; |
| 205 |
} |
| 206 |
|
| 207 |
void setName(TrimmedStringPosition p) { |
| 208 |
name = p; |
| 209 |
} |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
public SourcePosition<Node> getNameNode() { |
| 216 |
return nameNode; |
| 217 |
} |
| 218 |
|
| 219 |
void setNameNode(SourcePosition<Node> p) { |
| 220 |
nameNode = p; |
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
public StringPosition getDescription() { |
| 228 |
return description; |
| 229 |
} |
| 230 |
|
| 231 |
void setDescription(StringPosition p) { |
| 232 |
description = p; |
| 233 |
} |
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
public TypePosition getType() { |
| 240 |
return type; |
| 241 |
} |
| 242 |
|
| 243 |
void setType(TypePosition p) { |
| 244 |
type = p; |
| 245 |
} |
| 246 |
} |
| 247 |
|
| 248 |
private LazilyInitializedInfo info = null; |
| 249 |
|
| 250 |
private LazilyInitializedDocumentation documentation = null; |
| 251 |
|
| 252 |
|
| 253 |
private Node associatedNode = null; |
| 254 |
|
| 255 |
private Visibility visibility = null; |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
private int bitset = 0x00; |
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
private JSTypeExpression type = null; |
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
private JSTypeExpression thisType = null; |
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
private boolean includeDocumentation = false; |
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
private static final int MASK_FLAGS = 0x3FFFFFFF; |
| 298 |
|
| 299 |
private static final int MASK_CONSTANT = 0x00000001; |
| 300 |
private static final int MASK_CONSTRUCTOR = 0x00000002; |
| 301 |
private static final int MASK_DEFINE = 0x00000004; |
| 302 |
private static final int MASK_HIDDEN = 0x00000008; |
| 303 |
private static final int MASK_PRESERVETRY = 0x00000010; |
| 304 |
private static final int MASK_NOCHECK = 0x00000020; |
| 305 |
private static final int MASK_OVERRIDE = 0x00000040; |
| 306 |
private static final int MASK_NOALIAS = 0x00000080; |
| 307 |
private static final int MASK_DEPRECATED = 0x00000100; |
| 308 |
private static final int MASK_INTERFACE = 0x00000200; |
| 309 |
private static final int MASK_EXPORT = 0x00000400; |
| 310 |
private static final int MASK_NOSHADOW = 0x00000800; |
| 311 |
private static final int MASK_FILEOVERVIEW = 0x00001000; |
| 312 |
private static final int MASK_IMPLICITCAST = 0x00002000; |
| 313 |
private static final int MASK_NOSIDEEFFECTS = 0x00004000; |
| 314 |
private static final int MASK_EXTERNS = 0x00008000; |
| 315 |
private static final int MASK_JAVADISPATCH = 0x00010000; |
| 316 |
private static final int MASK_NOCOMPILE = 0x00020000; |
| 317 |
private static final int MASK_CONSISTIDGEN = 0x00040000; |
| 318 |
private static final int MASK_IDGEN = 0x00080000; |
| 319 |
private static final int MASK_EXPOSE = 0x00100000; |
| 320 |
private static final int MASK_STRUCT = 0x00200000; |
| 321 |
private static final int MASK_DICT = 0x00400000; |
| 322 |
private static final int MASK_STALBEIDGEN = 0x00800000; |
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
private static final int MASK_TYPEFIELD = 0xE0000000; |
| 327 |
private static final int TYPEFIELD_TYPE = 0x20000000; |
| 328 |
private static final int TYPEFIELD_RETURN = 0x40000000; |
| 329 |
private static final int TYPEFIELD_ENUM = 0x60000000; |
| 330 |
private static final int TYPEFIELD_TYPEDEF = 0x80000000; |
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
JSDocInfo(boolean includeDocumentation) { |
| 337 |
this.includeDocumentation = includeDocumentation; |
| 338 |
} |
| 339 |
|
| 340 |
|
| 341 |
public JSDocInfo() {} |
| 342 |
|
| 343 |
void setConsistentIdGenerator(boolean value) { |
| 344 |
setFlag(value, MASK_CONSISTIDGEN); |
| 345 |
} |
| 346 |
|
| 347 |
void setStableIdGenerator(boolean value) { |
| 348 |
setFlag(value, MASK_STALBEIDGEN); |
| 349 |
} |
| 350 |
|
| 351 |
void setConstant(boolean value) { |
| 352 |
setFlag(value, MASK_CONSTANT); |
| 353 |
} |
| 354 |
|
| 355 |
void setConstructor(boolean value) { |
| 356 |
setFlag(value, MASK_CONSTRUCTOR); |
| 357 |
} |
| 358 |
|
| 359 |
void setStruct() { |
| 360 |
setFlag(true, MASK_STRUCT); |
| 361 |
} |
| 362 |
|
| 363 |
void setDict() { |
| 364 |
setFlag(true, MASK_DICT); |
| 365 |
} |
| 366 |
|
| 367 |
void setDefine(boolean value) { |
| 368 |
setFlag(value, MASK_DEFINE); |
| 369 |
} |
| 370 |
|
| 371 |
void setHidden(boolean value) { |
| 372 |
setFlag(value, MASK_HIDDEN); |
| 373 |
} |
| 374 |
|
| 375 |
void setNoCheck(boolean value) { |
| 376 |
setFlag(value, MASK_NOCHECK); |
| 377 |
} |
| 378 |
|
| 379 |
void setShouldPreserveTry(boolean value) { |
| 380 |
setFlag(value, MASK_PRESERVETRY); |
| 381 |
} |
| 382 |
|
| 383 |
void setOverride(boolean value) { |
| 384 |
setFlag(value, MASK_OVERRIDE); |
| 385 |
} |
| 386 |
|
| 387 |
void setNoAlias(boolean value) { |
| 388 |
setFlag(value, MASK_NOALIAS); |
| 389 |
} |
| 390 |
|
| 391 |
|
| 392 |
public void setDeprecated(boolean value) { |
| 393 |
setFlag(value, MASK_DEPRECATED); |
| 394 |
} |
| 395 |
|
| 396 |
void setInterface(boolean value) { |
| 397 |
setFlag(value, MASK_INTERFACE); |
| 398 |
} |
| 399 |
|
| 400 |
void setExport(boolean value) { |
| 401 |
setFlag(value, MASK_EXPORT); |
| 402 |
} |
| 403 |
|
| 404 |
void setExpose(boolean value) { |
| 405 |
setFlag(value, MASK_EXPOSE); |
| 406 |
} |
| 407 |
|
| 408 |
void setNoShadow(boolean value) { |
| 409 |
setFlag(value, MASK_NOSHADOW); |
| 410 |
} |
| 411 |
|
| 412 |
void setIdGenerator(boolean value) { |
| 413 |
setFlag(value, MASK_IDGEN); |
| 414 |
} |
| 415 |
|
| 416 |
void setImplicitCast(boolean value) { |
| 417 |
setFlag(value, MASK_IMPLICITCAST); |
| 418 |
} |
| 419 |
|
| 420 |
void setNoSideEffects(boolean value) { |
| 421 |
setFlag(value, MASK_NOSIDEEFFECTS); |
| 422 |
} |
| 423 |
|
| 424 |
void setExterns(boolean value) { |
| 425 |
setFlag(value, MASK_EXTERNS); |
| 426 |
} |
| 427 |
|
| 428 |
void setJavaDispatch(boolean value) { |
| 429 |
setFlag(value, MASK_JAVADISPATCH); |
| 430 |
} |
| 431 |
|
| 432 |
void setNoCompile(boolean value) { |
| 433 |
setFlag(value, MASK_NOCOMPILE); |
| 434 |
} |
| 435 |
|
| 436 |
private void setFlag(boolean value, int mask) { |
| 437 |
if (value) { |
| 438 |
bitset |= mask; |
| 439 |
} else { |
| 440 |
bitset &= ~mask; |
| 441 |
} |
| 442 |
} |
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
public boolean isConsistentIdGenerator() { |
| 449 |
return getFlag(MASK_CONSISTIDGEN); |
| 450 |
} |
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
public boolean isStableIdGenerator() { |
| 456 |
return getFlag(MASK_STALBEIDGEN); |
| 457 |
} |
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
public boolean isConstant() { |
| 464 |
return getFlag(MASK_CONSTANT) || isDefine(); |
| 465 |
} |
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
public boolean isConstructor() { |
| 472 |
return getFlag(MASK_CONSTRUCTOR); |
| 473 |
} |
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
public boolean makesStructs() { |
| 480 |
return getFlag(MASK_STRUCT); |
| 481 |
} |
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
public boolean makesDicts() { |
| 488 |
return getFlag(MASK_DICT); |
| 489 |
} |
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
public boolean isDefine() { |
| 497 |
return getFlag(MASK_DEFINE); |
| 498 |
} |
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
public boolean isHidden() { |
| 505 |
return getFlag(MASK_HIDDEN); |
| 506 |
} |
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
public boolean isNoTypeCheck() { |
| 513 |
return getFlag(MASK_NOCHECK); |
| 514 |
} |
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
public boolean shouldPreserveTry() { |
| 521 |
return getFlag(MASK_PRESERVETRY); |
| 522 |
} |
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
public boolean isOverride() { |
| 529 |
return getFlag(MASK_OVERRIDE); |
| 530 |
} |
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
public boolean isNoAlias() { |
| 537 |
return getFlag(MASK_NOALIAS); |
| 538 |
} |
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
public boolean isDeprecated() { |
| 545 |
return getFlag(MASK_DEPRECATED); |
| 546 |
} |
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
public boolean isInterface() { |
| 553 |
return getFlag(MASK_INTERFACE); |
| 554 |
} |
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
public boolean isExport() { |
| 561 |
return getFlag(MASK_EXPORT); |
| 562 |
} |
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
public boolean isExpose() { |
| 569 |
return getFlag(MASK_EXPOSE); |
| 570 |
} |
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
public boolean isNoShadow() { |
| 577 |
return getFlag(MASK_NOSHADOW); |
| 578 |
} |
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
public boolean isIdGenerator() { |
| 585 |
return getFlag(MASK_IDGEN); |
| 586 |
} |
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
public boolean isImplicitCast() { |
| 593 |
return getFlag(MASK_IMPLICITCAST); |
| 594 |
} |
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
public boolean isNoSideEffects() { |
| 601 |
return getFlag(MASK_NOSIDEEFFECTS); |
| 602 |
} |
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
public boolean isExterns() { |
| 609 |
return getFlag(MASK_EXTERNS); |
| 610 |
} |
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
public boolean isJavaDispatch() { |
| 617 |
return getFlag(MASK_JAVADISPATCH); |
| 618 |
} |
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
public boolean isNoCompile() { |
| 625 |
return getFlag(MASK_NOCOMPILE); |
| 626 |
} |
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
public boolean containsDeclaration() { |
| 632 |
return (hasType() |
| 633 |
|| hasReturnType() |
| 634 |
|| hasEnumParameterType() |
| 635 |
|| hasTypedefType() |
| 636 |
|| hasThisType() |
| 637 |
|| getParameterCount() > 0 |
| 638 |
|| getFlag(MASK_CONSTANT |
| 639 |
| MASK_CONSTRUCTOR |
| 640 |
| MASK_DEFINE |
| 641 |
| MASK_OVERRIDE |
| 642 |
| MASK_NOALIAS |
| 643 |
| MASK_DEPRECATED |
| 644 |
| MASK_INTERFACE |
| 645 |
| MASK_NOSHADOW |
| 646 |
| MASK_IMPLICITCAST |
| 647 |
| MASK_NOSIDEEFFECTS)); |
| 648 |
} |
| 649 |
|
| 650 |
private boolean getFlag(int mask) { |
| 651 |
return (bitset & mask) != 0x00; |
| 652 |
} |
| 653 |
|
| 654 |
|
| 655 |
public void setVisibility(Visibility visibility) { |
| 656 |
this.visibility = visibility; |
| 657 |
} |
| 658 |
|
| 659 |
private void lazyInitInfo() { |
| 660 |
if (info == null) { |
| 661 |
info = new LazilyInitializedInfo(); |
| 662 |
} |
| 663 |
} |
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
private boolean lazyInitDocumentation() { |
| 670 |
if (!includeDocumentation) { |
| 671 |
return false; |
| 672 |
} |
| 673 |
|
| 674 |
if (documentation == null) { |
| 675 |
documentation = new LazilyInitializedDocumentation(); |
| 676 |
} |
| 677 |
|
| 678 |
return true; |
| 679 |
} |
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
Marker addMarker() { |
| 686 |
if (!lazyInitDocumentation()) { |
| 687 |
return null; |
| 688 |
} |
| 689 |
|
| 690 |
if (documentation.markers == null) { |
| 691 |
documentation.markers = Lists.newArrayList(); |
| 692 |
} |
| 693 |
|
| 694 |
Marker marker = new Marker(); |
| 695 |
documentation.markers.add(marker); |
| 696 |
return marker; |
| 697 |
} |
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
boolean setDeprecationReason(String reason) { |
| 705 |
lazyInitInfo(); |
| 706 |
|
| 707 |
if (info.deprecated != null) { |
| 708 |
return false; |
| 709 |
} |
| 710 |
|
| 711 |
info.deprecated = reason; |
| 712 |
return true; |
| 713 |
} |
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
public void addSuppression(String suppression) { |
| 719 |
lazyInitInfo(); |
| 720 |
|
| 721 |
if (info.suppressions == null) { |
| 722 |
info.suppressions = Sets.newHashSet(); |
| 723 |
} |
| 724 |
info.suppressions.add(suppression); |
| 725 |
} |
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
boolean setSuppressions(Set<String> suppressions) { |
| 732 |
lazyInitInfo(); |
| 733 |
|
| 734 |
if (info.suppressions != null) { |
| 735 |
return false; |
| 736 |
} |
| 737 |
|
| 738 |
info.suppressions = suppressions; |
| 739 |
return true; |
| 740 |
} |
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
void addModifies(String modifies) { |
| 746 |
lazyInitInfo(); |
| 747 |
|
| 748 |
if (info.modifies == null) { |
| 749 |
info.modifies = Sets.newHashSet(); |
| 750 |
} |
| 751 |
info.modifies.add(modifies); |
| 752 |
} |
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
boolean setModifies(Set<String> modifies) { |
| 759 |
lazyInitInfo(); |
| 760 |
|
| 761 |
if (info.modifies != null) { |
| 762 |
return false; |
| 763 |
} |
| 764 |
|
| 765 |
info.modifies = modifies; |
| 766 |
return true; |
| 767 |
} |
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
boolean documentVersion(String version) { |
| 773 |
if (!lazyInitDocumentation()) { |
| 774 |
return true; |
| 775 |
} |
| 776 |
|
| 777 |
if (documentation.version != null) { |
| 778 |
return false; |
| 779 |
} |
| 780 |
|
| 781 |
documentation.version = version; |
| 782 |
return true; |
| 783 |
} |
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
boolean documentReference(String reference) { |
| 789 |
if (!lazyInitDocumentation()) { |
| 790 |
return true; |
| 791 |
} |
| 792 |
|
| 793 |
if (documentation.sees == null) { |
| 794 |
documentation.sees = Lists.newArrayList(); |
| 795 |
} |
| 796 |
|
| 797 |
documentation.sees.add(reference); |
| 798 |
return true; |
| 799 |
} |
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
|
| 804 |
boolean documentAuthor(String author) { |
| 805 |
if (!lazyInitDocumentation()) { |
| 806 |
return true; |
| 807 |
} |
| 808 |
|
| 809 |
if (documentation.authors == null) { |
| 810 |
documentation.authors = Lists.newArrayList(); |
| 811 |
} |
| 812 |
|
| 813 |
documentation.authors.add(author); |
| 814 |
return true; |
| 815 |
} |
| 816 |
|
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
boolean documentThrows(JSTypeExpression type, String throwsDescription) { |
| 821 |
if (!lazyInitDocumentation()) { |
| 822 |
return true; |
| 823 |
} |
| 824 |
|
| 825 |
if (documentation.throwsDescriptions == null) { |
| 826 |
documentation.throwsDescriptions = |
| 827 |
new LinkedHashMap<JSTypeExpression, String>(); |
| 828 |
} |
| 829 |
|
| 830 |
if (!documentation.throwsDescriptions.containsKey(type)) { |
| 831 |
documentation.throwsDescriptions.put(type, throwsDescription); |
| 832 |
return true; |
| 833 |
} |
| 834 |
|
| 835 |
return false; |
| 836 |
} |
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
boolean documentParam(String parameter, String description) { |
| 847 |
if (!lazyInitDocumentation()) { |
| 848 |
return true; |
| 849 |
} |
| 850 |
|
| 851 |
if (documentation.parameters == null) { |
| 852 |
documentation.parameters = new LinkedHashMap<String, String>(); |
| 853 |
} |
| 854 |
|
| 855 |
if (!documentation.parameters.containsKey(parameter)) { |
| 856 |
documentation.parameters.put(parameter, description); |
| 857 |
return true; |
| 858 |
} else { |
| 859 |
return false; |
| 860 |
} |
| 861 |
} |
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
boolean documentBlock(String description) { |
| 869 |
if (!lazyInitDocumentation()) { |
| 870 |
return true; |
| 871 |
} |
| 872 |
|
| 873 |
if (documentation.blockDescription != null) { |
| 874 |
return false; |
| 875 |
} |
| 876 |
|
| 877 |
documentation.blockDescription = description; |
| 878 |
return true; |
| 879 |
} |
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
boolean documentFileOverview(String description) { |
| 887 |
setFlag(true, MASK_FILEOVERVIEW); |
| 888 |
if (!lazyInitDocumentation()) { |
| 889 |
return true; |
| 890 |
} |
| 891 |
|
| 892 |
if (documentation.fileOverview != null) { |
| 893 |
return false; |
| 894 |
} |
| 895 |
|
| 896 |
documentation.fileOverview = description; |
| 897 |
return true; |
| 898 |
} |
| 899 |
|
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
|
| 905 |
|
| 906 |
boolean documentReturn(String description) { |
| 907 |
if (!lazyInitDocumentation()) { |
| 908 |
return true; |
| 909 |
} |
| 910 |
|
| 911 |
if (documentation.returnDescription != null) { |
| 912 |
return false; |
| 913 |
} |
| 914 |
|
| 915 |
documentation.returnDescription = description; |
| 916 |
return true; |
| 917 |
} |
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
|
| 923 |
|
| 924 |
|
| 925 |
|
| 926 |
|
| 927 |
boolean declareParam(JSTypeExpression jsType, String parameter) { |
| 928 |
lazyInitInfo(); |
| 929 |
if (info.parameters == null) { |
| 930 |
info.parameters = new LinkedHashMap<String, JSTypeExpression>(); |
| 931 |
} |
| 932 |
if (!info.parameters.containsKey(parameter)) { |
| 933 |
info.parameters.put(parameter, jsType); |
| 934 |
return true; |
| 935 |
} else { |
| 936 |
return false; |
| 937 |
} |
| 938 |
} |
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
boolean declareTemplateTypeNames(List<String> templateTypeNames) { |
| 947 |
lazyInitInfo(); |
| 948 |
|
| 949 |
if (info.templateTypeNames != null) { |
| 950 |
return false; |
| 951 |
} |
| 952 |
|
| 953 |
info.templateTypeNames = ImmutableList.copyOf(templateTypeNames); |
| 954 |
return true; |
| 955 |
} |
| 956 |
|
| 957 |
|
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
boolean declareClassTemplateTypeNames(List<String> templateTypeNames) { |
| 964 |
lazyInitInfo(); |
| 965 |
|
| 966 |
if (info.classTemplateTypeNames != null) { |
| 967 |
return false; |
| 968 |
} |
| 969 |
|
| 970 |
info.classTemplateTypeNames = ImmutableList.copyOf(templateTypeNames); |
| 971 |
return true; |
| 972 |
} |
| 973 |
|
| 974 |
|
| 975 |
|
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
boolean declareThrows(JSTypeExpression jsType) { |
| 980 |
lazyInitInfo(); |
| 981 |
|
| 982 |
if (info.thrownTypes == null) { |
| 983 |
info.thrownTypes = Lists.newArrayList(); |
| 984 |
} |
| 985 |
|
| 986 |
info.thrownTypes.add(jsType); |
| 987 |
return true; |
| 988 |
} |
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
public Visibility getVisibility() { |
| 996 |
return visibility; |
| 997 |
} |
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
|
| 1005 |
public JSTypeExpression getParameterType(String parameter) { |
| 1006 |
if (info == null || info.parameters == null) { |
| 1007 |
return null; |
| 1008 |
} |
| 1009 |
return info.parameters.get(parameter); |
| 1010 |
} |
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
|
| 1015 |
public boolean hasParameter(String parameter) { |
| 1016 |
if (info == null || info.parameters == null) { |
| 1017 |
return false; |
| 1018 |
} |
| 1019 |
return info.parameters.containsKey(parameter); |
| 1020 |
} |
| 1021 |
|
| 1022 |
|
| 1023 |
|
| 1024 |
|
| 1025 |
|
| 1026 |
|
| 1027 |
|
| 1028 |
public boolean hasParameterType(String parameter) { |
| 1029 |
return getParameterType(parameter) != null; |
| 1030 |
} |
| 1031 |
|
| 1032 |
|
| 1033 |
|
| 1034 |
|
| 1035 |
|
| 1036 |
|
| 1037 |
|
| 1038 |
|
| 1039 |
public Set<String> getParameterNames() { |
| 1040 |
if (info == null || info.parameters == null) { |
| 1041 |
return ImmutableSet.of(); |
| 1042 |
} |
| 1043 |
return ImmutableSet.copyOf(info.parameters.keySet()); |
| 1044 |
} |
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
public int getParameterCount() { |
| 1050 |
if (info == null || info.parameters == null) { |
| 1051 |
return 0; |
| 1052 |
} |
| 1053 |
return info.parameters.size(); |
| 1054 |
} |
| 1055 |
|
| 1056 |
void setType(JSTypeExpression type) { |
| 1057 |
setType(type, TYPEFIELD_TYPE); |
| 1058 |
} |
| 1059 |
|
| 1060 |
void setReturnType(JSTypeExpression type) { |
| 1061 |
setType(type, TYPEFIELD_RETURN); |
| 1062 |
} |
| 1063 |
|
| 1064 |
void setEnumParameterType(JSTypeExpression type) { |
| 1065 |
setType(type, TYPEFIELD_ENUM); |
| 1066 |
} |
| 1067 |
|
| 1068 |
void setTypedefType(JSTypeExpression type) { |
| 1069 |
setType(type, TYPEFIELD_TYPEDEF); |
| 1070 |
} |
| 1071 |
|
| 1072 |
private void setType(JSTypeExpression type, int mask) { |
| 1073 |
if ((bitset & MASK_TYPEFIELD) != 0) { |
| 1074 |
throw new IllegalStateException( |
| 1075 |
"API tried to add two incompatible type tags. " + |
| 1076 |
"This should have been blocked and emitted a warning."); |
| 1077 |
} |
| 1078 |
this.bitset = (bitset & MASK_FLAGS) | mask; |
| 1079 |
this.type = type; |
| 1080 |
} |
| 1081 |
|
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
public List<JSTypeExpression> getThrownTypes() { |
| 1086 |
if (info == null || info.thrownTypes == null) { |
| 1087 |
return ImmutableList.of(); |
| 1088 |
} |
| 1089 |
return Collections.unmodifiableList(info.thrownTypes); |
| 1090 |
} |
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
public boolean hasType() { |
| 1097 |
return hasType(TYPEFIELD_TYPE); |
| 1098 |
} |
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
public boolean hasEnumParameterType() { |
| 1105 |
return hasType(TYPEFIELD_ENUM); |
| 1106 |
} |
| 1107 |
|
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
public boolean hasTypedefType() { |
| 1113 |
return hasType(TYPEFIELD_TYPEDEF); |
| 1114 |
} |
| 1115 |
|
| 1116 |
|
| 1117 |
|
| 1118 |
|
| 1119 |
|
| 1120 |
public boolean hasReturnType() { |
| 1121 |
return hasType(TYPEFIELD_RETURN); |
| 1122 |
} |
| 1123 |
|
| 1124 |
private boolean hasType(int mask) { |
| 1125 |
return (bitset & MASK_TYPEFIELD) == mask; |
| 1126 |
} |
| 1127 |
|
| 1128 |
|
| 1129 |
|
| 1130 |
|
| 1131 |
public JSTypeExpression getType() { |
| 1132 |
return getType(TYPEFIELD_TYPE); |
| 1133 |
} |
| 1134 |
|
| 1135 |
|
| 1136 |
|
| 1137 |
|
| 1138 |
public JSTypeExpression getReturnType() { |
| 1139 |
return getType(TYPEFIELD_RETURN); |
| 1140 |
} |
| 1141 |
|
| 1142 |
|
| 1143 |
|
| 1144 |
|
| 1145 |
public JSTypeExpression getEnumParameterType() { |
| 1146 |
return getType(TYPEFIELD_ENUM); |
| 1147 |
} |
| 1148 |
|
| 1149 |
|
| 1150 |
|
| 1151 |
|
| 1152 |
public JSTypeExpression getTypedefType() { |
| 1153 |
return getType(TYPEFIELD_TYPEDEF); |
| 1154 |
} |
| 1155 |
|
| 1156 |
private JSTypeExpression getType(int typefield) { |
| 1157 |
if ((MASK_TYPEFIELD & bitset) == typefield) { |
| 1158 |
return type; |
| 1159 |
} else { |
| 1160 |
return null; |
| 1161 |
} |
| 1162 |
} |
| 1163 |
|
| 1164 |
|
| 1165 |
|
| 1166 |
|
| 1167 |
public JSTypeExpression getThisType() { |
| 1168 |
return thisType; |
| 1169 |
} |
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
void setThisType(JSTypeExpression type) { |
| 1175 |
this.thisType = type; |
| 1176 |
} |
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 |
public boolean hasThisType() { |
| 1183 |
return thisType != null; |
| 1184 |
} |
| 1185 |
|
| 1186 |
void setBaseType(JSTypeExpression type) { |
| 1187 |
lazyInitInfo(); |
| 1188 |
info.baseType = type; |
| 1189 |
} |
| 1190 |
|
| 1191 |
|
| 1192 |
|
| 1193 |
|
| 1194 |
public JSTypeExpression getBaseType() { |
| 1195 |
return (info == null) ? null : info.baseType; |
| 1196 |
} |
| 1197 |
|
| 1198 |
|
| 1199 |
|
| 1200 |
|
| 1201 |
public String getDescription() { |
| 1202 |
return (info == null) ? null : info.description; |
| 1203 |
} |
| 1204 |
|
| 1205 |
void setDescription(String desc) { |
| 1206 |
lazyInitInfo(); |
| 1207 |
info.description = desc; |
| 1208 |
} |
| 1209 |
|
| 1210 |
|
| 1211 |
|
| 1212 |
|
| 1213 |
|
| 1214 |
|
| 1215 |
|
| 1216 |
|
| 1217 |
|
| 1218 |
|
| 1219 |
|
| 1220 |
|
| 1221 |
public String getMeaning() { |
| 1222 |
return (info == null) ? null : info.meaning; |
| 1223 |
} |
| 1224 |
|
| 1225 |
void setMeaning(String meaning) { |
| 1226 |
lazyInitInfo(); |
| 1227 |
info.meaning = meaning; |
| 1228 |
} |
| 1229 |
|
| 1230 |
|
| 1231 |
|
| 1232 |
|
| 1233 |
|
| 1234 |
|
| 1235 |
|
| 1236 |
|
| 1237 |
|
| 1238 |
public String getLendsName() { |
| 1239 |
return (info == null) ? null : info.lendsName; |
| 1240 |
} |
| 1241 |
|
| 1242 |
void setLendsName(String name) { |
| 1243 |
lazyInitInfo(); |
| 1244 |
info.lendsName = name; |
| 1245 |
} |
| 1246 |
|
| 1247 |
|
| 1248 |
|
| 1249 |
|
| 1250 |
public boolean isNgInject() { |
| 1251 |
return (info == null) ? false : info.ngInject; |
| 1252 |
} |
| 1253 |
|
| 1254 |
void setNgInject(boolean ngInject) { |
| 1255 |
lazyInitInfo(); |
| 1256 |
info.ngInject = ngInject; |
| 1257 |
} |
| 1258 |
|
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
public String getLicense() { |
| 1263 |
return (info == null) ? null : info.license; |
| 1264 |
} |
| 1265 |
|
| 1266 |
|
| 1267 |
|
| 1268 |
|
| 1269 |
|
| 1270 |
|
| 1271 |
|
| 1272 |
|
| 1273 |
public void setLicense(String license) { |
| 1274 |
lazyInitInfo(); |
| 1275 |
info.license = license; |
| 1276 |
} |
| 1277 |
|
| 1278 |
@Override |
| 1279 |
public String toString() { |
| 1280 |
return "JSDocInfo"; |
| 1281 |
} |
| 1282 |
|
| 1283 |
|
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
public boolean hasBaseType() { |
| 1288 |
return getBaseType() != null; |
| 1289 |
} |
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
|
| 1295 |
boolean addImplementedInterface(JSTypeExpression interfaceName) { |
| 1296 |
lazyInitInfo(); |
| 1297 |
if (info.implementedInterfaces == null) { |
| 1298 |
info.implementedInterfaces = Lists.newArrayListWithCapacity(2); |
| 1299 |
} |
| 1300 |
if (info.implementedInterfaces.contains(interfaceName)) { |
| 1301 |
return false; |
| 1302 |
} |
| 1303 |
info.implementedInterfaces.add(interfaceName); |
| 1304 |
return true; |
| 1305 |
} |
| 1306 |
|
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
|
| 1313 |
public List<JSTypeExpression> getImplementedInterfaces() { |
| 1314 |
if (info == null || info.implementedInterfaces == null) { |
| 1315 |
return ImmutableList.of(); |
| 1316 |
} |
| 1317 |
return Collections.unmodifiableList(info.implementedInterfaces); |
| 1318 |
} |
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
public int getImplementedInterfaceCount() { |
| 1325 |
if (info == null || info.implementedInterfaces == null) { |
| 1326 |
return 0; |
| 1327 |
} |
| 1328 |
return info.implementedInterfaces.size(); |
| 1329 |
} |
| 1330 |
|
| 1331 |
|
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
boolean addExtendedInterface(JSTypeExpression type) { |
| 1337 |
lazyInitInfo(); |
| 1338 |
if (info.extendedInterfaces == null) { |
| 1339 |
info.extendedInterfaces = Lists.newArrayListWithCapacity(2); |
| 1340 |
} |
| 1341 |
if (info.extendedInterfaces.contains(type)) { |
| 1342 |
return false; |
| 1343 |
} |
| 1344 |
info.extendedInterfaces.add(type); |
| 1345 |
return true; |
| 1346 |
} |
| 1347 |
|
| 1348 |
|
| 1349 |
|
| 1350 |
|
| 1351 |
|
| 1352 |
|
| 1353 |
|
| 1354 |
public List<JSTypeExpression> getExtendedInterfaces() { |
| 1355 |
if (info == null || info.extendedInterfaces == null) { |
| 1356 |
return ImmutableList.of(); |
| 1357 |
} |
| 1358 |
return Collections.unmodifiableList(info.extendedInterfaces); |
| 1359 |
} |
| 1360 |
|
| 1361 |
|
| 1362 |
|
| 1363 |
|
| 1364 |
public int getExtendedInterfacesCount() { |
| 1365 |
if (info == null || info.extendedInterfaces == null) { |
| 1366 |
return 0; |
| 1367 |
} |
| 1368 |
return info.extendedInterfaces.size(); |
| 1369 |
} |
| 1370 |
|
| 1371 |
|
| 1372 |
|
| 1373 |
|
| 1374 |
public String getDeprecationReason() { |
| 1375 |
return info == null ? null : info.deprecated; |
| 1376 |
} |
| 1377 |
|
| 1378 |
|
| 1379 |
|
| 1380 |
|
| 1381 |
public Set<String> getSuppressions() { |
| 1382 |
Set<String> suppressions = info == null ? null : info.suppressions; |
| 1383 |
return suppressions == null ? Collections.<String>emptySet() : suppressions; |
| 1384 |
} |
| 1385 |
|
| 1386 |
|
| 1387 |
|
| 1388 |
|
| 1389 |
public Set<String> getModifies() { |
| 1390 |
Set<String> modifies = info == null ? null : info.modifies; |
| 1391 |
return modifies == null ? Collections.<String>emptySet() : modifies; |
| 1392 |
} |
| 1393 |
|
| 1394 |
|
| 1395 |
|
| 1396 |
|
| 1397 |
|
| 1398 |
public boolean hasDescriptionForParameter(String name) { |
| 1399 |
if (documentation == null || documentation.parameters == null) { |
| 1400 |
return false; |
| 1401 |
} |
| 1402 |
|
| 1403 |
return documentation.parameters.containsKey(name); |
| 1404 |
} |
| 1405 |
|
| 1406 |
|
| 1407 |
|
| 1408 |
|
| 1409 |
|
| 1410 |
public String getDescriptionForParameter(String name) { |
| 1411 |
if (documentation == null || documentation.parameters == null) { |
| 1412 |
return null; |
| 1413 |
} |
| 1414 |
|
| 1415 |
return documentation.parameters.get(name); |
| 1416 |
} |
| 1417 |
|
| 1418 |
|
| 1419 |
|
| 1420 |
|
| 1421 |
public Collection<String> getAuthors() { |
| 1422 |
return documentation == null ? null : documentation.authors; |
| 1423 |
} |
| 1424 |
|
| 1425 |
|
| 1426 |
|
| 1427 |
|
| 1428 |
public Collection<String> getReferences() { |
| 1429 |
return documentation == null ? null : documentation.sees; |
| 1430 |
} |
| 1431 |
|
| 1432 |
|
| 1433 |
|
| 1434 |
|
| 1435 |
public String getVersion() { |
| 1436 |
return documentation == null ? null : documentation.version; |
| 1437 |
} |
| 1438 |
|
| 1439 |
|
| 1440 |
|
| 1441 |
|
| 1442 |
public String getReturnDescription() { |
| 1443 |
return documentation == null ? null : documentation.returnDescription; |
| 1444 |
} |
| 1445 |
|
| 1446 |
|
| 1447 |
|
| 1448 |
|
| 1449 |
public String getBlockDescription() { |
| 1450 |
return documentation == null ? null : documentation.blockDescription; |
| 1451 |
} |
| 1452 |
|
| 1453 |
|
| 1454 |
|
| 1455 |
|
| 1456 |
public boolean hasFileOverview() { |
| 1457 |
return getFlag(MASK_FILEOVERVIEW); |
| 1458 |
} |
| 1459 |
|
| 1460 |
|
| 1461 |
|
| 1462 |
|
| 1463 |
public String getFileOverview() { |
| 1464 |
return documentation == null ? null : documentation.fileOverview; |
| 1465 |
} |
| 1466 |
|
| 1467 |
public Node getAssociatedNode() { |
| 1468 |
return this.associatedNode; |
| 1469 |
} |
| 1470 |
|
| 1471 |
|
| 1472 |
|
| 1473 |
|
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
|
| 1478 |
public void setAssociatedNode(Node node) { |
| 1479 |
this.associatedNode = node; |
| 1480 |
} |
| 1481 |
|
| 1482 |
|
| 1483 |
public String getSourceName() { |
| 1484 |
return this.associatedNode != null |
| 1485 |
? this.associatedNode.getSourceFileName() : null; |
| 1486 |
} |
| 1487 |
|
| 1488 |
|
| 1489 |
public Collection<Marker> getMarkers() { |
| 1490 |
return (documentation == null || documentation.markers == null) |
| 1491 |
? ImmutableList.<Marker>of() : documentation.markers; |
| 1492 |
} |
| 1493 |
|
| 1494 |
|
| 1495 |
public ImmutableList<String> getTemplateTypeNames() { |
| 1496 |
if (info == null || info.templateTypeNames == null) { |
| 1497 |
return ImmutableList.of(); |
| 1498 |
} |
| 1499 |
return info.templateTypeNames; |
| 1500 |
} |
| 1501 |
|
| 1502 |
public ImmutableList<String> getClassTemplateTypeNames() { |
| 1503 |
if (info == null || info.classTemplateTypeNames == null) { |
| 1504 |
return ImmutableList.of(); |
| 1505 |
} |
| 1506 |
return info.classTemplateTypeNames; |
| 1507 |
} |
| 1508 |
|
| 1509 |
|
| 1510 |
|
| 1511 |
|
| 1512 |
|
| 1513 |
|
| 1514 |
|
| 1515 |
|
| 1516 |
public Collection<Node> getTypeNodes() { |
| 1517 |
List<Node> nodes = Lists.newArrayList(); |
| 1518 |
|
| 1519 |
if (type != null) { |
| 1520 |
nodes.add(type.getRoot()); |
| 1521 |
} |
| 1522 |
|
| 1523 |
if (thisType != null) { |
| 1524 |
nodes.add(thisType.getRoot()); |
| 1525 |
} |
| 1526 |
|
| 1527 |
if (info != null) { |
| 1528 |
if (info.baseType != null) { |
| 1529 |
nodes.add(info.baseType.getRoot()); |
| 1530 |
} |
| 1531 |
|
| 1532 |
if (info.extendedInterfaces != null) { |
| 1533 |
for (JSTypeExpression interfaceType : info.extendedInterfaces) { |
| 1534 |
nodes.add(interfaceType.getRoot()); |
| 1535 |
} |
| 1536 |
} |
| 1537 |
|
| 1538 |
if (info.implementedInterfaces != null) { |
| 1539 |
for (JSTypeExpression interfaceType : info.implementedInterfaces) { |
| 1540 |
nodes.add(interfaceType.getRoot()); |
| 1541 |
} |
| 1542 |
} |
| 1543 |
|
| 1544 |
if (info.parameters != null) { |
| 1545 |
for (JSTypeExpression parameterType : info.parameters.values()) { |
| 1546 |
if (parameterType != null) { |
| 1547 |
nodes.add(parameterType.getRoot()); |
| 1548 |
} |
| 1549 |
} |
| 1550 |
} |
| 1551 |
|
| 1552 |
if (info.thrownTypes != null) { |
| 1553 |
for (JSTypeExpression thrownType : info.thrownTypes) { |
| 1554 |
if (thrownType != null) { |
| 1555 |
nodes.add(thrownType.getRoot()); |
| 1556 |
} |
| 1557 |
} |
| 1558 |
} |
| 1559 |
} |
| 1560 |
|
| 1561 |
return nodes; |
| 1562 |
} |
| 1563 |
|
| 1564 |
public boolean hasModifies() { |
| 1565 |
return info != null && info.modifies != null; |
| 1566 |
} |
| 1567 |
|
| 1568 |
|
| 1569 |
|
| 1570 |
|
| 1571 |
|
| 1572 |
public String getOriginalCommentString() { |
| 1573 |
return documentation == null ? null : documentation.sourceComment; |
| 1574 |
} |
| 1575 |
|
| 1576 |
void setOriginalCommentString(String sourceComment) { |
| 1577 |
if (!lazyInitDocumentation()) { |
| 1578 |
return; |
| 1579 |
} |
| 1580 |
documentation.sourceComment = sourceComment; |
| 1581 |
} |
| 1582 |
} |