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 ParClassDecl : {@link ClassDecl} ::= <span class="component">Argument:{@link Access}*</span> <span class="component">[SuperClassAccess:{@link Access}]</span> <span class="component">Implements:{@link Access}*</span> <span class="component">{@link BodyDecl}*</span>; 016 * @ast node 017 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.ast:6 018 */ 019 public class ParClassDecl extends ClassDecl implements Cloneable, ParTypeDecl, MemberSubstitutor { 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 ParClassDecl clone() throws CloneNotSupportedException { 035 ParClassDecl node = (ParClassDecl)super.clone(); 036 node.involvesTypeParameters_visited = -1; 037 node.involvesTypeParameters_computed = false; 038 node.involvesTypeParameters_initialized = false; 039 node.erasure_computed = false; 040 node.erasure_value = null; 041 node.getSuperClassAccessOpt_computed = false; 042 node.getSuperClassAccessOpt_value = null; 043 node.getImplementsList_computed = false; 044 node.getImplementsList_value = null; 045 node.getBodyDeclList_computed = false; 046 node.getBodyDeclList_value = null; 047 node.subtype_TypeDecl_values = null; 048 node.sameStructure_TypeDecl_values = null; 049 node.instanceOf_TypeDecl_values = null; 050 node.typeDescriptor_computed = false; 051 node.typeDescriptor_value = null; 052 node.constantPoolName_computed = false; 053 node.constantPoolName_value = null; 054 node.needsSignatureAttribute_computed = false; 055 node.sameSignature_ArrayList_values = null; 056 node.usesTypeVariable_visited = -1; 057 node.usesTypeVariable_computed = false; 058 node.usesTypeVariable_initialized = false; 059 node.sourceTypeDecl_computed = false; 060 node.sourceTypeDecl_value = null; 061 node.fullName_computed = false; 062 node.fullName_value = null; 063 node.typeName_computed = false; 064 node.typeName_value = null; 065 node.unimplementedMethods_computed = false; 066 node.unimplementedMethods_value = null; 067 node.uniqueIndex_computed = false; 068 node.localMethodsSignatureMap_computed = false; 069 node.localMethodsSignatureMap_value = null; 070 node.localFields_String_values = null; 071 node.localTypeDecls_String_values = null; 072 node.constructors_computed = false; 073 node.constructors_value = null; 074 node.genericDecl_computed = false; 075 node.genericDecl_value = null; 076 node.in$Circle(false); 077 node.is$Final(false); 078 return node; 079 } 080 /** 081 * @apilevel internal 082 */ 083 @SuppressWarnings({"unchecked", "cast"}) 084 public ParClassDecl copy() { 085 086 try { 087 ParClassDecl node = (ParClassDecl) clone(); 088 node.parent = null; 089 if(children != null) 090 node.children = (ASTNode[]) children.clone(); 091 092 return node; 093 } catch (CloneNotSupportedException e) { 094 throw new Error("Error: clone not supported for " + getClass().getName()); 095 } 096 097 }/** 098 * Create a deep copy of the AST subtree at this node. 099 * The copy is dangling, i.e. has no parent. 100 * @return dangling copy of the subtree at this node 101 * @apilevel low-level 102 */ 103 @SuppressWarnings({"unchecked", "cast"}) 104 public ParClassDecl fullCopy() { 105 106 ParClassDecl tree = (ParClassDecl) copy(); 107 if (children != null) { 108 for (int i = 0; i < children.length; ++i) { 109 switch (i) { 110 case 3: 111 tree.children[i] = new Opt(); 112 continue; 113 case 4: 114 case 5: 115 tree.children[i] = new List(); 116 continue; 117 } 118 ASTNode child = (ASTNode) children[i]; 119 if(child != null) { 120 child = child.fullCopy(); 121 tree.setChild(child, i); 122 } 123 } 124 } 125 return tree; 126 127 } /** 128 * @ast method 129 * @aspect GenericsNameBinding 130 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:554 131 */ 132 public void collectErrors() { 133 // Disable error check for ParClassDecl which is an instanciated GenericClassDecl 134 } 135 /** 136 * @ast method 137 * @aspect GenericsPrettyPrint 138 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsPrettyPrint.jrag:34 139 */ 140 public void toString(StringBuffer s) { 141 getModifiers().toString(s); 142 s.append("class " + getID()); 143 s.append('<'); 144 if (getNumArgument() > 0) { 145 getArgument(0).toString(s); 146 for (int i = 1; i < getNumArgument(); i++) { 147 s.append(", "); 148 getArgument(i).toString(s); 149 } 150 } 151 s.append('>'); 152 if(hasSuperClassAccess()) { 153 s.append(" extends "); 154 getSuperClassAccess().toString(s); 155 } 156 if(getNumImplements() > 0) { 157 s.append(" implements "); 158 getImplements(0).toString(s); 159 for(int i = 1; i < getNumImplements(); i++) { 160 s.append(", "); 161 getImplements(i).toString(s); 162 } 163 } 164 ppBodyDecls(s); 165 } 166 /** 167 * @ast method 168 * @aspect LookupParTypeDecl 169 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:840 170 */ 171 public TypeDecl substitute(TypeVariable typeVariable) { 172 for(int i = 0; i < numTypeParameter(); i++) 173 if(typeParameter(i) == typeVariable) 174 return getArgument(i).type(); 175 return super.substitute(typeVariable); 176 } 177 /** 178 * @ast method 179 * @aspect LookupParTypeDecl 180 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:853 181 */ 182 public int numTypeParameter() { 183 return ((GenericTypeDecl)original()).getNumTypeParameter(); 184 } 185 /** 186 * @ast method 187 * @aspect LookupParTypeDecl 188 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:856 189 */ 190 public TypeVariable typeParameter(int index) { 191 return ((GenericTypeDecl)original()).getTypeParameter(index); 192 } 193 /** 194 * @ast method 195 * @aspect LookupParTypeDecl 196 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:888 197 */ 198 public Access substitute(Parameterization parTypeDecl) { 199 // TODO: include nesting as well.... 200 if(parTypeDecl.isRawType()) 201 return ((GenericTypeDecl)genericDecl()).rawType().createBoundAccess(); 202 if(!usesTypeVariable()) 203 return super.substitute(parTypeDecl); 204 List list = new List(); 205 for(int i = 0; i < getNumArgument(); i++) 206 list.add(getArgument(i).type().substitute(parTypeDecl)); 207 return new ParTypeAccess(genericDecl().createQualifiedAccess(), list); 208 } 209 /** 210 * @ast method 211 * @aspect GenericsParTypeDecl 212 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsParTypeDecl.jrag:76 213 */ 214 public Access createQualifiedAccess() { 215 List typeArgumentList = new List(); 216 for(int i = 0; i < getNumArgument(); i++) { 217 Access a = (Access)getArgument(i); 218 if(a instanceof TypeAccess) 219 typeArgumentList.add(a.type().createQualifiedAccess()); 220 else 221 typeArgumentList.add(a.fullCopy()); 222 } 223 if(!isTopLevelType()) { 224 if(isRawType()) 225 return enclosingType().createQualifiedAccess().qualifiesAccess( 226 new TypeAccess("", getID()) 227 ); 228 else 229 return enclosingType().createQualifiedAccess().qualifiesAccess( 230 new ParTypeAccess(new TypeAccess("", getID()), typeArgumentList) 231 ); 232 } 233 else { 234 if(isRawType()) 235 return new TypeAccess(packageName(), getID()); 236 else 237 return new ParTypeAccess(new TypeAccess(packageName(), getID()), typeArgumentList); 238 } 239 } 240 /** 241 * @ast method 242 * @aspect GenericsCodegen 243 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:300 244 */ 245 public void transformation() { 246 } 247 /** 248 * @ast method 249 * 250 */ 251 public ParClassDecl() { 252 super(); 253 254 255 } 256 /** 257 * Initializes the child array to the correct size. 258 * Initializes List and Opt nta children. 259 * @apilevel internal 260 * @ast method 261 * @ast method 262 * 263 */ 264 public void init$Children() { 265 children = new ASTNode[5]; 266 setChild(new List(), 1); 267 setChild(new Opt(), 2); 268 setChild(new List(), 3); 269 setChild(new List(), 4); 270 } 271 /** 272 * @ast method 273 * 274 */ 275 public ParClassDecl(Modifiers p0, String p1, List<Access> p2) { 276 setChild(p0, 0); 277 setID(p1); 278 setChild(p2, 1); 279 } 280 /** 281 * @ast method 282 * 283 */ 284 public ParClassDecl(Modifiers p0, beaver.Symbol p1, List<Access> p2) { 285 setChild(p0, 0); 286 setID(p1); 287 setChild(p2, 1); 288 } 289 /** 290 * @apilevel low-level 291 * @ast method 292 * 293 */ 294 protected int numChildren() { 295 return 2; 296 } 297 /** 298 * @apilevel internal 299 * @ast method 300 * 301 */ 302 public boolean mayHaveRewrite() { 303 return false; 304 } 305 /** 306 * Replaces the Modifiers child. 307 * @param node The new node to replace the Modifiers child. 308 * @apilevel high-level 309 * @ast method 310 * 311 */ 312 public void setModifiers(Modifiers node) { 313 setChild(node, 0); 314 } 315 /** 316 * Retrieves the Modifiers child. 317 * @return The current node used as the Modifiers child. 318 * @apilevel high-level 319 * @ast method 320 * 321 */ 322 public Modifiers getModifiers() { 323 return (Modifiers)getChild(0); 324 } 325 /** 326 * Retrieves the Modifiers child. 327 * <p><em>This method does not invoke AST transformations.</em></p> 328 * @return The current node used as the Modifiers child. 329 * @apilevel low-level 330 * @ast method 331 * 332 */ 333 public Modifiers getModifiersNoTransform() { 334 return (Modifiers)getChildNoTransform(0); 335 } 336 /** 337 * Replaces the lexeme ID. 338 * @param value The new value for the lexeme ID. 339 * @apilevel high-level 340 * @ast method 341 * 342 */ 343 public void setID(String value) { 344 tokenString_ID = value; 345 } 346 /** 347 * JastAdd-internal setter for lexeme ID using the Beaver parser. 348 * @apilevel internal 349 * @ast method 350 * 351 */ 352 public void setID(beaver.Symbol symbol) { 353 if(symbol.value != null && !(symbol.value instanceof String)) 354 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 355 tokenString_ID = (String)symbol.value; 356 IDstart = symbol.getStart(); 357 IDend = symbol.getEnd(); 358 } 359 /** 360 * Retrieves the value for the lexeme ID. 361 * @return The value for the lexeme ID. 362 * @apilevel high-level 363 * @ast method 364 * 365 */ 366 public String getID() { 367 return tokenString_ID != null ? tokenString_ID : ""; 368 } 369 /** 370 * Replaces the Argument list. 371 * @param list The new list node to be used as the Argument list. 372 * @apilevel high-level 373 * @ast method 374 * 375 */ 376 public void setArgumentList(List<Access> list) { 377 setChild(list, 1); 378 } 379 /** 380 * Retrieves the number of children in the Argument list. 381 * @return Number of children in the Argument list. 382 * @apilevel high-level 383 * @ast method 384 * 385 */ 386 public int getNumArgument() { 387 return getArgumentList().getNumChild(); 388 } 389 /** 390 * Retrieves the number of children in the Argument list. 391 * Calling this method will not trigger rewrites.. 392 * @return Number of children in the Argument list. 393 * @apilevel low-level 394 * @ast method 395 * 396 */ 397 public int getNumArgumentNoTransform() { 398 return getArgumentListNoTransform().getNumChildNoTransform(); 399 } 400 /** 401 * Retrieves the element at index {@code i} in the Argument list.. 402 * @param i Index of the element to return. 403 * @return The element at position {@code i} in the Argument list. 404 * @apilevel high-level 405 * @ast method 406 * 407 */ 408 @SuppressWarnings({"unchecked", "cast"}) 409 public Access getArgument(int i) { 410 return (Access)getArgumentList().getChild(i); 411 } 412 /** 413 * Append an element to the Argument list. 414 * @param node The element to append to the Argument list. 415 * @apilevel high-level 416 * @ast method 417 * 418 */ 419 public void addArgument(Access node) { 420 List<Access> list = (parent == null || state == null) ? getArgumentListNoTransform() : getArgumentList(); 421 list.addChild(node); 422 } 423 /** 424 * @apilevel low-level 425 * @ast method 426 * 427 */ 428 public void addArgumentNoTransform(Access node) { 429 List<Access> list = getArgumentListNoTransform(); 430 list.addChild(node); 431 } 432 /** 433 * Replaces the Argument list element at index {@code i} with the new node {@code node}. 434 * @param node The new node to replace the old list element. 435 * @param i The list index of the node to be replaced. 436 * @apilevel high-level 437 * @ast method 438 * 439 */ 440 public void setArgument(Access node, int i) { 441 List<Access> list = getArgumentList(); 442 list.setChild(node, i); 443 } 444 /** 445 * Retrieves the Argument list. 446 * @return The node representing the Argument list. 447 * @apilevel high-level 448 * @ast method 449 * 450 */ 451 public List<Access> getArguments() { 452 return getArgumentList(); 453 } 454 /** 455 * Retrieves the Argument list. 456 * <p><em>This method does not invoke AST transformations.</em></p> 457 * @return The node representing the Argument list. 458 * @apilevel low-level 459 * @ast method 460 * 461 */ 462 public List<Access> getArgumentsNoTransform() { 463 return getArgumentListNoTransform(); 464 } 465 /** 466 * Retrieves the Argument list. 467 * @return The node representing the Argument list. 468 * @apilevel high-level 469 * @ast method 470 * 471 */ 472 @SuppressWarnings({"unchecked", "cast"}) 473 public List<Access> getArgumentList() { 474 List<Access> list = (List<Access>)getChild(1); 475 list.getNumChild(); 476 return list; 477 } 478 /** 479 * Retrieves the Argument list. 480 * <p><em>This method does not invoke AST transformations.</em></p> 481 * @return The node representing the Argument list. 482 * @apilevel low-level 483 * @ast method 484 * 485 */ 486 @SuppressWarnings({"unchecked", "cast"}) 487 public List<Access> getArgumentListNoTransform() { 488 return (List<Access>)getChildNoTransform(1); 489 } 490 /** 491 * Replaces the optional node for the SuperClassAccess child. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 492 * @param opt The new node to be used as the optional node for the SuperClassAccess child. 493 * @apilevel low-level 494 * @ast method 495 * 496 */ 497 public void setSuperClassAccessOpt(Opt<Access> opt) { 498 setChild(opt, 2); 499 } 500 /** 501 * Check whether the optional SuperClassAccess child exists. 502 * @return {@code true} if the optional SuperClassAccess child exists, {@code false} if it does not. 503 * @apilevel high-level 504 * @ast method 505 * 506 */ 507 public boolean hasSuperClassAccess() { 508 return getSuperClassAccessOpt().getNumChild() != 0; 509 } 510 /** 511 * Retrieves the (optional) SuperClassAccess child. 512 * @return The SuperClassAccess child, if it exists. Returns {@code null} otherwise. 513 * @apilevel low-level 514 * @ast method 515 * 516 */ 517 @SuppressWarnings({"unchecked", "cast"}) 518 public Access getSuperClassAccess() { 519 return (Access)getSuperClassAccessOpt().getChild(0); 520 } 521 /** 522 * Replaces the (optional) SuperClassAccess child. 523 * @param node The new node to be used as the SuperClassAccess child. 524 * @apilevel high-level 525 * @ast method 526 * 527 */ 528 public void setSuperClassAccess(Access node) { 529 getSuperClassAccessOpt().setChild(node, 0); 530 } 531 /** 532 * Retrieves the optional node for child SuperClassAccess. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 533 * <p><em>This method does not invoke AST transformations.</em></p> 534 * @return The optional node for child SuperClassAccess. 535 * @apilevel low-level 536 * @ast method 537 * 538 */ 539 @SuppressWarnings({"unchecked", "cast"}) 540 public Opt<Access> getSuperClassAccessOptNoTransform() { 541 return (Opt<Access>)getChildNoTransform(2); 542 } 543 /** 544 * Retrieves the child position of the optional child SuperClassAccess. 545 * @return The the child position of the optional child SuperClassAccess. 546 * @apilevel low-level 547 * @ast method 548 * 549 */ 550 protected int getSuperClassAccessOptChildPosition() { 551 return 2; 552 } 553 /** 554 * Replaces the Implements list. 555 * @param list The new list node to be used as the Implements list. 556 * @apilevel high-level 557 * @ast method 558 * 559 */ 560 public void setImplementsList(List<Access> list) { 561 setChild(list, 3); 562 } 563 /** 564 * Retrieves the number of children in the Implements list. 565 * @return Number of children in the Implements list. 566 * @apilevel high-level 567 * @ast method 568 * 569 */ 570 public int getNumImplements() { 571 return getImplementsList().getNumChild(); 572 } 573 /** 574 * Retrieves the number of children in the Implements list. 575 * Calling this method will not trigger rewrites.. 576 * @return Number of children in the Implements list. 577 * @apilevel low-level 578 * @ast method 579 * 580 */ 581 public int getNumImplementsNoTransform() { 582 return getImplementsListNoTransform().getNumChildNoTransform(); 583 } 584 /** 585 * Retrieves the element at index {@code i} in the Implements list.. 586 * @param i Index of the element to return. 587 * @return The element at position {@code i} in the Implements list. 588 * @apilevel high-level 589 * @ast method 590 * 591 */ 592 @SuppressWarnings({"unchecked", "cast"}) 593 public Access getImplements(int i) { 594 return (Access)getImplementsList().getChild(i); 595 } 596 /** 597 * Append an element to the Implements list. 598 * @param node The element to append to the Implements list. 599 * @apilevel high-level 600 * @ast method 601 * 602 */ 603 public void addImplements(Access node) { 604 List<Access> list = (parent == null || state == null) ? getImplementsListNoTransform() : getImplementsList(); 605 list.addChild(node); 606 } 607 /** 608 * @apilevel low-level 609 * @ast method 610 * 611 */ 612 public void addImplementsNoTransform(Access node) { 613 List<Access> list = getImplementsListNoTransform(); 614 list.addChild(node); 615 } 616 /** 617 * Replaces the Implements list element at index {@code i} with the new node {@code node}. 618 * @param node The new node to replace the old list element. 619 * @param i The list index of the node to be replaced. 620 * @apilevel high-level 621 * @ast method 622 * 623 */ 624 public void setImplements(Access node, int i) { 625 List<Access> list = getImplementsList(); 626 list.setChild(node, i); 627 } 628 /** 629 * Retrieves the Implements list. 630 * @return The node representing the Implements list. 631 * @apilevel high-level 632 * @ast method 633 * 634 */ 635 public List<Access> getImplementss() { 636 return getImplementsList(); 637 } 638 /** 639 * Retrieves the Implements list. 640 * <p><em>This method does not invoke AST transformations.</em></p> 641 * @return The node representing the Implements list. 642 * @apilevel low-level 643 * @ast method 644 * 645 */ 646 public List<Access> getImplementssNoTransform() { 647 return getImplementsListNoTransform(); 648 } 649 /** 650 * Retrieves the Implements list. 651 * <p><em>This method does not invoke AST transformations.</em></p> 652 * @return The node representing the Implements list. 653 * @apilevel low-level 654 * @ast method 655 * 656 */ 657 public List<Access> getImplementsListNoTransform() { 658 return (List<Access>)getChildNoTransform(3); 659 } 660 /** 661 * Retrieves the child position of the Implements list. 662 * @return The the child position of the Implements list. 663 * @apilevel low-level 664 * @ast method 665 * 666 */ 667 protected int getImplementsListChildPosition() { 668 return 3; 669 } 670 /** 671 * Replaces the BodyDecl list. 672 * @param list The new list node to be used as the BodyDecl list. 673 * @apilevel high-level 674 * @ast method 675 * 676 */ 677 public void setBodyDeclList(List<BodyDecl> list) { 678 setChild(list, 4); 679 } 680 /** 681 * Retrieves the number of children in the BodyDecl list. 682 * @return Number of children in the BodyDecl list. 683 * @apilevel high-level 684 * @ast method 685 * 686 */ 687 public int getNumBodyDecl() { 688 return getBodyDeclList().getNumChild(); 689 } 690 /** 691 * Retrieves the number of children in the BodyDecl list. 692 * Calling this method will not trigger rewrites.. 693 * @return Number of children in the BodyDecl list. 694 * @apilevel low-level 695 * @ast method 696 * 697 */ 698 public int getNumBodyDeclNoTransform() { 699 return getBodyDeclListNoTransform().getNumChildNoTransform(); 700 } 701 /** 702 * Retrieves the element at index {@code i} in the BodyDecl list.. 703 * @param i Index of the element to return. 704 * @return The element at position {@code i} in the BodyDecl list. 705 * @apilevel high-level 706 * @ast method 707 * 708 */ 709 @SuppressWarnings({"unchecked", "cast"}) 710 public BodyDecl getBodyDecl(int i) { 711 return (BodyDecl)getBodyDeclList().getChild(i); 712 } 713 /** 714 * Append an element to the BodyDecl list. 715 * @param node The element to append to the BodyDecl list. 716 * @apilevel high-level 717 * @ast method 718 * 719 */ 720 public void addBodyDecl(BodyDecl node) { 721 List<BodyDecl> list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); 722 list.addChild(node); 723 } 724 /** 725 * @apilevel low-level 726 * @ast method 727 * 728 */ 729 public void addBodyDeclNoTransform(BodyDecl node) { 730 List<BodyDecl> list = getBodyDeclListNoTransform(); 731 list.addChild(node); 732 } 733 /** 734 * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. 735 * @param node The new node to replace the old list element. 736 * @param i The list index of the node to be replaced. 737 * @apilevel high-level 738 * @ast method 739 * 740 */ 741 public void setBodyDecl(BodyDecl node, int i) { 742 List<BodyDecl> list = getBodyDeclList(); 743 list.setChild(node, i); 744 } 745 /** 746 * Retrieves the BodyDecl list. 747 * @return The node representing the BodyDecl list. 748 * @apilevel high-level 749 * @ast method 750 * 751 */ 752 public List<BodyDecl> getBodyDecls() { 753 return getBodyDeclList(); 754 } 755 /** 756 * Retrieves the BodyDecl list. 757 * <p><em>This method does not invoke AST transformations.</em></p> 758 * @return The node representing the BodyDecl list. 759 * @apilevel low-level 760 * @ast method 761 * 762 */ 763 public List<BodyDecl> getBodyDeclsNoTransform() { 764 return getBodyDeclListNoTransform(); 765 } 766 /** 767 * Retrieves the BodyDecl list. 768 * <p><em>This method does not invoke AST transformations.</em></p> 769 * @return The node representing the BodyDecl list. 770 * @apilevel low-level 771 * @ast method 772 * 773 */ 774 public List<BodyDecl> getBodyDeclListNoTransform() { 775 return (List<BodyDecl>)getChildNoTransform(4); 776 } 777 /** 778 * Retrieves the child position of the BodyDecl list. 779 * @return The the child position of the BodyDecl list. 780 * @apilevel low-level 781 * @ast method 782 * 783 */ 784 protected int getBodyDeclListChildPosition() { 785 return 4; 786 } 787 /** 788 * @apilevel internal 789 */ 790 protected int involvesTypeParameters_visited = -1; 791 /** 792 * @apilevel internal 793 */ 794 protected boolean involvesTypeParameters_computed = false; 795 /** 796 * @apilevel internal 797 */ 798 protected boolean involvesTypeParameters_initialized = false; 799 /** 800 * @apilevel internal 801 */ 802 protected boolean involvesTypeParameters_value; 803 /** 804 * @attribute syn 805 * @aspect GenericMethodsInference 806 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethodsInference.jrag:18 807 */ 808 @SuppressWarnings({"unchecked", "cast"}) 809 public boolean involvesTypeParameters() { 810 if(involvesTypeParameters_computed) { 811 return involvesTypeParameters_value; 812 } 813 ASTNode$State state = state(); 814 if (!involvesTypeParameters_initialized) { 815 involvesTypeParameters_initialized = true; 816 involvesTypeParameters_value = false; 817 } 818 if (!state.IN_CIRCLE) { 819 state.IN_CIRCLE = true; 820 int num = state.boundariesCrossed; 821 boolean isFinal = this.is$Final(); 822 do { 823 involvesTypeParameters_visited = state.CIRCLE_INDEX; 824 state.CHANGE = false; 825 boolean new_involvesTypeParameters_value = involvesTypeParameters_compute(); 826 if (new_involvesTypeParameters_value!=involvesTypeParameters_value) 827 state.CHANGE = true; 828 involvesTypeParameters_value = new_involvesTypeParameters_value; 829 state.CIRCLE_INDEX++; 830 } while (state.CHANGE); 831 if(isFinal && num == state().boundariesCrossed) { 832 involvesTypeParameters_computed = true; 833 } 834 else { 835 state.RESET_CYCLE = true; 836 involvesTypeParameters_compute(); 837 state.RESET_CYCLE = false; 838 involvesTypeParameters_computed = false; 839 involvesTypeParameters_initialized = false; 840 } 841 state.IN_CIRCLE = false; 842 return involvesTypeParameters_value; 843 } 844 if(involvesTypeParameters_visited != state.CIRCLE_INDEX) { 845 involvesTypeParameters_visited = state.CIRCLE_INDEX; 846 if (state.RESET_CYCLE) { 847 involvesTypeParameters_computed = false; 848 involvesTypeParameters_initialized = false; 849 involvesTypeParameters_visited = -1; 850 return involvesTypeParameters_value; 851 } 852 boolean new_involvesTypeParameters_value = involvesTypeParameters_compute(); 853 if (new_involvesTypeParameters_value!=involvesTypeParameters_value) 854 state.CHANGE = true; 855 involvesTypeParameters_value = new_involvesTypeParameters_value; 856 return involvesTypeParameters_value; 857 } 858 return involvesTypeParameters_value; 859 } 860 /** 861 * @apilevel internal 862 */ 863 private boolean involvesTypeParameters_compute() { 864 for(int i = 0; i < getNumArgument(); i++) 865 if(getArgument(i).type().involvesTypeParameters()) 866 return true; 867 return false; 868 } 869 /** 870 * @attribute syn 871 * @aspect NestedTypes 872 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:569 873 */ 874 public TypeDecl hostType() { 875 ASTNode$State state = state(); 876 try { return original(); } 877 finally { 878 } 879 } 880 /** 881 * @attribute syn 882 * @aspect NestedTypes 883 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:497 884 */ 885 public TypeDecl topLevelType() { 886 ASTNode$State state = state(); 887 try { return erasure().topLevelType(); } 888 finally { 889 } 890 } 891 /** 892 * @attribute syn 893 * @aspect Generics 894 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:245 895 */ 896 public boolean isRawType() { 897 ASTNode$State state = state(); 898 try { return isNestedType() && enclosingType().isRawType(); } 899 finally { 900 } 901 } 902 /** 903 * @apilevel internal 904 */ 905 protected boolean erasure_computed = false; 906 /** 907 * @apilevel internal 908 */ 909 protected TypeDecl erasure_value; 910 /** 911 * @attribute syn 912 * @aspect GenericsErasure 913 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:350 914 */ 915 @SuppressWarnings({"unchecked", "cast"}) 916 public TypeDecl erasure() { 917 if(erasure_computed) { 918 return erasure_value; 919 } 920 ASTNode$State state = state(); 921 int num = state.boundariesCrossed; 922 boolean isFinal = this.is$Final(); 923 erasure_value = erasure_compute(); 924 if(isFinal && num == state().boundariesCrossed){ erasure_computed = true; } 925 return erasure_value; 926 } 927 /** 928 * @apilevel internal 929 */ 930 private TypeDecl erasure_compute() { return genericDecl(); } 931 /** 932 * @apilevel internal 933 */ 934 protected boolean getSuperClassAccessOpt_computed = false; 935 /** 936 * @apilevel internal 937 */ 938 protected Opt getSuperClassAccessOpt_value; 939 /** 940 * @attribute syn nta 941 * @aspect LookupParTypeDecl 942 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1015 943 */ 944 @SuppressWarnings({"unchecked", "cast"}) 945 public Opt getSuperClassAccessOpt() { 946 if(getSuperClassAccessOpt_computed) { 947 return (Opt) getChild(getSuperClassAccessOptChildPosition()); 948 } 949 ASTNode$State state = state(); 950 int num = state.boundariesCrossed; 951 boolean isFinal = this.is$Final(); 952 getSuperClassAccessOpt_value = getSuperClassAccessOpt_compute(); 953 setSuperClassAccessOpt(getSuperClassAccessOpt_value); 954 if(isFinal && num == state().boundariesCrossed){ getSuperClassAccessOpt_computed = true; } 955 Opt node = (Opt) this.getChild(getSuperClassAccessOptChildPosition()); 956 return node; 957 } 958 /** 959 * @apilevel internal 960 */ 961 private Opt getSuperClassAccessOpt_compute() { 962 GenericClassDecl decl = (GenericClassDecl)genericDecl(); 963 Opt opt; 964 //System.err.println("Begin substituting extends clause"); 965 if(decl.hasSuperClassAccess()) 966 opt = new Opt((decl.getSuperClassAccess().type().substitute(this))); 967 else 968 opt = new Opt(); 969 //System.err.println("End substituting extends clause"); 970 return opt; 971 } 972 /** 973 * @apilevel internal 974 */ 975 protected boolean getImplementsList_computed = false; 976 /** 977 * @apilevel internal 978 */ 979 protected List getImplementsList_value; 980 /** 981 * @attribute syn nta 982 * @aspect LookupParTypeDecl 983 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1026 984 */ 985 @SuppressWarnings({"unchecked", "cast"}) 986 public List getImplementsList() { 987 if(getImplementsList_computed) { 988 return (List) getChild(getImplementsListChildPosition()); 989 } 990 ASTNode$State state = state(); 991 int num = state.boundariesCrossed; 992 boolean isFinal = this.is$Final(); 993 getImplementsList_value = getImplementsList_compute(); 994 setImplementsList(getImplementsList_value); 995 if(isFinal && num == state().boundariesCrossed){ getImplementsList_computed = true; } 996 List node = (List) this.getChild(getImplementsListChildPosition()); 997 return node; 998 } 999 /** 1000 * @apilevel internal 1001 */ 1002 private List getImplementsList_compute() { 1003 GenericClassDecl decl = (GenericClassDecl)genericDecl(); 1004 //System.err.println("Begin substituting implements list"); 1005 List list = decl.getImplementsList().substitute(this); 1006 //System.err.println("End substituting implements list"); 1007 return list; 1008 } 1009 /** 1010 * @apilevel internal 1011 */ 1012 protected boolean getBodyDeclList_computed = false; 1013 /** 1014 * @apilevel internal 1015 */ 1016 protected List getBodyDeclList_value; 1017 /** 1018 * @attribute syn nta 1019 * @aspect LookupParTypeDecl 1020 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1035 1021 */ 1022 @SuppressWarnings({"unchecked", "cast"}) 1023 public List getBodyDeclList() { 1024 if(getBodyDeclList_computed) { 1025 return (List) getChild(getBodyDeclListChildPosition()); 1026 } 1027 ASTNode$State state = state(); 1028 int num = state.boundariesCrossed; 1029 boolean isFinal = this.is$Final(); 1030 getBodyDeclList_value = getBodyDeclList_compute(); 1031 setBodyDeclList(getBodyDeclList_value); 1032 if(isFinal && num == state().boundariesCrossed){ getBodyDeclList_computed = true; } 1033 List node = (List) this.getChild(getBodyDeclListChildPosition()); 1034 return node; 1035 } 1036 /** 1037 * @apilevel internal 1038 */ 1039 private List getBodyDeclList_compute() { return new BodyDeclList(); } 1040 /** 1041 * @attribute syn 1042 * @aspect GenericsSubtype 1043 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:14 1044 */ 1045 public boolean supertypeGenericClassDecl(GenericClassDecl type) { 1046 ASTNode$State state = state(); 1047 try { return type.subtype(genericDecl().original()); } 1048 finally { 1049 } 1050 } 1051 /** 1052 * @attribute syn 1053 * @aspect GenericsSubtype 1054 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:421 1055 */ 1056 public boolean supertypeClassDecl(ClassDecl type) { 1057 ASTNode$State state = state(); 1058 try { return super.supertypeClassDecl(type); } 1059 finally { 1060 } 1061 } 1062 protected java.util.Map subtype_TypeDecl_values; 1063 /** 1064 * @attribute syn 1065 * @aspect GenericsSubtype 1066 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:124 1067 */ 1068 @SuppressWarnings({"unchecked", "cast"}) 1069 public boolean subtype(TypeDecl type) { 1070 Object _parameters = type; 1071 if(subtype_TypeDecl_values == null) subtype_TypeDecl_values = new java.util.HashMap(4); 1072 ASTNode$State.CircularValue _value; 1073 if(subtype_TypeDecl_values.containsKey(_parameters)) { 1074 Object _o = subtype_TypeDecl_values.get(_parameters); 1075 if(!(_o instanceof ASTNode$State.CircularValue)) { 1076 return ((Boolean)_o).booleanValue(); 1077 } 1078 else 1079 _value = (ASTNode$State.CircularValue)_o; 1080 } 1081 else { 1082 _value = new ASTNode$State.CircularValue(); 1083 subtype_TypeDecl_values.put(_parameters, _value); 1084 _value.value = Boolean.valueOf(true); 1085 } 1086 ASTNode$State state = state(); 1087 if (!state.IN_CIRCLE) { 1088 state.IN_CIRCLE = true; 1089 int num = state.boundariesCrossed; 1090 boolean isFinal = this.is$Final(); 1091 boolean new_subtype_TypeDecl_value; 1092 do { 1093 _value.visited = new Integer(state.CIRCLE_INDEX); 1094 state.CHANGE = false; 1095 new_subtype_TypeDecl_value = subtype_compute(type); 1096 if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 1097 state.CHANGE = true; 1098 _value.value = Boolean.valueOf(new_subtype_TypeDecl_value); 1099 } 1100 state.CIRCLE_INDEX++; 1101 } while (state.CHANGE); 1102 if(isFinal && num == state().boundariesCrossed) { 1103 subtype_TypeDecl_values.put(_parameters, new_subtype_TypeDecl_value); 1104 } 1105 else { 1106 subtype_TypeDecl_values.remove(_parameters); 1107 state.RESET_CYCLE = true; 1108 subtype_compute(type); 1109 state.RESET_CYCLE = false; 1110 } 1111 state.IN_CIRCLE = false; 1112 return new_subtype_TypeDecl_value; 1113 } 1114 if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) { 1115 _value.visited = new Integer(state.CIRCLE_INDEX); 1116 boolean new_subtype_TypeDecl_value = subtype_compute(type); 1117 if (state.RESET_CYCLE) { 1118 subtype_TypeDecl_values.remove(_parameters); 1119 } 1120 else if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 1121 state.CHANGE = true; 1122 _value.value = new_subtype_TypeDecl_value; 1123 } 1124 return new_subtype_TypeDecl_value; 1125 } 1126 return ((Boolean)_value.value).booleanValue(); 1127 } 1128 /** 1129 * @apilevel internal 1130 */ 1131 private boolean subtype_compute(TypeDecl type) { return type.supertypeParClassDecl(this); } 1132 /** 1133 * @attribute syn 1134 * @aspect GenericsSubtype 1135 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:26 1136 */ 1137 public boolean supertypeRawClassDecl(RawClassDecl type) { 1138 ASTNode$State state = state(); 1139 try { return type.genericDecl().original().subtype(genericDecl().original()); } 1140 finally { 1141 } 1142 } 1143 /** 1144 * @attribute syn 1145 * @aspect GenericsSubtype 1146 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:30 1147 */ 1148 public boolean supertypeRawInterfaceDecl(RawInterfaceDecl type) { 1149 ASTNode$State state = state(); 1150 try { return type.genericDecl().original().subtype(genericDecl().original()); } 1151 finally { 1152 } 1153 } 1154 protected java.util.Map sameStructure_TypeDecl_values; 1155 /** 1156 * @attribute syn 1157 * @aspect GenericsSubtype 1158 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:179 1159 */ 1160 @SuppressWarnings({"unchecked", "cast"}) 1161 public boolean sameStructure(TypeDecl t) { 1162 Object _parameters = t; 1163 if(sameStructure_TypeDecl_values == null) sameStructure_TypeDecl_values = new java.util.HashMap(4); 1164 ASTNode$State.CircularValue _value; 1165 if(sameStructure_TypeDecl_values.containsKey(_parameters)) { 1166 Object _o = sameStructure_TypeDecl_values.get(_parameters); 1167 if(!(_o instanceof ASTNode$State.CircularValue)) { 1168 return ((Boolean)_o).booleanValue(); 1169 } 1170 else 1171 _value = (ASTNode$State.CircularValue)_o; 1172 } 1173 else { 1174 _value = new ASTNode$State.CircularValue(); 1175 sameStructure_TypeDecl_values.put(_parameters, _value); 1176 _value.value = Boolean.valueOf(true); 1177 } 1178 ASTNode$State state = state(); 1179 if (!state.IN_CIRCLE) { 1180 state.IN_CIRCLE = true; 1181 int num = state.boundariesCrossed; 1182 boolean isFinal = this.is$Final(); 1183 boolean new_sameStructure_TypeDecl_value; 1184 do { 1185 _value.visited = new Integer(state.CIRCLE_INDEX); 1186 state.CHANGE = false; 1187 new_sameStructure_TypeDecl_value = sameStructure_compute(t); 1188 if (new_sameStructure_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 1189 state.CHANGE = true; 1190 _value.value = Boolean.valueOf(new_sameStructure_TypeDecl_value); 1191 } 1192 state.CIRCLE_INDEX++; 1193 } while (state.CHANGE); 1194 if(isFinal && num == state().boundariesCrossed) { 1195 sameStructure_TypeDecl_values.put(_parameters, new_sameStructure_TypeDecl_value); 1196 } 1197 else { 1198 sameStructure_TypeDecl_values.remove(_parameters); 1199 state.RESET_CYCLE = true; 1200 sameStructure_compute(t); 1201 state.RESET_CYCLE = false; 1202 } 1203 state.IN_CIRCLE = false; 1204 return new_sameStructure_TypeDecl_value; 1205 } 1206 if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) { 1207 _value.visited = new Integer(state.CIRCLE_INDEX); 1208 boolean new_sameStructure_TypeDecl_value = sameStructure_compute(t); 1209 if (state.RESET_CYCLE) { 1210 sameStructure_TypeDecl_values.remove(_parameters); 1211 } 1212 else if (new_sameStructure_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 1213 state.CHANGE = true; 1214 _value.value = new_sameStructure_TypeDecl_value; 1215 } 1216 return new_sameStructure_TypeDecl_value; 1217 } 1218 return ((Boolean)_value.value).booleanValue(); 1219 } 1220 /** 1221 * @apilevel internal 1222 */ 1223 private boolean sameStructure_compute(TypeDecl t) { 1224 if(!(t instanceof ParClassDecl)) 1225 return false; 1226 ParClassDecl type = (ParClassDecl)t; 1227 if(type.genericDecl().original() == genericDecl().original() && 1228 type.getNumArgument() == getNumArgument()) { 1229 for(int i = 0; i < getNumArgument(); i++) 1230 if(!type.getArgument(i).type().sameStructure(getArgument(i).type())) 1231 return false; 1232 if(isNestedType() && type.isNestedType()) 1233 return type.enclosingType().sameStructure(enclosingType()); 1234 return true; 1235 } 1236 return false; 1237 } 1238 /** 1239 * @attribute syn 1240 * @aspect GenericsSubtype 1241 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:125 1242 */ 1243 public boolean supertypeParClassDecl(ParClassDecl type) { 1244 ASTNode$State state = state(); 1245 try { 1246 if(type.genericDecl().original() == genericDecl().original() && 1247 type.getNumArgument() == getNumArgument()) { 1248 for(int i = 0; i < getNumArgument(); i++) 1249 if(!type.getArgument(i).type().containedIn(getArgument(i).type())) 1250 return false; 1251 if(isNestedType() && type.isNestedType()) 1252 return type.enclosingType().subtype(enclosingType()); 1253 return true; 1254 } 1255 return supertypeClassDecl(type); 1256 } 1257 finally { 1258 } 1259 } 1260 /** 1261 * @attribute syn 1262 * @aspect GenericsSubtype 1263 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:129 1264 */ 1265 public boolean supertypeParInterfaceDecl(ParInterfaceDecl type) { 1266 ASTNode$State state = state(); 1267 try { return false; } 1268 finally { 1269 } 1270 } 1271 protected java.util.Map instanceOf_TypeDecl_values; 1272 /** 1273 * @attribute syn 1274 * @aspect GenericsSubtype 1275 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:396 1276 */ 1277 @SuppressWarnings({"unchecked", "cast"}) 1278 public boolean instanceOf(TypeDecl type) { 1279 Object _parameters = type; 1280 if(instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new java.util.HashMap(4); 1281 if(instanceOf_TypeDecl_values.containsKey(_parameters)) { 1282 return ((Boolean)instanceOf_TypeDecl_values.get(_parameters)).booleanValue(); 1283 } 1284 ASTNode$State state = state(); 1285 int num = state.boundariesCrossed; 1286 boolean isFinal = this.is$Final(); 1287 boolean instanceOf_TypeDecl_value = instanceOf_compute(type); 1288 if(isFinal && num == state().boundariesCrossed){ instanceOf_TypeDecl_values.put(_parameters, Boolean.valueOf(instanceOf_TypeDecl_value)); } 1289 return instanceOf_TypeDecl_value; 1290 } 1291 /** 1292 * @apilevel internal 1293 */ 1294 private boolean instanceOf_compute(TypeDecl type) { return subtype(type); } 1295 /** 1296 * @apilevel internal 1297 */ 1298 protected boolean typeDescriptor_computed = false; 1299 /** 1300 * @apilevel internal 1301 */ 1302 protected String typeDescriptor_value; 1303 /** 1304 * @attribute syn 1305 * @aspect GenericsCodegen 1306 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:16 1307 */ 1308 @SuppressWarnings({"unchecked", "cast"}) 1309 public String typeDescriptor() { 1310 if(typeDescriptor_computed) { 1311 return typeDescriptor_value; 1312 } 1313 ASTNode$State state = state(); 1314 int num = state.boundariesCrossed; 1315 boolean isFinal = this.is$Final(); 1316 typeDescriptor_value = typeDescriptor_compute(); 1317 if(isFinal && num == state().boundariesCrossed){ typeDescriptor_computed = true; } 1318 return typeDescriptor_value; 1319 } 1320 /** 1321 * @apilevel internal 1322 */ 1323 private String typeDescriptor_compute() { return erasure().typeDescriptor(); } 1324 /** 1325 * @attribute syn 1326 * @aspect CreateBCode 1327 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:820 1328 */ 1329 public String arrayTypeDescriptor() { 1330 ASTNode$State state = state(); 1331 try { return erasure().arrayTypeDescriptor(); } 1332 finally { 1333 } 1334 } 1335 /** 1336 * @apilevel internal 1337 */ 1338 protected boolean constantPoolName_computed = false; 1339 /** 1340 * @apilevel internal 1341 */ 1342 protected String constantPoolName_value; 1343 /** 1344 * @attribute syn 1345 * @aspect GenericsCodegen 1346 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:173 1347 */ 1348 @SuppressWarnings({"unchecked", "cast"}) 1349 public String constantPoolName() { 1350 if(constantPoolName_computed) { 1351 return constantPoolName_value; 1352 } 1353 ASTNode$State state = state(); 1354 int num = state.boundariesCrossed; 1355 boolean isFinal = this.is$Final(); 1356 constantPoolName_value = constantPoolName_compute(); 1357 if(isFinal && num == state().boundariesCrossed){ constantPoolName_computed = true; } 1358 return constantPoolName_value; 1359 } 1360 /** 1361 * @apilevel internal 1362 */ 1363 private String constantPoolName_compute() { return genericDecl().constantPoolName(); } 1364 /** 1365 * @apilevel internal 1366 */ 1367 protected boolean needsSignatureAttribute_computed = false; 1368 /** 1369 * @apilevel internal 1370 */ 1371 protected boolean needsSignatureAttribute_value; 1372 /** 1373 * @attribute syn 1374 * @aspect GenericsCodegen 1375 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:342 1376 */ 1377 @SuppressWarnings({"unchecked", "cast"}) 1378 public boolean needsSignatureAttribute() { 1379 if(needsSignatureAttribute_computed) { 1380 return needsSignatureAttribute_value; 1381 } 1382 ASTNode$State state = state(); 1383 int num = state.boundariesCrossed; 1384 boolean isFinal = this.is$Final(); 1385 needsSignatureAttribute_value = needsSignatureAttribute_compute(); 1386 if(isFinal && num == state().boundariesCrossed){ needsSignatureAttribute_computed = true; } 1387 return needsSignatureAttribute_value; 1388 } 1389 /** 1390 * @apilevel internal 1391 */ 1392 private boolean needsSignatureAttribute_compute() { return true; } 1393 /** 1394 * A type is reifiable if it either refers to a non-parameterized type, 1395 * is a raw type, is a parameterized type with only unbound wildcard 1396 * parameters or is an array type with a reifiable type parameter. 1397 * 1398 * @see "JLSv3 §4.7" 1399 * @attribute syn 1400 * @aspect SafeVarargs 1401 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/SafeVarargs.jrag:106 1402 */ 1403 public boolean isReifiable() { 1404 ASTNode$State state = state(); 1405 try { 1406 if (isRawType()) 1407 return true; 1408 for (int i = 0; i < getNumArgument(); ++i) { 1409 if (!getArgument(i).type().isWildcard()) 1410 return false; 1411 } 1412 return true; 1413 } 1414 finally { 1415 } 1416 } 1417 /** 1418 * @attribute syn 1419 * @aspect Generics 1420 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:244 1421 */ 1422 public boolean isParameterizedType() { 1423 ASTNode$State state = state(); 1424 try { return true; } 1425 finally { 1426 } 1427 } 1428 /** 1429 * @attribute syn 1430 * @aspect GenericsTypeCheck 1431 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:380 1432 */ 1433 public boolean sameArgument(ParTypeDecl decl) { 1434 ASTNode$State state = state(); 1435 try { 1436 if(this == decl) return true; 1437 if(genericDecl() != decl.genericDecl()) 1438 return false; 1439 for(int i = 0; i < getNumArgument(); i++) { 1440 TypeDecl t1 = getArgument(i).type(); 1441 TypeDecl t2 = decl.getArgument(i).type(); 1442 if(t1 instanceof ParTypeDecl && t2 instanceof ParTypeDecl) { 1443 if(!((ParTypeDecl)t1).sameArgument((ParTypeDecl)t2)) 1444 return false; 1445 } 1446 else { 1447 if(t1 != t2) 1448 return false; 1449 } 1450 } 1451 return true; 1452 } 1453 finally { 1454 } 1455 } 1456 /** 1457 * @attribute syn 1458 * @aspect LookupParTypeDecl 1459 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:577 1460 */ 1461 public boolean sameSignature(Access a) { 1462 ASTNode$State state = state(); 1463 try { 1464 if(a instanceof ParTypeAccess) { 1465 ParTypeAccess ta = (ParTypeAccess)a; 1466 if(genericDecl() != ta.genericDecl()) 1467 return false; 1468 if(getNumArgument() != ta.getNumTypeArgument()) 1469 return false; 1470 for(int i = 0; i < getNumArgument(); i++) 1471 if(!getArgument(i).type().sameSignature(ta.getTypeArgument(i))) 1472 return false; 1473 return true; 1474 } 1475 else if(a instanceof TypeAccess && ((TypeAccess)a).isRaw()) 1476 return false; 1477 return super.sameSignature(a); 1478 } 1479 finally { 1480 } 1481 } 1482 protected java.util.Map sameSignature_ArrayList_values; 1483 /** 1484 * @attribute syn 1485 * @aspect LookupParTypeDecl 1486 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:612 1487 */ 1488 @SuppressWarnings({"unchecked", "cast"}) 1489 public boolean sameSignature(ArrayList list) { 1490 Object _parameters = list; 1491 if(sameSignature_ArrayList_values == null) sameSignature_ArrayList_values = new java.util.HashMap(4); 1492 ASTNode$State.CircularValue _value; 1493 if(sameSignature_ArrayList_values.containsKey(_parameters)) { 1494 Object _o = sameSignature_ArrayList_values.get(_parameters); 1495 if(!(_o instanceof ASTNode$State.CircularValue)) { 1496 return ((Boolean)_o).booleanValue(); 1497 } 1498 else 1499 _value = (ASTNode$State.CircularValue)_o; 1500 } 1501 else { 1502 _value = new ASTNode$State.CircularValue(); 1503 sameSignature_ArrayList_values.put(_parameters, _value); 1504 _value.value = Boolean.valueOf(true); 1505 } 1506 ASTNode$State state = state(); 1507 if (!state.IN_CIRCLE) { 1508 state.IN_CIRCLE = true; 1509 int num = state.boundariesCrossed; 1510 boolean isFinal = this.is$Final(); 1511 boolean new_sameSignature_ArrayList_value; 1512 do { 1513 _value.visited = new Integer(state.CIRCLE_INDEX); 1514 state.CHANGE = false; 1515 new_sameSignature_ArrayList_value = sameSignature_compute(list); 1516 if (new_sameSignature_ArrayList_value!=((Boolean)_value.value).booleanValue()) { 1517 state.CHANGE = true; 1518 _value.value = Boolean.valueOf(new_sameSignature_ArrayList_value); 1519 } 1520 state.CIRCLE_INDEX++; 1521 } while (state.CHANGE); 1522 if(isFinal && num == state().boundariesCrossed) { 1523 sameSignature_ArrayList_values.put(_parameters, new_sameSignature_ArrayList_value); 1524 } 1525 else { 1526 sameSignature_ArrayList_values.remove(_parameters); 1527 state.RESET_CYCLE = true; 1528 sameSignature_compute(list); 1529 state.RESET_CYCLE = false; 1530 } 1531 state.IN_CIRCLE = false; 1532 return new_sameSignature_ArrayList_value; 1533 } 1534 if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) { 1535 _value.visited = new Integer(state.CIRCLE_INDEX); 1536 boolean new_sameSignature_ArrayList_value = sameSignature_compute(list); 1537 if (state.RESET_CYCLE) { 1538 sameSignature_ArrayList_values.remove(_parameters); 1539 } 1540 else if (new_sameSignature_ArrayList_value!=((Boolean)_value.value).booleanValue()) { 1541 state.CHANGE = true; 1542 _value.value = new_sameSignature_ArrayList_value; 1543 } 1544 return new_sameSignature_ArrayList_value; 1545 } 1546 return ((Boolean)_value.value).booleanValue(); 1547 } 1548 /** 1549 * @apilevel internal 1550 */ 1551 private boolean sameSignature_compute(ArrayList list) { 1552 if(getNumArgument() != list.size()) 1553 return false; 1554 for(int i = 0; i < list.size(); i++) 1555 if(getArgument(i).type() != list.get(i)) 1556 return false; 1557 return true; 1558 } 1559 /** 1560 * @apilevel internal 1561 */ 1562 protected int usesTypeVariable_visited = -1; 1563 /** 1564 * @apilevel internal 1565 */ 1566 protected boolean usesTypeVariable_computed = false; 1567 /** 1568 * @apilevel internal 1569 */ 1570 protected boolean usesTypeVariable_initialized = false; 1571 /** 1572 * @apilevel internal 1573 */ 1574 protected boolean usesTypeVariable_value; 1575 /** 1576 * @attribute syn 1577 * @aspect LookupParTypeDecl 1578 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1069 1579 */ 1580 @SuppressWarnings({"unchecked", "cast"}) 1581 public boolean usesTypeVariable() { 1582 if(usesTypeVariable_computed) { 1583 return usesTypeVariable_value; 1584 } 1585 ASTNode$State state = state(); 1586 if (!usesTypeVariable_initialized) { 1587 usesTypeVariable_initialized = true; 1588 usesTypeVariable_value = false; 1589 } 1590 if (!state.IN_CIRCLE) { 1591 state.IN_CIRCLE = true; 1592 int num = state.boundariesCrossed; 1593 boolean isFinal = this.is$Final(); 1594 do { 1595 usesTypeVariable_visited = state.CIRCLE_INDEX; 1596 state.CHANGE = false; 1597 boolean new_usesTypeVariable_value = usesTypeVariable_compute(); 1598 if (new_usesTypeVariable_value!=usesTypeVariable_value) 1599 state.CHANGE = true; 1600 usesTypeVariable_value = new_usesTypeVariable_value; 1601 state.CIRCLE_INDEX++; 1602 } while (state.CHANGE); 1603 if(isFinal && num == state().boundariesCrossed) { 1604 usesTypeVariable_computed = true; 1605 } 1606 else { 1607 state.RESET_CYCLE = true; 1608 usesTypeVariable_compute(); 1609 state.RESET_CYCLE = false; 1610 usesTypeVariable_computed = false; 1611 usesTypeVariable_initialized = false; 1612 } 1613 state.IN_CIRCLE = false; 1614 return usesTypeVariable_value; 1615 } 1616 if(usesTypeVariable_visited != state.CIRCLE_INDEX) { 1617 usesTypeVariable_visited = state.CIRCLE_INDEX; 1618 if (state.RESET_CYCLE) { 1619 usesTypeVariable_computed = false; 1620 usesTypeVariable_initialized = false; 1621 usesTypeVariable_visited = -1; 1622 return usesTypeVariable_value; 1623 } 1624 boolean new_usesTypeVariable_value = usesTypeVariable_compute(); 1625 if (new_usesTypeVariable_value!=usesTypeVariable_value) 1626 state.CHANGE = true; 1627 usesTypeVariable_value = new_usesTypeVariable_value; 1628 return usesTypeVariable_value; 1629 } 1630 return usesTypeVariable_value; 1631 } 1632 /** 1633 * @apilevel internal 1634 */ 1635 private boolean usesTypeVariable_compute() { 1636 if(super.usesTypeVariable()) 1637 return true; 1638 for(int i = 0; i < getNumArgument(); i++) 1639 if(getArgument(i).type().usesTypeVariable()) 1640 return true; 1641 return false; 1642 } 1643 /** 1644 * @attribute syn 1645 * @aspect LookupParTypeDecl 1646 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1306 1647 */ 1648 public TypeDecl original() { 1649 ASTNode$State state = state(); 1650 try { return genericDecl().original(); } 1651 finally { 1652 } 1653 } 1654 /** 1655 * @apilevel internal 1656 */ 1657 protected boolean sourceTypeDecl_computed = false; 1658 /** 1659 * @apilevel internal 1660 */ 1661 protected TypeDecl sourceTypeDecl_value; 1662 /** 1663 * @attribute syn 1664 * @aspect SourceDeclarations 1665 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1505 1666 */ 1667 @SuppressWarnings({"unchecked", "cast"}) 1668 public TypeDecl sourceTypeDecl() { 1669 if(sourceTypeDecl_computed) { 1670 return sourceTypeDecl_value; 1671 } 1672 ASTNode$State state = state(); 1673 int num = state.boundariesCrossed; 1674 boolean isFinal = this.is$Final(); 1675 sourceTypeDecl_value = sourceTypeDecl_compute(); 1676 if(isFinal && num == state().boundariesCrossed){ sourceTypeDecl_computed = true; } 1677 return sourceTypeDecl_value; 1678 } 1679 /** 1680 * @apilevel internal 1681 */ 1682 private TypeDecl sourceTypeDecl_compute() { return genericDecl().original().sourceTypeDecl(); } 1683 /** 1684 * @apilevel internal 1685 */ 1686 protected boolean fullName_computed = false; 1687 /** 1688 * @apilevel internal 1689 */ 1690 protected String fullName_value; 1691 /** 1692 * @attribute syn 1693 * @aspect GenericsParTypeDecl 1694 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsParTypeDecl.jrag:12 1695 */ 1696 @SuppressWarnings({"unchecked", "cast"}) 1697 public String fullName() { 1698 if(fullName_computed) { 1699 return fullName_value; 1700 } 1701 ASTNode$State state = state(); 1702 int num = state.boundariesCrossed; 1703 boolean isFinal = this.is$Final(); 1704 fullName_value = fullName_compute(); 1705 if(isFinal && num == state().boundariesCrossed){ fullName_computed = true; } 1706 return fullName_value; 1707 } 1708 /** 1709 * @apilevel internal 1710 */ 1711 private String fullName_compute() { 1712 if(isNestedType()) 1713 return enclosingType().fullName() + "." + nameWithArgs(); 1714 String packageName = packageName(); 1715 if(packageName.equals("")) 1716 return nameWithArgs(); 1717 return packageName + "." + nameWithArgs(); 1718 } 1719 /** 1720 * @apilevel internal 1721 */ 1722 protected boolean typeName_computed = false; 1723 /** 1724 * @apilevel internal 1725 */ 1726 protected String typeName_value; 1727 /** 1728 * @attribute syn 1729 * @aspect GenericsParTypeDecl 1730 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsParTypeDecl.jrag:21 1731 */ 1732 @SuppressWarnings({"unchecked", "cast"}) 1733 public String typeName() { 1734 if(typeName_computed) { 1735 return typeName_value; 1736 } 1737 ASTNode$State state = state(); 1738 int num = state.boundariesCrossed; 1739 boolean isFinal = this.is$Final(); 1740 typeName_value = typeName_compute(); 1741 if(isFinal && num == state().boundariesCrossed){ typeName_computed = true; } 1742 return typeName_value; 1743 } 1744 /** 1745 * @apilevel internal 1746 */ 1747 private String typeName_compute() { 1748 if(isNestedType()) 1749 return enclosingType().typeName() + "." + nameWithArgs(); 1750 String packageName = packageName(); 1751 if(packageName.equals("") || packageName.equals(PRIMITIVE_PACKAGE_NAME)) 1752 return nameWithArgs(); 1753 return packageName + "." + nameWithArgs(); 1754 } 1755 /** 1756 * @attribute syn 1757 * @aspect GenericsParTypeDecl 1758 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsParTypeDecl.jrag:30 1759 */ 1760 public String nameWithArgs() { 1761 ASTNode$State state = state(); 1762 try { 1763 StringBuffer s = new StringBuffer(); 1764 s.append(name()); 1765 s.append("<"); 1766 for(int i = 0; i < getNumArgument(); i++) { 1767 if(i != 0) 1768 s.append(", "); 1769 s.append(getArgument(i).type().fullName()); 1770 } 1771 s.append(">"); 1772 return s.toString(); 1773 } 1774 finally { 1775 } 1776 } 1777 /** 1778 * @apilevel internal 1779 */ 1780 protected boolean unimplementedMethods_computed = false; 1781 /** 1782 * @apilevel internal 1783 */ 1784 protected Collection unimplementedMethods_value; 1785 /** 1786 * @attribute syn 1787 * @aspect MethodSignature15 1788 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/MethodSignature.jrag:406 1789 */ 1790 @SuppressWarnings({"unchecked", "cast"}) 1791 public Collection unimplementedMethods() { 1792 if(unimplementedMethods_computed) { 1793 return unimplementedMethods_value; 1794 } 1795 ASTNode$State state = state(); 1796 int num = state.boundariesCrossed; 1797 boolean isFinal = this.is$Final(); 1798 unimplementedMethods_value = unimplementedMethods_compute(); 1799 if(isFinal && num == state().boundariesCrossed){ unimplementedMethods_computed = true; } 1800 return unimplementedMethods_value; 1801 } 1802 /** 1803 * @apilevel internal 1804 */ 1805 private Collection unimplementedMethods_compute() { 1806 HashSet set = new HashSet(); 1807 HashSet result = new HashSet(); 1808 for(Iterator iter = genericDecl().unimplementedMethods().iterator(); iter.hasNext(); ) { 1809 MethodDecl m = (MethodDecl)iter.next(); 1810 set.add(m.sourceMethodDecl()); 1811 } 1812 for(Iterator iter = super.unimplementedMethods().iterator(); iter.hasNext(); ) { 1813 MethodDecl m = (MethodDecl)iter.next(); 1814 if(set.contains(m.sourceMethodDecl())) 1815 result.add(m); 1816 } 1817 return result; 1818 } 1819 /** 1820 * @apilevel internal 1821 */ 1822 protected boolean uniqueIndex_computed = false; 1823 /** 1824 * @apilevel internal 1825 */ 1826 protected int uniqueIndex_value; 1827 /** 1828 * @attribute syn 1829 * @aspect GenericsCodegen 1830 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:33 1831 */ 1832 @SuppressWarnings({"unchecked", "cast"}) 1833 public int uniqueIndex() { 1834 if(uniqueIndex_computed) { 1835 return uniqueIndex_value; 1836 } 1837 ASTNode$State state = state(); 1838 int num = state.boundariesCrossed; 1839 boolean isFinal = this.is$Final(); 1840 uniqueIndex_value = uniqueIndex_compute(); 1841 if(isFinal && num == state().boundariesCrossed){ uniqueIndex_computed = true; } 1842 return uniqueIndex_value; 1843 } 1844 /** 1845 * @apilevel internal 1846 */ 1847 private int uniqueIndex_compute() { return genericDecl().uniqueIndex(); } 1848 /** 1849 * @attribute syn 1850 * @aspect GenericsCodegen 1851 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:470 1852 */ 1853 public String typeArgumentsOpt() { 1854 ASTNode$State state = state(); 1855 try { 1856 StringBuffer buf = new StringBuffer(); 1857 buf.append("<"); 1858 for(int i = 0; i < getNumArgument(); i++) 1859 buf.append(getArgument(i).type().fieldTypeSignature()); 1860 buf.append(">"); 1861 return buf.toString(); 1862 } 1863 finally { 1864 } 1865 } 1866 /** 1867 * @apilevel internal 1868 */ 1869 protected boolean localMethodsSignatureMap_computed = false; 1870 /** 1871 * @apilevel internal 1872 */ 1873 protected HashMap localMethodsSignatureMap_value; 1874 /** 1875 * @attribute syn 1876 * @aspect LookupParTypeDecl 1877 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1084 1878 */ 1879 @SuppressWarnings({"unchecked", "cast"}) 1880 public HashMap localMethodsSignatureMap() { 1881 if(localMethodsSignatureMap_computed) { 1882 return localMethodsSignatureMap_value; 1883 } 1884 ASTNode$State state = state(); 1885 int num = state.boundariesCrossed; 1886 boolean isFinal = this.is$Final(); 1887 localMethodsSignatureMap_value = localMethodsSignatureMap_compute(); 1888 if(true){ localMethodsSignatureMap_computed = true; } 1889 return localMethodsSignatureMap_value; 1890 } 1891 /** 1892 * @apilevel internal 1893 */ 1894 private HashMap localMethodsSignatureMap_compute() { 1895 HashMap map = new HashMap(); 1896 for(Iterator iter = original().localMethodsIterator(); iter.hasNext(); ) { 1897 MethodDecl decl = (MethodDecl)iter.next(); 1898 1899 /* ES removing this: 1900 if(!decl.isStatic() && (decl.usesTypeVariable() || isRawType())) { 1901 BodyDecl b = decl.substitutedBodyDecl(this); 1902 addBodyDecl(b); 1903 // Here we should access b through an ordinary 1904 // child accessor instead of setting is$Final directly, 1905 // however doing so appears to cause unexpected behaviour! 1906 b.is$Final = true; 1907 decl = (MethodDecl) b; 1908 } 1909 map.put(decl.signature(), decl); 1910 * and replacing with: 1911 */ 1912 if(!decl.isStatic() && (decl.usesTypeVariable() || isRawType())) { 1913 BodyDecl copyDecl = ((BodyDeclList)getBodyDeclList()).localMethodSignatureCopy(decl, this); 1914 decl = (MethodDecl) copyDecl; 1915 } 1916 map.put(decl.signature(), decl); 1917 1918 } 1919 return map; 1920 } 1921 protected java.util.Map localFields_String_values; 1922 /** 1923 * @attribute syn 1924 * @aspect LookupParTypeDecl 1925 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1119 1926 */ 1927 @SuppressWarnings({"unchecked", "cast"}) 1928 public SimpleSet localFields(String name) { 1929 Object _parameters = name; 1930 if(localFields_String_values == null) localFields_String_values = new java.util.HashMap(4); 1931 if(localFields_String_values.containsKey(_parameters)) { 1932 return (SimpleSet)localFields_String_values.get(_parameters); 1933 } 1934 ASTNode$State state = state(); 1935 int num = state.boundariesCrossed; 1936 boolean isFinal = this.is$Final(); 1937 SimpleSet localFields_String_value = localFields_compute(name); 1938 if(true){ localFields_String_values.put(_parameters, localFields_String_value); } 1939 return localFields_String_value; 1940 } 1941 /** 1942 * @apilevel internal 1943 */ 1944 private SimpleSet localFields_compute(String name) { 1945 SimpleSet set = SimpleSet.emptySet; 1946 for(Iterator iter = original().localFields(name).iterator(); iter.hasNext(); ) { 1947 FieldDeclaration f = (FieldDeclaration)iter.next(); 1948 1949 /* ES removing this: 1950 if(!f.isStatic() && (f.usesTypeVariable() || isRawType())) { 1951 BodyDecl b = f.substitutedBodyDecl(this); 1952 addBodyDecl(b); 1953 // Here we should access b through an ordinary 1954 // child accessor instead of setting is$Final directly, 1955 // however doing so appears to cause unexpected behaviour! 1956 b.is$Final = true; 1957 f = (FieldDeclaration) b; 1958 } 1959 set = set.add(f); 1960 * and replacing with: 1961 */ 1962 if(!f.isStatic() && (f.usesTypeVariable() || isRawType())) { 1963 BodyDecl fCopy = ((BodyDeclList)getBodyDeclList()).localFieldCopy(f, this); 1964 f = (FieldDeclaration) fCopy; 1965 } 1966 set = set.add(f); 1967 1968 } 1969 return set; 1970 } 1971 protected java.util.Map localTypeDecls_String_values; 1972 /** 1973 * @attribute syn 1974 * @aspect LookupParTypeDecl 1975 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1154 1976 */ 1977 @SuppressWarnings({"unchecked", "cast"}) 1978 public SimpleSet localTypeDecls(String name) { 1979 Object _parameters = name; 1980 if(localTypeDecls_String_values == null) localTypeDecls_String_values = new java.util.HashMap(4); 1981 ASTNode$State.CircularValue _value; 1982 if(localTypeDecls_String_values.containsKey(_parameters)) { 1983 Object _o = localTypeDecls_String_values.get(_parameters); 1984 if(!(_o instanceof ASTNode$State.CircularValue)) { 1985 return (SimpleSet)_o; 1986 } 1987 else 1988 _value = (ASTNode$State.CircularValue)_o; 1989 } 1990 else { 1991 _value = new ASTNode$State.CircularValue(); 1992 localTypeDecls_String_values.put(_parameters, _value); 1993 _value.value = SimpleSet.emptySet; 1994 } 1995 ASTNode$State state = state(); 1996 if (!state.IN_CIRCLE) { 1997 state.IN_CIRCLE = true; 1998 int num = state.boundariesCrossed; 1999 boolean isFinal = this.is$Final(); 2000 SimpleSet new_localTypeDecls_String_value; 2001 do { 2002 _value.visited = new Integer(state.CIRCLE_INDEX); 2003 state.CHANGE = false; 2004 new_localTypeDecls_String_value = localTypeDecls_compute(name); 2005 if ((new_localTypeDecls_String_value==null && (SimpleSet)_value.value!=null) || (new_localTypeDecls_String_value!=null && !new_localTypeDecls_String_value.equals((SimpleSet)_value.value))) { 2006 state.CHANGE = true; 2007 _value.value = new_localTypeDecls_String_value; 2008 } 2009 state.CIRCLE_INDEX++; 2010 } while (state.CHANGE); 2011 if(true) { 2012 localTypeDecls_String_values.put(_parameters, new_localTypeDecls_String_value); 2013 } 2014 else { 2015 localTypeDecls_String_values.remove(_parameters); 2016 state.RESET_CYCLE = true; 2017 localTypeDecls_compute(name); 2018 state.RESET_CYCLE = false; 2019 } 2020 state.IN_CIRCLE = false; 2021 return new_localTypeDecls_String_value; 2022 } 2023 if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) { 2024 _value.visited = new Integer(state.CIRCLE_INDEX); 2025 SimpleSet new_localTypeDecls_String_value = localTypeDecls_compute(name); 2026 if (state.RESET_CYCLE) { 2027 localTypeDecls_String_values.remove(_parameters); 2028 } 2029 else if ((new_localTypeDecls_String_value==null && (SimpleSet)_value.value!=null) || (new_localTypeDecls_String_value!=null && !new_localTypeDecls_String_value.equals((SimpleSet)_value.value))) { 2030 state.CHANGE = true; 2031 _value.value = new_localTypeDecls_String_value; 2032 } 2033 return new_localTypeDecls_String_value; 2034 } 2035 return (SimpleSet)_value.value; 2036 } 2037 /** 2038 * @apilevel internal 2039 */ 2040 private SimpleSet localTypeDecls_compute(String name) { 2041 SimpleSet set = SimpleSet.emptySet; 2042 for(Iterator iter = original().localTypeDecls(name).iterator(); iter.hasNext(); ) { 2043 TypeDecl t = (TypeDecl)iter.next(); 2044 2045 /* ES: removing this: 2046 if(t.isStatic()) 2047 set = set.add(t); 2048 else { 2049 BodyDecl b; 2050 TypeDecl typeDecl; 2051 if(t instanceof ClassDecl) { 2052 ClassDecl classDecl = (ClassDecl)t; 2053 typeDecl = classDecl.substitutedClassDecl(this); 2054 b = new MemberClassDecl((ClassDecl)typeDecl); 2055 addBodyDecl(b); 2056 // Here we should access b through an ordinary 2057 // child accessor instead of setting is$Final directly, 2058 // however doing so appears to cause unexpected behaviour! 2059 b.is$Final = true; 2060 set = set.add(typeDecl); 2061 } 2062 else if(t instanceof InterfaceDecl) { 2063 InterfaceDecl interfaceDecl = (InterfaceDecl)t; 2064 typeDecl = interfaceDecl.substitutedInterfaceDecl(this); 2065 b = new MemberInterfaceDecl((InterfaceDecl)typeDecl); 2066 addBodyDecl(b); 2067 // Here we should access b through an ordinary 2068 // child accessor instead of setting is$Final directly, 2069 // however doing so appears to cause unexpected behaviour! 2070 b.is$Final = true; 2071 set = set.add(typeDecl); 2072 } 2073 } 2074 * and replacing with: 2075 */ 2076 if(t.isStatic()) { 2077 set = set.add(t); 2078 } else if (t instanceof ClassDecl) { 2079 MemberClassDecl copy = ((BodyDeclList)getBodyDeclList()).localClassDeclCopy((ClassDecl)t, this); 2080 set = set.add(copy.getClassDecl()); 2081 } else if (t instanceof InterfaceDecl) { 2082 MemberInterfaceDecl copy = ((BodyDeclList)getBodyDeclList()).localInterfaceDeclCopy((InterfaceDecl)t, this); 2083 set = set.add(copy.getInterfaceDecl()); 2084 } 2085 } 2086 return set; 2087 } 2088 /** 2089 * @apilevel internal 2090 */ 2091 protected boolean constructors_computed = false; 2092 /** 2093 * @apilevel internal 2094 */ 2095 protected Collection constructors_value; 2096 /** 2097 * @attribute syn 2098 * @aspect LookupParTypeDecl 2099 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1213 2100 */ 2101 @SuppressWarnings({"unchecked", "cast"}) 2102 public Collection constructors() { 2103 if(constructors_computed) { 2104 return constructors_value; 2105 } 2106 ASTNode$State state = state(); 2107 int num = state.boundariesCrossed; 2108 boolean isFinal = this.is$Final(); 2109 constructors_value = constructors_compute(); 2110 if(isFinal && num == state().boundariesCrossed){ constructors_computed = true; } 2111 return constructors_value; 2112 } 2113 /** 2114 * @apilevel internal 2115 */ 2116 private Collection constructors_compute() { 2117 Collection set = new ArrayList(); 2118 for(Iterator iter = original().constructors().iterator(); iter.hasNext(); ) { 2119 ConstructorDecl c = (ConstructorDecl)iter.next(); 2120 2121 /* ES: removing this: 2122 BodyDecl b = c.substitutedBodyDecl(this); 2123 addBodyDecl(b); 2124 // Here we should access b through an ordinary 2125 // child accessor instead of setting is$Final directly, 2126 // however doing so appears to cause unexpected behaviour! 2127 b.is$Final = true; 2128 * and replacing with: 2129 */ 2130 BodyDecl b = ((BodyDeclList)getBodyDeclList()).constructorCopy(c, this); 2131 set.add(b); 2132 } 2133 return set; 2134 } 2135 /** 2136 * @apilevel internal 2137 */ 2138 protected boolean genericDecl_computed = false; 2139 /** 2140 * @apilevel internal 2141 */ 2142 protected TypeDecl genericDecl_value; 2143 /** 2144 * @attribute inh 2145 * @aspect GenericsParTypeDecl 2146 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsParTypeDecl.jrag:45 2147 */ 2148 @SuppressWarnings({"unchecked", "cast"}) 2149 public TypeDecl genericDecl() { 2150 if(genericDecl_computed) { 2151 return genericDecl_value; 2152 } 2153 ASTNode$State state = state(); 2154 int num = state.boundariesCrossed; 2155 boolean isFinal = this.is$Final(); 2156 genericDecl_value = getParent().Define_TypeDecl_genericDecl(this, null); 2157 if(isFinal && num == state().boundariesCrossed){ genericDecl_computed = true; } 2158 return genericDecl_value; 2159 } 2160 /** 2161 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:476 2162 * @apilevel internal 2163 */ 2164 public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) { 2165 if(caller == getArgumentListNoTransform()) { 2166 int childIndex = caller.getIndexOfChild(child); 2167 return NameType.TYPE_NAME; 2168 } 2169 else { return super.Define_NameType_nameType(caller, child); 2170 } 2171 } 2172 /** 2173 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsParTypeDecl.jrag:52 2174 * @apilevel internal 2175 */ 2176 public TypeDecl Define_TypeDecl_genericDecl(ASTNode caller, ASTNode child) { 2177 if(caller == getBodyDeclListNoTransform()) { 2178 int index = caller.getIndexOfChild(child); 2179 { 2180 if(getBodyDecl(index) instanceof MemberTypeDecl) { 2181 MemberTypeDecl m = (MemberTypeDecl)getBodyDecl(index); 2182 return extractSingleType(genericDecl().memberTypes(m.typeDecl().name())); 2183 } 2184 return genericDecl(); 2185 } 2186 } 2187 else { return getParent().Define_TypeDecl_genericDecl(this, caller); 2188 } 2189 } 2190 /** 2191 * @apilevel internal 2192 */ 2193 public ASTNode rewriteTo() { 2194 return super.rewriteTo(); 2195 } 2196 }