001 /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.13-12-g880e696 */ 002 package org.extendj.ast; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.Set; 007 import java.util.Collections; 008 import java.util.Collection; 009 import java.util.ArrayList; 010 import beaver.*; 011 import java.util.*; 012 import java.io.ByteArrayOutputStream; 013 import java.io.PrintStream; 014 import java.lang.reflect.InvocationTargetException; 015 import java.lang.reflect.Method; 016 import org.jastadd.util.*; 017 import java.util.zip.*; 018 import java.io.*; 019 import org.jastadd.util.PrettyPrintable; 020 import org.jastadd.util.PrettyPrinter; 021 import java.io.FileNotFoundException; 022 import java.io.BufferedInputStream; 023 import java.io.DataInputStream; 024 /** 025 * @ast node 026 * @declaredat /home/jesper/git/extendj/java5/grammar/GenericMethods.ast:4 027 * @production GenericConstructorDecl : {@link ConstructorDecl} ::= <span class="component">TypeParameter:{@link TypeVariable}*</span>; 028 029 */ 030 public class GenericConstructorDecl extends ConstructorDecl implements Cloneable { 031 /** 032 * @aspect GenericMethods 033 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:89 034 */ 035 public ParConstructorDecl newParConstructorDecl(Collection<TypeDecl> typeArguments) { 036 ParConstructorDecl constructorDecl = typeArguments.isEmpty() 037 ? new RawConstructorDecl() 038 : new ParConstructorDecl(); 039 040 // Adding a link to GenericConstructorDecl to be used during substitution 041 // instead of the not yet existing parent link. 042 constructorDecl.setGenericConstructorDecl(this); 043 044 List<Access> list = new List<Access>(); 045 if (typeArguments.isEmpty()) { 046 GenericConstructorDecl original = original(); 047 for (int i = 0; i < original.getNumTypeParameter(); i++) { 048 list.add(original.getTypeParameter(i).erasure().createBoundAccess()); 049 } 050 } else { 051 for (TypeDecl arg : typeArguments) { 052 list.add(arg.createBoundAccess()); 053 } 054 } 055 constructorDecl.setTypeArgumentList(list); 056 constructorDecl.setModifiers((Modifiers) getModifiers().treeCopyNoTransform()); 057 constructorDecl.setID(getID()); 058 constructorDecl.setParameterList(getParameterList().substitute(constructorDecl)); 059 constructorDecl.setExceptionList(getExceptionList().substitute(constructorDecl)); 060 return constructorDecl; 061 } 062 /** 063 * @aspect LookupParTypeDecl 064 * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1386 065 */ 066 public GenericConstructorDecl original; 067 /** 068 * @aspect Java5PrettyPrint 069 * @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrint.jadd:168 070 */ 071 public void prettyPrint(PrettyPrinter out) { 072 if (!isImplicitConstructor()) { 073 if (hasDocComment()) { 074 out.print(docComment()); 075 } 076 if (!out.isNewLine()) { 077 out.println(); 078 } 079 out.print(getModifiers()); 080 out.print("<"); 081 out.join(getTypeParameterList(), new PrettyPrinter.Joiner() { 082 @Override 083 public void printSeparator(PrettyPrinter out) { 084 out.print(", "); 085 } 086 }); 087 out.print("> "); 088 out.print(getID()); 089 out.print("("); 090 out.join(getParameterList(), new PrettyPrinter.Joiner() { 091 @Override 092 public void printSeparator(PrettyPrinter out) { 093 out.print(", "); 094 } 095 }); 096 out.print(")"); 097 if (hasExceptions()) { 098 out.print(" throws "); 099 out.join(getExceptionList(), new PrettyPrinter.Joiner() { 100 @Override 101 public void printSeparator(PrettyPrinter out) { 102 out.print(", "); 103 } 104 }); 105 } 106 out.print(" {"); 107 out.println(); 108 out.indent(1); 109 out.print(getParsedConstructorInvocation()); 110 if (!out.isNewLine()) { 111 out.println(); 112 } 113 out.println(); 114 out.indent(1); 115 out.join(blockStmts(), new PrettyPrinter.Joiner() { 116 @Override 117 public void printSeparator(PrettyPrinter out) { 118 out.println(); 119 } 120 }); 121 if (!out.isNewLine()) { 122 out.println(); 123 } 124 out.print("}"); 125 } 126 } 127 /** 128 * @declaredat ASTNode:1 129 */ 130 public GenericConstructorDecl() { 131 super(); 132 } 133 /** 134 * Initializes the child array to the correct size. 135 * Initializes List and Opt nta children. 136 * @apilevel internal 137 * @ast method 138 * @declaredat ASTNode:10 139 */ 140 public void init$Children() { 141 children = new ASTNode[7]; 142 setChild(new List(), 1); 143 setChild(new List(), 2); 144 setChild(new Opt(), 3); 145 setChild(new List(), 5); 146 } 147 /** 148 * @declaredat ASTNode:17 149 */ 150 public GenericConstructorDecl(Modifiers p0, String p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, List<TypeVariable> p6) { 151 setChild(p0, 0); 152 setID(p1); 153 setChild(p2, 1); 154 setChild(p3, 2); 155 setChild(p4, 3); 156 setChild(p5, 4); 157 setChild(p6, 5); 158 } 159 /** 160 * @declaredat ASTNode:26 161 */ 162 public GenericConstructorDecl(Modifiers p0, beaver.Symbol p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, List<TypeVariable> p6) { 163 setChild(p0, 0); 164 setID(p1); 165 setChild(p2, 1); 166 setChild(p3, 2); 167 setChild(p4, 3); 168 setChild(p5, 4); 169 setChild(p6, 5); 170 } 171 /** 172 * @apilevel low-level 173 * @declaredat ASTNode:38 174 */ 175 protected int numChildren() { 176 return 6; 177 } 178 /** 179 * @apilevel internal 180 * @declaredat ASTNode:44 181 */ 182 public boolean mayHaveRewrite() { 183 return false; 184 } 185 /** 186 * @apilevel internal 187 * @declaredat ASTNode:50 188 */ 189 public void flushAttrCache() { 190 super.flushAttrCache(); 191 lookupParConstructorDecl_Collection_TypeDecl__reset(); 192 } 193 /** 194 * @apilevel internal 195 * @declaredat ASTNode:57 196 */ 197 public void flushCollectionCache() { 198 super.flushCollectionCache(); 199 } 200 /** 201 * @apilevel internal 202 * @declaredat ASTNode:63 203 */ 204 public void flushRewriteCache() { 205 super.flushRewriteCache(); 206 } 207 /** 208 * @apilevel internal 209 * @declaredat ASTNode:69 210 */ 211 public GenericConstructorDecl clone() throws CloneNotSupportedException { 212 GenericConstructorDecl node = (GenericConstructorDecl) super.clone(); 213 return node; 214 } 215 /** 216 * @apilevel internal 217 * @declaredat ASTNode:76 218 */ 219 public GenericConstructorDecl copy() { 220 try { 221 GenericConstructorDecl node = (GenericConstructorDecl) clone(); 222 node.parent = null; 223 if (children != null) { 224 node.children = (ASTNode[]) children.clone(); 225 } 226 return node; 227 } catch (CloneNotSupportedException e) { 228 throw new Error("Error: clone not supported for " + getClass().getName()); 229 } 230 } 231 /** 232 * Create a deep copy of the AST subtree at this node. 233 * The copy is dangling, i.e. has no parent. 234 * @return dangling copy of the subtree at this node 235 * @apilevel low-level 236 * @deprecated Please use treeCopy or treeCopyNoTransform instead 237 * @declaredat ASTNode:95 238 */ 239 @Deprecated 240 public GenericConstructorDecl fullCopy() { 241 return treeCopyNoTransform(); 242 } 243 /** 244 * Create a deep copy of the AST subtree at this node. 245 * The copy is dangling, i.e. has no parent. 246 * @return dangling copy of the subtree at this node 247 * @apilevel low-level 248 * @declaredat ASTNode:105 249 */ 250 public GenericConstructorDecl treeCopyNoTransform() { 251 GenericConstructorDecl tree = (GenericConstructorDecl) copy(); 252 if (children != null) { 253 for (int i = 0; i < children.length; ++i) { 254 switch (i) { 255 case 6: 256 tree.children[i] = null; 257 continue; 258 } 259 ASTNode child = (ASTNode) children[i]; 260 if (child != null) { 261 child = child.treeCopyNoTransform(); 262 tree.setChild(child, i); 263 } 264 } 265 } 266 return tree; 267 } 268 /** 269 * Create a deep copy of the AST subtree at this node. 270 * The subtree of this node is traversed to trigger rewrites before copy. 271 * The copy is dangling, i.e. has no parent. 272 * @return dangling copy of the subtree at this node 273 * @apilevel low-level 274 * @declaredat ASTNode:130 275 */ 276 public GenericConstructorDecl treeCopy() { 277 doFullTraversal(); 278 return treeCopyNoTransform(); 279 } 280 /** 281 * @apilevel internal 282 * @declaredat ASTNode:137 283 */ 284 protected boolean is$Equal(ASTNode node) { 285 return super.is$Equal(node) && (tokenString_ID == ((GenericConstructorDecl)node).tokenString_ID); 286 } 287 /** 288 * Replaces the Modifiers child. 289 * @param node The new node to replace the Modifiers child. 290 * @apilevel high-level 291 */ 292 public void setModifiers(Modifiers node) { 293 setChild(node, 0); 294 } 295 /** 296 * Retrieves the Modifiers child. 297 * @return The current node used as the Modifiers child. 298 * @apilevel high-level 299 */ 300 @ASTNodeAnnotation.Child(name="Modifiers") 301 public Modifiers getModifiers() { 302 return (Modifiers) getChild(0); 303 } 304 /** 305 * Retrieves the Modifiers child. 306 * <p><em>This method does not invoke AST transformations.</em></p> 307 * @return The current node used as the Modifiers child. 308 * @apilevel low-level 309 */ 310 public Modifiers getModifiersNoTransform() { 311 return (Modifiers) getChildNoTransform(0); 312 } 313 /** 314 * Replaces the lexeme ID. 315 * @param value The new value for the lexeme ID. 316 * @apilevel high-level 317 */ 318 public void setID(String value) { 319 tokenString_ID = value; 320 } 321 /** 322 * JastAdd-internal setter for lexeme ID using the Beaver parser. 323 * @param symbol Symbol containing the new value for the lexeme ID 324 * @apilevel internal 325 */ 326 public void setID(beaver.Symbol symbol) { 327 if (symbol.value != null && !(symbol.value instanceof String)) 328 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 329 tokenString_ID = (String)symbol.value; 330 IDstart = symbol.getStart(); 331 IDend = symbol.getEnd(); 332 } 333 /** 334 * Retrieves the value for the lexeme ID. 335 * @return The value for the lexeme ID. 336 * @apilevel high-level 337 */ 338 @ASTNodeAnnotation.Token(name="ID") 339 public String getID() { 340 return tokenString_ID != null ? tokenString_ID : ""; 341 } 342 /** 343 * Replaces the Parameter list. 344 * @param list The new list node to be used as the Parameter list. 345 * @apilevel high-level 346 */ 347 public void setParameterList(List<ParameterDeclaration> list) { 348 setChild(list, 1); 349 } 350 /** 351 * Retrieves the number of children in the Parameter list. 352 * @return Number of children in the Parameter list. 353 * @apilevel high-level 354 */ 355 public int getNumParameter() { 356 return getParameterList().getNumChild(); 357 } 358 /** 359 * Retrieves the number of children in the Parameter list. 360 * Calling this method will not trigger rewrites. 361 * @return Number of children in the Parameter list. 362 * @apilevel low-level 363 */ 364 public int getNumParameterNoTransform() { 365 return getParameterListNoTransform().getNumChildNoTransform(); 366 } 367 /** 368 * Retrieves the element at index {@code i} in the Parameter list. 369 * @param i Index of the element to return. 370 * @return The element at position {@code i} in the Parameter list. 371 * @apilevel high-level 372 */ 373 public ParameterDeclaration getParameter(int i) { 374 return (ParameterDeclaration) getParameterList().getChild(i); 375 } 376 /** 377 * Check whether the Parameter list has any children. 378 * @return {@code true} if it has at least one child, {@code false} otherwise. 379 * @apilevel high-level 380 */ 381 public boolean hasParameter() { 382 return getParameterList().getNumChild() != 0; 383 } 384 /** 385 * Append an element to the Parameter list. 386 * @param node The element to append to the Parameter list. 387 * @apilevel high-level 388 */ 389 public void addParameter(ParameterDeclaration node) { 390 List<ParameterDeclaration> list = (parent == null) ? getParameterListNoTransform() : getParameterList(); 391 list.addChild(node); 392 } 393 /** 394 * @apilevel low-level 395 */ 396 public void addParameterNoTransform(ParameterDeclaration node) { 397 List<ParameterDeclaration> list = getParameterListNoTransform(); 398 list.addChild(node); 399 } 400 /** 401 * Replaces the Parameter list element at index {@code i} with the new node {@code node}. 402 * @param node The new node to replace the old list element. 403 * @param i The list index of the node to be replaced. 404 * @apilevel high-level 405 */ 406 public void setParameter(ParameterDeclaration node, int i) { 407 List<ParameterDeclaration> list = getParameterList(); 408 list.setChild(node, i); 409 } 410 /** 411 * Retrieves the Parameter list. 412 * @return The node representing the Parameter list. 413 * @apilevel high-level 414 */ 415 @ASTNodeAnnotation.ListChild(name="Parameter") 416 public List<ParameterDeclaration> getParameterList() { 417 List<ParameterDeclaration> list = (List<ParameterDeclaration>) getChild(1); 418 return list; 419 } 420 /** 421 * Retrieves the Parameter list. 422 * <p><em>This method does not invoke AST transformations.</em></p> 423 * @return The node representing the Parameter list. 424 * @apilevel low-level 425 */ 426 public List<ParameterDeclaration> getParameterListNoTransform() { 427 return (List<ParameterDeclaration>) getChildNoTransform(1); 428 } 429 /** 430 * Retrieves the Parameter list. 431 * @return The node representing the Parameter list. 432 * @apilevel high-level 433 */ 434 public List<ParameterDeclaration> getParameters() { 435 return getParameterList(); 436 } 437 /** 438 * Retrieves the Parameter list. 439 * <p><em>This method does not invoke AST transformations.</em></p> 440 * @return The node representing the Parameter list. 441 * @apilevel low-level 442 */ 443 public List<ParameterDeclaration> getParametersNoTransform() { 444 return getParameterListNoTransform(); 445 } 446 /** 447 * Replaces the Exception list. 448 * @param list The new list node to be used as the Exception list. 449 * @apilevel high-level 450 */ 451 public void setExceptionList(List<Access> list) { 452 setChild(list, 2); 453 } 454 /** 455 * Retrieves the number of children in the Exception list. 456 * @return Number of children in the Exception list. 457 * @apilevel high-level 458 */ 459 public int getNumException() { 460 return getExceptionList().getNumChild(); 461 } 462 /** 463 * Retrieves the number of children in the Exception list. 464 * Calling this method will not trigger rewrites. 465 * @return Number of children in the Exception list. 466 * @apilevel low-level 467 */ 468 public int getNumExceptionNoTransform() { 469 return getExceptionListNoTransform().getNumChildNoTransform(); 470 } 471 /** 472 * Retrieves the element at index {@code i} in the Exception list. 473 * @param i Index of the element to return. 474 * @return The element at position {@code i} in the Exception list. 475 * @apilevel high-level 476 */ 477 public Access getException(int i) { 478 return (Access) getExceptionList().getChild(i); 479 } 480 /** 481 * Check whether the Exception list has any children. 482 * @return {@code true} if it has at least one child, {@code false} otherwise. 483 * @apilevel high-level 484 */ 485 public boolean hasException() { 486 return getExceptionList().getNumChild() != 0; 487 } 488 /** 489 * Append an element to the Exception list. 490 * @param node The element to append to the Exception list. 491 * @apilevel high-level 492 */ 493 public void addException(Access node) { 494 List<Access> list = (parent == null) ? getExceptionListNoTransform() : getExceptionList(); 495 list.addChild(node); 496 } 497 /** 498 * @apilevel low-level 499 */ 500 public void addExceptionNoTransform(Access node) { 501 List<Access> list = getExceptionListNoTransform(); 502 list.addChild(node); 503 } 504 /** 505 * Replaces the Exception list element at index {@code i} with the new node {@code node}. 506 * @param node The new node to replace the old list element. 507 * @param i The list index of the node to be replaced. 508 * @apilevel high-level 509 */ 510 public void setException(Access node, int i) { 511 List<Access> list = getExceptionList(); 512 list.setChild(node, i); 513 } 514 /** 515 * Retrieves the Exception list. 516 * @return The node representing the Exception list. 517 * @apilevel high-level 518 */ 519 @ASTNodeAnnotation.ListChild(name="Exception") 520 public List<Access> getExceptionList() { 521 List<Access> list = (List<Access>) getChild(2); 522 return list; 523 } 524 /** 525 * Retrieves the Exception list. 526 * <p><em>This method does not invoke AST transformations.</em></p> 527 * @return The node representing the Exception list. 528 * @apilevel low-level 529 */ 530 public List<Access> getExceptionListNoTransform() { 531 return (List<Access>) getChildNoTransform(2); 532 } 533 /** 534 * Retrieves the Exception list. 535 * @return The node representing the Exception list. 536 * @apilevel high-level 537 */ 538 public List<Access> getExceptions() { 539 return getExceptionList(); 540 } 541 /** 542 * Retrieves the Exception list. 543 * <p><em>This method does not invoke AST transformations.</em></p> 544 * @return The node representing the Exception list. 545 * @apilevel low-level 546 */ 547 public List<Access> getExceptionsNoTransform() { 548 return getExceptionListNoTransform(); 549 } 550 /** 551 * Replaces the optional node for the ParsedConstructorInvocation child. This is the <code>Opt</code> 552 * node containing the child ParsedConstructorInvocation, not the actual child! 553 * @param opt The new node to be used as the optional node for the ParsedConstructorInvocation child. 554 * @apilevel low-level 555 */ 556 public void setParsedConstructorInvocationOpt(Opt<Stmt> opt) { 557 setChild(opt, 3); 558 } 559 /** 560 * Replaces the (optional) ParsedConstructorInvocation child. 561 * @param node The new node to be used as the ParsedConstructorInvocation child. 562 * @apilevel high-level 563 */ 564 public void setParsedConstructorInvocation(Stmt node) { 565 getParsedConstructorInvocationOpt().setChild(node, 0); 566 } 567 /** 568 * Check whether the optional ParsedConstructorInvocation child exists. 569 * @return {@code true} if the optional ParsedConstructorInvocation child exists, {@code false} if it does not. 570 * @apilevel high-level 571 */ 572 public boolean hasParsedConstructorInvocation() { 573 return getParsedConstructorInvocationOpt().getNumChild() != 0; 574 } 575 /** 576 * Retrieves the (optional) ParsedConstructorInvocation child. 577 * @return The ParsedConstructorInvocation child, if it exists. Returns {@code null} otherwise. 578 * @apilevel low-level 579 */ 580 public Stmt getParsedConstructorInvocation() { 581 return (Stmt) getParsedConstructorInvocationOpt().getChild(0); 582 } 583 /** 584 * Retrieves the optional node for the ParsedConstructorInvocation child. This is the <code>Opt</code> node containing the child ParsedConstructorInvocation, not the actual child! 585 * @return The optional node for child the ParsedConstructorInvocation child. 586 * @apilevel low-level 587 */ 588 @ASTNodeAnnotation.OptChild(name="ParsedConstructorInvocation") 589 public Opt<Stmt> getParsedConstructorInvocationOpt() { 590 return (Opt<Stmt>) getChild(3); 591 } 592 /** 593 * Retrieves the optional node for child ParsedConstructorInvocation. This is the <code>Opt</code> node containing the child ParsedConstructorInvocation, not the actual child! 594 * <p><em>This method does not invoke AST transformations.</em></p> 595 * @return The optional node for child ParsedConstructorInvocation. 596 * @apilevel low-level 597 */ 598 public Opt<Stmt> getParsedConstructorInvocationOptNoTransform() { 599 return (Opt<Stmt>) getChildNoTransform(3); 600 } 601 /** 602 * Replaces the Block child. 603 * @param node The new node to replace the Block child. 604 * @apilevel high-level 605 */ 606 public void setBlock(Block node) { 607 setChild(node, 4); 608 } 609 /** 610 * Retrieves the Block child. 611 * @return The current node used as the Block child. 612 * @apilevel high-level 613 */ 614 @ASTNodeAnnotation.Child(name="Block") 615 public Block getBlock() { 616 return (Block) getChild(4); 617 } 618 /** 619 * Retrieves the Block child. 620 * <p><em>This method does not invoke AST transformations.</em></p> 621 * @return The current node used as the Block child. 622 * @apilevel low-level 623 */ 624 public Block getBlockNoTransform() { 625 return (Block) getChildNoTransform(4); 626 } 627 /** 628 * Replaces the TypeParameter list. 629 * @param list The new list node to be used as the TypeParameter list. 630 * @apilevel high-level 631 */ 632 public void setTypeParameterList(List<TypeVariable> list) { 633 setChild(list, 5); 634 } 635 /** 636 * Retrieves the number of children in the TypeParameter list. 637 * @return Number of children in the TypeParameter list. 638 * @apilevel high-level 639 */ 640 public int getNumTypeParameter() { 641 return getTypeParameterList().getNumChild(); 642 } 643 /** 644 * Retrieves the number of children in the TypeParameter list. 645 * Calling this method will not trigger rewrites. 646 * @return Number of children in the TypeParameter list. 647 * @apilevel low-level 648 */ 649 public int getNumTypeParameterNoTransform() { 650 return getTypeParameterListNoTransform().getNumChildNoTransform(); 651 } 652 /** 653 * Retrieves the element at index {@code i} in the TypeParameter list. 654 * @param i Index of the element to return. 655 * @return The element at position {@code i} in the TypeParameter list. 656 * @apilevel high-level 657 */ 658 public TypeVariable getTypeParameter(int i) { 659 return (TypeVariable) getTypeParameterList().getChild(i); 660 } 661 /** 662 * Check whether the TypeParameter list has any children. 663 * @return {@code true} if it has at least one child, {@code false} otherwise. 664 * @apilevel high-level 665 */ 666 public boolean hasTypeParameter() { 667 return getTypeParameterList().getNumChild() != 0; 668 } 669 /** 670 * Append an element to the TypeParameter list. 671 * @param node The element to append to the TypeParameter list. 672 * @apilevel high-level 673 */ 674 public void addTypeParameter(TypeVariable node) { 675 List<TypeVariable> list = (parent == null) ? getTypeParameterListNoTransform() : getTypeParameterList(); 676 list.addChild(node); 677 } 678 /** 679 * @apilevel low-level 680 */ 681 public void addTypeParameterNoTransform(TypeVariable node) { 682 List<TypeVariable> list = getTypeParameterListNoTransform(); 683 list.addChild(node); 684 } 685 /** 686 * Replaces the TypeParameter list element at index {@code i} with the new node {@code node}. 687 * @param node The new node to replace the old list element. 688 * @param i The list index of the node to be replaced. 689 * @apilevel high-level 690 */ 691 public void setTypeParameter(TypeVariable node, int i) { 692 List<TypeVariable> list = getTypeParameterList(); 693 list.setChild(node, i); 694 } 695 /** 696 * Retrieves the TypeParameter list. 697 * @return The node representing the TypeParameter list. 698 * @apilevel high-level 699 */ 700 @ASTNodeAnnotation.ListChild(name="TypeParameter") 701 public List<TypeVariable> getTypeParameterList() { 702 List<TypeVariable> list = (List<TypeVariable>) getChild(5); 703 return list; 704 } 705 /** 706 * Retrieves the TypeParameter list. 707 * <p><em>This method does not invoke AST transformations.</em></p> 708 * @return The node representing the TypeParameter list. 709 * @apilevel low-level 710 */ 711 public List<TypeVariable> getTypeParameterListNoTransform() { 712 return (List<TypeVariable>) getChildNoTransform(5); 713 } 714 /** 715 * Retrieves the TypeParameter list. 716 * @return The node representing the TypeParameter list. 717 * @apilevel high-level 718 */ 719 public List<TypeVariable> getTypeParameters() { 720 return getTypeParameterList(); 721 } 722 /** 723 * Retrieves the TypeParameter list. 724 * <p><em>This method does not invoke AST transformations.</em></p> 725 * @return The node representing the TypeParameter list. 726 * @apilevel low-level 727 */ 728 public List<TypeVariable> getTypeParametersNoTransform() { 729 return getTypeParameterListNoTransform(); 730 } 731 /** 732 * Retrieves the ImplicitConstructorInvocation child. 733 * <p><em>This method does not invoke AST transformations.</em></p> 734 * @return The current node used as the ImplicitConstructorInvocation child. 735 * @apilevel low-level 736 */ 737 public Stmt getImplicitConstructorInvocationNoTransform() { 738 return (Stmt) getChildNoTransform(6); 739 } 740 /** 741 * Retrieves the child position of the optional child ImplicitConstructorInvocation. 742 * @return The the child position of the optional child ImplicitConstructorInvocation. 743 * @apilevel low-level 744 */ 745 protected int getImplicitConstructorInvocationChildPosition() { 746 return 6; 747 } 748 /** 749 * @apilevel internal 750 */ 751 protected List lookupParConstructorDecl_Collection_TypeDecl__list; 752 /** 753 * @apilevel internal 754 */ 755 protected java.util.Map lookupParConstructorDecl_Collection_TypeDecl__values; 756 /** 757 * @apilevel internal 758 */ 759 private void lookupParConstructorDecl_Collection_TypeDecl__reset() { 760 lookupParConstructorDecl_Collection_TypeDecl__values = null; 761 lookupParConstructorDecl_Collection_TypeDecl__list = null; 762 } 763 /** 764 * @attribute syn 765 * @aspect GenericMethods 766 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:86 767 */ 768 @ASTNodeAnnotation.Attribute 769 public ParConstructorDecl lookupParConstructorDecl(Collection<TypeDecl> typeArguments) { 770 Object _parameters = typeArguments; 771 if (lookupParConstructorDecl_Collection_TypeDecl__values == null) lookupParConstructorDecl_Collection_TypeDecl__values = new org.jastadd.util.RobustMap(new java.util.HashMap()); 772 ASTNode$State state = state(); 773 if (lookupParConstructorDecl_Collection_TypeDecl__values.containsKey(_parameters)) { 774 return (ParConstructorDecl) lookupParConstructorDecl_Collection_TypeDecl__values.get(_parameters); 775 } 776 boolean intermediate = state.INTERMEDIATE_VALUE; 777 state.INTERMEDIATE_VALUE = false; 778 int num = state.boundariesCrossed; 779 boolean isFinal = this.is$Final(); 780 ParConstructorDecl lookupParConstructorDecl_Collection_TypeDecl__value = newParConstructorDecl(typeArguments); 781 if (lookupParConstructorDecl_Collection_TypeDecl__list == null) { 782 lookupParConstructorDecl_Collection_TypeDecl__list = new List(); 783 lookupParConstructorDecl_Collection_TypeDecl__list.is$Final = true; 784 lookupParConstructorDecl_Collection_TypeDecl__list.setParent(this); 785 } 786 lookupParConstructorDecl_Collection_TypeDecl__list.add(lookupParConstructorDecl_Collection_TypeDecl__value); 787 if (lookupParConstructorDecl_Collection_TypeDecl__value != null) { 788 lookupParConstructorDecl_Collection_TypeDecl__value = (ParConstructorDecl) lookupParConstructorDecl_Collection_TypeDecl__list.getChild(lookupParConstructorDecl_Collection_TypeDecl__list.numChildren-1); 789 lookupParConstructorDecl_Collection_TypeDecl__value.is$Final = true; 790 } 791 if (true) { 792 lookupParConstructorDecl_Collection_TypeDecl__values.put(_parameters, lookupParConstructorDecl_Collection_TypeDecl__value); 793 } else { 794 } 795 state.INTERMEDIATE_VALUE |= intermediate; 796 797 return lookupParConstructorDecl_Collection_TypeDecl__value; 798 } 799 /** 800 * @attribute syn 801 * @aspect GenericMethodsNameAnalysis 802 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:198 803 */ 804 @ASTNodeAnnotation.Attribute 805 public SimpleSet localLookupType(String name) { 806 { 807 for (int i = 0; i < getNumTypeParameter(); i++) { 808 if (original().getTypeParameter(i).name().equals(name)) { 809 return SimpleSet.emptySet.add(original().getTypeParameter(i)); 810 } 811 } 812 return SimpleSet.emptySet; 813 } 814 } 815 /** 816 * @attribute syn 817 * @aspect LookupParTypeDecl 818 * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1385 819 */ 820 @ASTNodeAnnotation.Attribute 821 public GenericConstructorDecl original() { 822 GenericConstructorDecl original_value = original != null ? original : this; 823 824 return original_value; 825 } 826 /** 827 * @return {@code true} if this is a generic method or constructor, or a 828 * substitued generic method or constructor. 829 * @attribute syn 830 * @aspect MethodSignature15 831 * @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:375 832 */ 833 @ASTNodeAnnotation.Attribute 834 public boolean isGeneric() { 835 boolean isGeneric_value = true; 836 837 return isGeneric_value; 838 } 839 /** 840 * Note: isGeneric must be called first to check if this declaration is generic. 841 * Otherwise this attribute will throw an error! 842 * @return original generic declaration of this constructor. 843 * @attribute syn 844 * @aspect MethodSignature15 845 * @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:397 846 */ 847 @ASTNodeAnnotation.Attribute 848 public GenericConstructorDecl genericDecl() { 849 GenericConstructorDecl genericDecl_value = this; 850 851 return genericDecl_value; 852 } 853 /** 854 * Note: isGeneric must be called first to check if this declaration is generic. 855 * Otherwise this attribute will throw an error! 856 * @return type parameters for this declaration. 857 * @attribute syn 858 * @aspect MethodSignature15 859 * @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:408 860 */ 861 @ASTNodeAnnotation.Attribute 862 public List<TypeVariable> typeParameters() { 863 List<TypeVariable> typeParameters_value = getTypeParameterList(); 864 865 return typeParameters_value; 866 } 867 /** 868 * @attribute syn 869 * @aspect GenericsCodegen 870 * @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:388 871 */ 872 @ASTNodeAnnotation.Attribute 873 public boolean needsSignatureAttribute() { 874 boolean needsSignatureAttribute_value = true; 875 876 return needsSignatureAttribute_value; 877 } 878 /** 879 * @attribute inh 880 * @aspect GenericMethodsNameAnalysis 881 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:197 882 */ 883 /** 884 * @attribute inh 885 * @aspect GenericMethodsNameAnalysis 886 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:197 887 */ 888 @ASTNodeAnnotation.Attribute 889 public SimpleSet lookupType(String name) { 890 SimpleSet lookupType_String_value = getParent().Define_lookupType(this, null, name); 891 892 return lookupType_String_value; 893 } 894 /** 895 * @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36 896 * @apilevel internal 897 */ 898 public NameType Define_nameType(ASTNode caller, ASTNode child) { 899 if (caller == getTypeParameterListNoTransform()) { 900 // @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:195 901 int childIndex = caller.getIndexOfChild(child); 902 return NameType.TYPE_NAME; 903 } 904 else { 905 return super.Define_nameType(caller, child); 906 } 907 } 908 protected boolean canDefine_nameType(ASTNode caller, ASTNode child) { 909 return true; 910 } 911 /** 912 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:197 913 * @apilevel internal 914 */ 915 public SimpleSet Define_lookupType(ASTNode caller, ASTNode child, String name) { 916 int childIndex = this.getIndexOfChild(caller); 917 return localLookupType(name).isEmpty() ? lookupType(name) : localLookupType(name); 918 } 919 protected boolean canDefine_lookupType(ASTNode caller, ASTNode child, String name) { 920 return true; 921 } 922 /** 923 * @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:29 924 * @apilevel internal 925 */ 926 public int Define_typeVarPosition(ASTNode caller, ASTNode child) { 927 if (caller == getTypeParameterListNoTransform()) { 928 // @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:40 929 int i = caller.getIndexOfChild(child); 930 return i; 931 } 932 else { 933 return getParent().Define_typeVarPosition(this, caller); 934 } 935 } 936 protected boolean canDefine_typeVarPosition(ASTNode caller, ASTNode child) { 937 return true; 938 } 939 /** 940 * @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:32 941 * @apilevel internal 942 */ 943 public boolean Define_typeVarInMethod(ASTNode caller, ASTNode child) { 944 if (caller == getTypeParameterListNoTransform()) { 945 // @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:41 946 int childIndex = caller.getIndexOfChild(child); 947 return false; 948 } 949 else { 950 return getParent().Define_typeVarInMethod(this, caller); 951 } 952 } 953 protected boolean canDefine_typeVarInMethod(ASTNode caller, ASTNode child) { 954 return true; 955 } 956 /** 957 * @apilevel internal 958 */ 959 public ASTNode rewriteTo() { 960 return super.rewriteTo(); 961 } 962 }