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