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 GenericClassDecl : {@link ClassDecl} ::= <span class="component">{@link Modifiers}</span> <span class="component"><ID:String></span> <span class="component">[SuperClassAccess:{@link Access}]</span> <span class="component">Implements:{@link Access}*</span> <span class="component">{@link BodyDecl}*</span> <span class="component">TypeParameter:{@link TypeVariable}*</span>; 016 * @ast node 017 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.ast:2 018 */ 019 public class GenericClassDecl extends ClassDecl implements Cloneable, GenericTypeDecl { 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 GenericClassDecl clone() throws CloneNotSupportedException { 035 GenericClassDecl node = (GenericClassDecl)super.clone(); 036 node.rawType_computed = false; 037 node.rawType_value = null; 038 node.lookupParTypeDecl_ArrayList_values = null; 039 node.lookupParTypeDecl_ArrayList_list = null; node.usesTypeVariable_visited = -1; 040 node.usesTypeVariable_computed = false; 041 node.usesTypeVariable_initialized = false; 042 node.subtype_TypeDecl_values = null; 043 node.instanceOf_TypeDecl_values = null; 044 node.constantPoolName_computed = false; 045 node.constantPoolName_value = null; 046 node.needsSignatureAttribute_computed = false; 047 node.classSignature_computed = false; 048 node.classSignature_value = null; 049 node.getPlaceholderMethodList_computed = false; 050 node.getPlaceholderMethodList_value = null; 051 node.lookupParTypeDecl_ParTypeAccess_values = null; 052 node.in$Circle(false); 053 node.is$Final(false); 054 return node; 055 } 056 /** 057 * @apilevel internal 058 */ 059 @SuppressWarnings({"unchecked", "cast"}) 060 public GenericClassDecl copy() { 061 062 try { 063 GenericClassDecl node = (GenericClassDecl) clone(); 064 node.parent = null; 065 if(children != null) 066 node.children = (ASTNode[]) children.clone(); 067 068 return node; 069 } catch (CloneNotSupportedException e) { 070 throw new Error("Error: clone not supported for " + getClass().getName()); 071 } 072 073 }/** 074 * Create a deep copy of the AST subtree at this node. 075 * The copy is dangling, i.e. has no parent. 076 * @return dangling copy of the subtree at this node 077 * @apilevel low-level 078 */ 079 @SuppressWarnings({"unchecked", "cast"}) 080 public GenericClassDecl fullCopy() { 081 082 GenericClassDecl tree = (GenericClassDecl) copy(); 083 if (children != null) { 084 for (int i = 0; i < children.length; ++i) { 085 086 ASTNode child = (ASTNode) children[i]; 087 if(child != null) { 088 child = child.fullCopy(); 089 tree.setChild(child, i); 090 } 091 } 092 } 093 return tree; 094 095 } /** 096 * @ast method 097 * @aspect GenericsTypeCheck 098 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:425 099 */ 100 public void typeCheck() { 101 super.typeCheck(); 102 if(instanceOf(typeThrowable())) 103 error(" generic class " + typeName() + " may not directly or indirectly inherit java.lang.Throwable"); 104 } 105 /** 106 * @ast method 107 * @aspect LookupParTypeDecl 108 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1324 109 */ 110 public ClassDecl substitutedClassDecl(Parameterization parTypeDecl) { 111 GenericClassDecl c = new GenericClassDeclSubstituted( 112 (Modifiers)getModifiers().fullCopy(), 113 getID(), 114 hasSuperClassAccess() ? new Opt(getSuperClassAccess().type().substitute(parTypeDecl)) : new Opt(), 115 getImplementsList().substitute(parTypeDecl), 116 // ES: new List(), 117 new List(), // delegates TypeParameter lookup to original 118 this 119 ); 120 return c; 121 } 122 /** 123 * @ast method 124 * @aspect GenericsPrettyPrint 125 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsPrettyPrint.jrag:61 126 */ 127 private void ppTypeParameters(StringBuffer s) { 128 s.append('<'); 129 if (getNumTypeParameter() > 0) { 130 getTypeParameter(0).toString(s); 131 for (int i = 1; i < getNumTypeParameter(); i++) { 132 s.append(", "); 133 getTypeParameter(i).toString(s); 134 } 135 } 136 s.append('>'); 137 } 138 /** 139 * @ast method 140 * @aspect GenericsPrettyPrint 141 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsPrettyPrint.jrag:73 142 */ 143 public void toString(StringBuffer s) { 144 getModifiers().toString(s); 145 s.append("class " + getID()); 146 ppTypeParameters(s); 147 if(hasSuperClassAccess()) { 148 s.append(" extends "); 149 getSuperClassAccess().toString(s); 150 } 151 if(getNumImplements() > 0) { 152 s.append(" implements "); 153 getImplements(0).toString(s); 154 for(int i = 1; i < getNumImplements(); i++) { 155 s.append(", "); 156 getImplements(i).toString(s); 157 } 158 } 159 160 /* 161 s.append(" instantiated with: "); 162 for(int i = 0; i < getNumParTypeDecl(); i++) { 163 if(i != 0) s.append(", "); 164 ParTypeDecl decl = getParTypeDecl(i); 165 s.append("<"); 166 for(int j = 0; j < decl.getNumArgument(); j++) { 167 if(j != 0) s.append(", "); 168 s.append(decl.getArgument(j).type().fullName()); 169 } 170 s.append(">"); 171 } 172 */ 173 174 ppBodyDecls(s); 175 176 /* 177 for(int i = 0; i < getNumParTypeDecl(); i++) { 178 ParClassDecl decl = getParTypeDecl(i); 179 decl.toString(s); 180 } 181 */ 182 183 } 184 /** 185 * @ast method 186 * @aspect Generics 187 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:235 188 */ 189 public TypeDecl makeGeneric(Signatures.ClassSignature s) { 190 return (TypeDecl)this; 191 } 192 /** 193 * @ast method 194 * @aspect GenericsNameBinding 195 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:489 196 */ 197 public SimpleSet addTypeVariables(SimpleSet c, String name) { 198 GenericTypeDecl original = (GenericTypeDecl)original(); 199 for(int i = 0; i < original.getNumTypeParameter(); i++) { 200 TypeVariable p = original.getTypeParameter(i); 201 if(p.name().equals(name)) 202 c = c.add(p); 203 } 204 return c; 205 } 206 /** 207 * @ast method 208 * @aspect LookupParTypeDecl 209 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:799 210 */ 211 public List createArgumentList(ArrayList params) { 212 GenericTypeDecl original = (GenericTypeDecl)original(); 213 List list = new List(); 214 if(params.isEmpty()) { 215 // Change: Don't add any thing to the list. 216 // Concern: The previous version seem to add the erasure of the type variable for some reason, 217 // maybe this is how the raw type is represented (?), but this doesn't really comply with the 218 // claim that raw types don't have any type variables...? 219 for(int i = 0; i < original.getNumTypeParameter(); i++) 220 list.add(original.getTypeParameter(i).erasure().createBoundAccess()); 221 } else 222 for(Iterator iter = params.iterator(); iter.hasNext(); ) 223 list.add(((TypeDecl)iter.next()).createBoundAccess()); 224 return list; 225 } 226 /** 227 * @ast method 228 * 229 */ 230 public GenericClassDecl() { 231 super(); 232 233 234 } 235 /** 236 * Initializes the child array to the correct size. 237 * Initializes List and Opt nta children. 238 * @apilevel internal 239 * @ast method 240 * @ast method 241 * 242 */ 243 public void init$Children() { 244 children = new ASTNode[5]; 245 setChild(new Opt(), 1); 246 setChild(new List(), 2); 247 setChild(new List(), 3); 248 setChild(new List(), 4); 249 } 250 /** 251 * @ast method 252 * 253 */ 254 public GenericClassDecl(Modifiers p0, String p1, Opt<Access> p2, List<Access> p3, List<BodyDecl> p4, List<TypeVariable> p5) { 255 setChild(p0, 0); 256 setID(p1); 257 setChild(p2, 1); 258 setChild(p3, 2); 259 setChild(p4, 3); 260 setChild(p5, 4); 261 } 262 /** 263 * @ast method 264 * 265 */ 266 public GenericClassDecl(Modifiers p0, beaver.Symbol p1, Opt<Access> p2, List<Access> p3, List<BodyDecl> p4, List<TypeVariable> p5) { 267 setChild(p0, 0); 268 setID(p1); 269 setChild(p2, 1); 270 setChild(p3, 2); 271 setChild(p4, 3); 272 setChild(p5, 4); 273 } 274 /** 275 * @apilevel low-level 276 * @ast method 277 * 278 */ 279 protected int numChildren() { 280 return 5; 281 } 282 /** 283 * @apilevel internal 284 * @ast method 285 * 286 */ 287 public boolean mayHaveRewrite() { 288 return false; 289 } 290 /** 291 * Replaces the Modifiers child. 292 * @param node The new node to replace the Modifiers child. 293 * @apilevel high-level 294 * @ast method 295 * 296 */ 297 public void setModifiers(Modifiers node) { 298 setChild(node, 0); 299 } 300 /** 301 * Retrieves the Modifiers child. 302 * @return The current node used as the Modifiers child. 303 * @apilevel high-level 304 * @ast method 305 * 306 */ 307 public Modifiers getModifiers() { 308 return (Modifiers)getChild(0); 309 } 310 /** 311 * Retrieves the Modifiers child. 312 * <p><em>This method does not invoke AST transformations.</em></p> 313 * @return The current node used as the Modifiers child. 314 * @apilevel low-level 315 * @ast method 316 * 317 */ 318 public Modifiers getModifiersNoTransform() { 319 return (Modifiers)getChildNoTransform(0); 320 } 321 /** 322 * Replaces the lexeme ID. 323 * @param value The new value for the lexeme ID. 324 * @apilevel high-level 325 * @ast method 326 * 327 */ 328 public void setID(String value) { 329 tokenString_ID = value; 330 } 331 /** 332 * JastAdd-internal setter for lexeme ID using the Beaver parser. 333 * @apilevel internal 334 * @ast method 335 * 336 */ 337 public void setID(beaver.Symbol symbol) { 338 if(symbol.value != null && !(symbol.value instanceof String)) 339 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 340 tokenString_ID = (String)symbol.value; 341 IDstart = symbol.getStart(); 342 IDend = symbol.getEnd(); 343 } 344 /** 345 * Retrieves the value for the lexeme ID. 346 * @return The value for the lexeme ID. 347 * @apilevel high-level 348 * @ast method 349 * 350 */ 351 public String getID() { 352 return tokenString_ID != null ? tokenString_ID : ""; 353 } 354 /** 355 * Replaces the optional node for the SuperClassAccess child. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 356 * @param opt The new node to be used as the optional node for the SuperClassAccess child. 357 * @apilevel low-level 358 * @ast method 359 * 360 */ 361 public void setSuperClassAccessOpt(Opt<Access> opt) { 362 setChild(opt, 1); 363 } 364 /** 365 * Check whether the optional SuperClassAccess child exists. 366 * @return {@code true} if the optional SuperClassAccess child exists, {@code false} if it does not. 367 * @apilevel high-level 368 * @ast method 369 * 370 */ 371 public boolean hasSuperClassAccess() { 372 return getSuperClassAccessOpt().getNumChild() != 0; 373 } 374 /** 375 * Retrieves the (optional) SuperClassAccess child. 376 * @return The SuperClassAccess child, if it exists. Returns {@code null} otherwise. 377 * @apilevel low-level 378 * @ast method 379 * 380 */ 381 @SuppressWarnings({"unchecked", "cast"}) 382 public Access getSuperClassAccess() { 383 return (Access)getSuperClassAccessOpt().getChild(0); 384 } 385 /** 386 * Replaces the (optional) SuperClassAccess child. 387 * @param node The new node to be used as the SuperClassAccess child. 388 * @apilevel high-level 389 * @ast method 390 * 391 */ 392 public void setSuperClassAccess(Access node) { 393 getSuperClassAccessOpt().setChild(node, 0); 394 } 395 /** 396 * @apilevel low-level 397 * @ast method 398 * 399 */ 400 @SuppressWarnings({"unchecked", "cast"}) 401 public Opt<Access> getSuperClassAccessOpt() { 402 return (Opt<Access>)getChild(1); 403 } 404 /** 405 * Retrieves the optional node for child SuperClassAccess. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 406 * <p><em>This method does not invoke AST transformations.</em></p> 407 * @return The optional node for child SuperClassAccess. 408 * @apilevel low-level 409 * @ast method 410 * 411 */ 412 @SuppressWarnings({"unchecked", "cast"}) 413 public Opt<Access> getSuperClassAccessOptNoTransform() { 414 return (Opt<Access>)getChildNoTransform(1); 415 } 416 /** 417 * Replaces the Implements list. 418 * @param list The new list node to be used as the Implements list. 419 * @apilevel high-level 420 * @ast method 421 * 422 */ 423 public void setImplementsList(List<Access> list) { 424 setChild(list, 2); 425 } 426 /** 427 * Retrieves the number of children in the Implements list. 428 * @return Number of children in the Implements list. 429 * @apilevel high-level 430 * @ast method 431 * 432 */ 433 public int getNumImplements() { 434 return getImplementsList().getNumChild(); 435 } 436 /** 437 * Retrieves the number of children in the Implements list. 438 * Calling this method will not trigger rewrites.. 439 * @return Number of children in the Implements list. 440 * @apilevel low-level 441 * @ast method 442 * 443 */ 444 public int getNumImplementsNoTransform() { 445 return getImplementsListNoTransform().getNumChildNoTransform(); 446 } 447 /** 448 * Retrieves the element at index {@code i} in the Implements list.. 449 * @param i Index of the element to return. 450 * @return The element at position {@code i} in the Implements list. 451 * @apilevel high-level 452 * @ast method 453 * 454 */ 455 @SuppressWarnings({"unchecked", "cast"}) 456 public Access getImplements(int i) { 457 return (Access)getImplementsList().getChild(i); 458 } 459 /** 460 * Append an element to the Implements list. 461 * @param node The element to append to the Implements list. 462 * @apilevel high-level 463 * @ast method 464 * 465 */ 466 public void addImplements(Access node) { 467 List<Access> list = (parent == null || state == null) ? getImplementsListNoTransform() : getImplementsList(); 468 list.addChild(node); 469 } 470 /** 471 * @apilevel low-level 472 * @ast method 473 * 474 */ 475 public void addImplementsNoTransform(Access node) { 476 List<Access> list = getImplementsListNoTransform(); 477 list.addChild(node); 478 } 479 /** 480 * Replaces the Implements list element at index {@code i} with the new node {@code node}. 481 * @param node The new node to replace the old list element. 482 * @param i The list index of the node to be replaced. 483 * @apilevel high-level 484 * @ast method 485 * 486 */ 487 public void setImplements(Access node, int i) { 488 List<Access> list = getImplementsList(); 489 list.setChild(node, i); 490 } 491 /** 492 * Retrieves the Implements list. 493 * @return The node representing the Implements list. 494 * @apilevel high-level 495 * @ast method 496 * 497 */ 498 public List<Access> getImplementss() { 499 return getImplementsList(); 500 } 501 /** 502 * Retrieves the Implements list. 503 * <p><em>This method does not invoke AST transformations.</em></p> 504 * @return The node representing the Implements list. 505 * @apilevel low-level 506 * @ast method 507 * 508 */ 509 public List<Access> getImplementssNoTransform() { 510 return getImplementsListNoTransform(); 511 } 512 /** 513 * Retrieves the Implements list. 514 * @return The node representing the Implements list. 515 * @apilevel high-level 516 * @ast method 517 * 518 */ 519 @SuppressWarnings({"unchecked", "cast"}) 520 public List<Access> getImplementsList() { 521 List<Access> list = (List<Access>)getChild(2); 522 list.getNumChild(); 523 return list; 524 } 525 /** 526 * Retrieves the Implements list. 527 * <p><em>This method does not invoke AST transformations.</em></p> 528 * @return The node representing the Implements list. 529 * @apilevel low-level 530 * @ast method 531 * 532 */ 533 @SuppressWarnings({"unchecked", "cast"}) 534 public List<Access> getImplementsListNoTransform() { 535 return (List<Access>)getChildNoTransform(2); 536 } 537 /** 538 * Replaces the BodyDecl list. 539 * @param list The new list node to be used as the BodyDecl list. 540 * @apilevel high-level 541 * @ast method 542 * 543 */ 544 public void setBodyDeclList(List<BodyDecl> list) { 545 setChild(list, 3); 546 } 547 /** 548 * Retrieves the number of children in the BodyDecl list. 549 * @return Number of children in the BodyDecl list. 550 * @apilevel high-level 551 * @ast method 552 * 553 */ 554 public int getNumBodyDecl() { 555 return getBodyDeclList().getNumChild(); 556 } 557 /** 558 * Retrieves the number of children in the BodyDecl list. 559 * Calling this method will not trigger rewrites.. 560 * @return Number of children in the BodyDecl list. 561 * @apilevel low-level 562 * @ast method 563 * 564 */ 565 public int getNumBodyDeclNoTransform() { 566 return getBodyDeclListNoTransform().getNumChildNoTransform(); 567 } 568 /** 569 * Retrieves the element at index {@code i} in the BodyDecl list.. 570 * @param i Index of the element to return. 571 * @return The element at position {@code i} in the BodyDecl list. 572 * @apilevel high-level 573 * @ast method 574 * 575 */ 576 @SuppressWarnings({"unchecked", "cast"}) 577 public BodyDecl getBodyDecl(int i) { 578 return (BodyDecl)getBodyDeclList().getChild(i); 579 } 580 /** 581 * Append an element to the BodyDecl list. 582 * @param node The element to append to the BodyDecl list. 583 * @apilevel high-level 584 * @ast method 585 * 586 */ 587 public void addBodyDecl(BodyDecl node) { 588 List<BodyDecl> list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); 589 list.addChild(node); 590 } 591 /** 592 * @apilevel low-level 593 * @ast method 594 * 595 */ 596 public void addBodyDeclNoTransform(BodyDecl node) { 597 List<BodyDecl> list = getBodyDeclListNoTransform(); 598 list.addChild(node); 599 } 600 /** 601 * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. 602 * @param node The new node to replace the old list element. 603 * @param i The list index of the node to be replaced. 604 * @apilevel high-level 605 * @ast method 606 * 607 */ 608 public void setBodyDecl(BodyDecl node, int i) { 609 List<BodyDecl> list = getBodyDeclList(); 610 list.setChild(node, i); 611 } 612 /** 613 * Retrieves the BodyDecl list. 614 * @return The node representing the BodyDecl list. 615 * @apilevel high-level 616 * @ast method 617 * 618 */ 619 public List<BodyDecl> getBodyDecls() { 620 return getBodyDeclList(); 621 } 622 /** 623 * Retrieves the BodyDecl list. 624 * <p><em>This method does not invoke AST transformations.</em></p> 625 * @return The node representing the BodyDecl list. 626 * @apilevel low-level 627 * @ast method 628 * 629 */ 630 public List<BodyDecl> getBodyDeclsNoTransform() { 631 return getBodyDeclListNoTransform(); 632 } 633 /** 634 * Retrieves the BodyDecl list. 635 * @return The node representing the BodyDecl list. 636 * @apilevel high-level 637 * @ast method 638 * 639 */ 640 @SuppressWarnings({"unchecked", "cast"}) 641 public List<BodyDecl> getBodyDeclList() { 642 List<BodyDecl> list = (List<BodyDecl>)getChild(3); 643 list.getNumChild(); 644 return list; 645 } 646 /** 647 * Retrieves the BodyDecl list. 648 * <p><em>This method does not invoke AST transformations.</em></p> 649 * @return The node representing the BodyDecl list. 650 * @apilevel low-level 651 * @ast method 652 * 653 */ 654 @SuppressWarnings({"unchecked", "cast"}) 655 public List<BodyDecl> getBodyDeclListNoTransform() { 656 return (List<BodyDecl>)getChildNoTransform(3); 657 } 658 /** 659 * Replaces the TypeParameter list. 660 * @param list The new list node to be used as the TypeParameter list. 661 * @apilevel high-level 662 * @ast method 663 * 664 */ 665 public void setTypeParameterList(List<TypeVariable> list) { 666 setChild(list, 4); 667 } 668 /** 669 * Retrieves the number of children in the TypeParameter list. 670 * @return Number of children in the TypeParameter list. 671 * @apilevel high-level 672 * @ast method 673 * 674 */ 675 public int getNumTypeParameter() { 676 return getTypeParameterList().getNumChild(); 677 } 678 /** 679 * Retrieves the number of children in the TypeParameter list. 680 * Calling this method will not trigger rewrites.. 681 * @return Number of children in the TypeParameter list. 682 * @apilevel low-level 683 * @ast method 684 * 685 */ 686 public int getNumTypeParameterNoTransform() { 687 return getTypeParameterListNoTransform().getNumChildNoTransform(); 688 } 689 /** 690 * Retrieves the element at index {@code i} in the TypeParameter list.. 691 * @param i Index of the element to return. 692 * @return The element at position {@code i} in the TypeParameter list. 693 * @apilevel high-level 694 * @ast method 695 * 696 */ 697 @SuppressWarnings({"unchecked", "cast"}) 698 public TypeVariable getTypeParameter(int i) { 699 return (TypeVariable)getTypeParameterList().getChild(i); 700 } 701 /** 702 * Append an element to the TypeParameter list. 703 * @param node The element to append to the TypeParameter list. 704 * @apilevel high-level 705 * @ast method 706 * 707 */ 708 public void addTypeParameter(TypeVariable node) { 709 List<TypeVariable> list = (parent == null || state == null) ? getTypeParameterListNoTransform() : getTypeParameterList(); 710 list.addChild(node); 711 } 712 /** 713 * @apilevel low-level 714 * @ast method 715 * 716 */ 717 public void addTypeParameterNoTransform(TypeVariable node) { 718 List<TypeVariable> list = getTypeParameterListNoTransform(); 719 list.addChild(node); 720 } 721 /** 722 * Replaces the TypeParameter list element at index {@code i} with the new node {@code node}. 723 * @param node The new node to replace the old list element. 724 * @param i The list index of the node to be replaced. 725 * @apilevel high-level 726 * @ast method 727 * 728 */ 729 public void setTypeParameter(TypeVariable node, int i) { 730 List<TypeVariable> list = getTypeParameterList(); 731 list.setChild(node, i); 732 } 733 /** 734 * Retrieves the TypeParameter list. 735 * @return The node representing the TypeParameter list. 736 * @apilevel high-level 737 * @ast method 738 * 739 */ 740 public List<TypeVariable> getTypeParameters() { 741 return getTypeParameterList(); 742 } 743 /** 744 * Retrieves the TypeParameter list. 745 * <p><em>This method does not invoke AST transformations.</em></p> 746 * @return The node representing the TypeParameter list. 747 * @apilevel low-level 748 * @ast method 749 * 750 */ 751 public List<TypeVariable> getTypeParametersNoTransform() { 752 return getTypeParameterListNoTransform(); 753 } 754 /** 755 * Retrieves the TypeParameter list. 756 * @return The node representing the TypeParameter list. 757 * @apilevel high-level 758 * @ast method 759 * 760 */ 761 @SuppressWarnings({"unchecked", "cast"}) 762 public List<TypeVariable> getTypeParameterList() { 763 List<TypeVariable> list = (List<TypeVariable>)getChild(4); 764 list.getNumChild(); 765 return list; 766 } 767 /** 768 * Retrieves the TypeParameter list. 769 * <p><em>This method does not invoke AST transformations.</em></p> 770 * @return The node representing the TypeParameter list. 771 * @apilevel low-level 772 * @ast method 773 * 774 */ 775 @SuppressWarnings({"unchecked", "cast"}) 776 public List<TypeVariable> getTypeParameterListNoTransform() { 777 return (List<TypeVariable>)getChildNoTransform(4); 778 } 779 /** 780 * @apilevel internal 781 */ 782 protected boolean rawType_computed = false; 783 /** 784 * @apilevel internal 785 */ 786 protected TypeDecl rawType_value; 787 /** 788 * @attribute syn 789 * @aspect Generics 790 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:176 791 */ 792 @SuppressWarnings({"unchecked", "cast"}) 793 public TypeDecl rawType() { 794 if(rawType_computed) { 795 return rawType_value; 796 } 797 ASTNode$State state = state(); 798 int num = state.boundariesCrossed; 799 boolean isFinal = this.is$Final(); 800 rawType_value = rawType_compute(); 801 if(isFinal && num == state().boundariesCrossed){ rawType_computed = true; } 802 return rawType_value; 803 } 804 /** 805 * @apilevel internal 806 */ 807 private TypeDecl rawType_compute() { return lookupParTypeDecl(new ArrayList()); } 808 /** 809 * @apilevel internal 810 */ 811 protected java.util.Map lookupParTypeDecl_ArrayList_values; 812 /** 813 * @apilevel internal 814 */ 815 protected List lookupParTypeDecl_ArrayList_list; 816 /** 817 * @attribute syn 818 * @aspect LookupParTypeDecl 819 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:715 820 */ 821 @SuppressWarnings({"unchecked", "cast"}) 822 public TypeDecl lookupParTypeDecl(ArrayList list) { 823 Object _parameters = list; 824 if(lookupParTypeDecl_ArrayList_values == null) lookupParTypeDecl_ArrayList_values = new java.util.HashMap(4); 825 if(lookupParTypeDecl_ArrayList_values.containsKey(_parameters)) { 826 return (TypeDecl)lookupParTypeDecl_ArrayList_values.get(_parameters); 827 } 828 ASTNode$State state = state(); 829 int num = state.boundariesCrossed; 830 boolean isFinal = this.is$Final(); 831 TypeDecl lookupParTypeDecl_ArrayList_value = lookupParTypeDecl_compute(list); 832 if(lookupParTypeDecl_ArrayList_list == null) { 833 lookupParTypeDecl_ArrayList_list = new List(); 834 lookupParTypeDecl_ArrayList_list.is$Final = true; 835 lookupParTypeDecl_ArrayList_list.setParent(this); 836 } 837 lookupParTypeDecl_ArrayList_list.add(lookupParTypeDecl_ArrayList_value); 838 if(lookupParTypeDecl_ArrayList_value != null) { 839 lookupParTypeDecl_ArrayList_value = (TypeDecl)lookupParTypeDecl_ArrayList_list.getChild(lookupParTypeDecl_ArrayList_list.numChildren-1); 840 lookupParTypeDecl_ArrayList_value.is$Final = true; 841 } 842 if(true){ lookupParTypeDecl_ArrayList_values.put(_parameters, lookupParTypeDecl_ArrayList_value); } 843 return lookupParTypeDecl_ArrayList_value; 844 } 845 /** 846 * @apilevel internal 847 */ 848 private TypeDecl lookupParTypeDecl_compute(ArrayList list) { 849 /* 850 int size = createParTypeDeclStub_ArrayList_list != null ? createParTypeDeclStub_ArrayList_list.numChildren : 0; 851 ParClassDecl typeDecl = (ParClassDecl)createParTypeDeclStub(list); 852 if (size < createParTypeDeclStub_ArrayList_list.numChildren) { 853 createParTypeDeclBody(list, typeDecl); 854 } 855 return typeDecl; 856 */ 857 858 ParClassDecl typeDecl = list.size() == 0 ? new RawClassDecl() : new ParClassDecl(); 859 typeDecl.setModifiers((Modifiers)getModifiers().fullCopy()); 860 typeDecl.setID(getID()); 861 // ES: trying to only so this for ParClassDecl and then later for RawClassDecl 862 if (!(typeDecl instanceof RawClassDecl)) 863 typeDecl.setArgumentList(createArgumentList(list)); 864 return typeDecl; 865 866 } 867 /** 868 * @apilevel internal 869 */ 870 protected int usesTypeVariable_visited = -1; 871 /** 872 * @apilevel internal 873 */ 874 protected boolean usesTypeVariable_computed = false; 875 /** 876 * @apilevel internal 877 */ 878 protected boolean usesTypeVariable_initialized = false; 879 /** 880 * @apilevel internal 881 */ 882 protected boolean usesTypeVariable_value; 883 /** 884 * @attribute syn 885 * @aspect LookupParTypeDecl 886 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1077 887 */ 888 @SuppressWarnings({"unchecked", "cast"}) 889 public boolean usesTypeVariable() { 890 if(usesTypeVariable_computed) { 891 return usesTypeVariable_value; 892 } 893 ASTNode$State state = state(); 894 if (!usesTypeVariable_initialized) { 895 usesTypeVariable_initialized = true; 896 usesTypeVariable_value = false; 897 } 898 if (!state.IN_CIRCLE) { 899 state.IN_CIRCLE = true; 900 int num = state.boundariesCrossed; 901 boolean isFinal = this.is$Final(); 902 do { 903 usesTypeVariable_visited = state.CIRCLE_INDEX; 904 state.CHANGE = false; 905 boolean new_usesTypeVariable_value = usesTypeVariable_compute(); 906 if (new_usesTypeVariable_value!=usesTypeVariable_value) 907 state.CHANGE = true; 908 usesTypeVariable_value = new_usesTypeVariable_value; 909 state.CIRCLE_INDEX++; 910 } while (state.CHANGE); 911 if(isFinal && num == state().boundariesCrossed) { 912 usesTypeVariable_computed = true; 913 } 914 else { 915 state.RESET_CYCLE = true; 916 usesTypeVariable_compute(); 917 state.RESET_CYCLE = false; 918 usesTypeVariable_computed = false; 919 usesTypeVariable_initialized = false; 920 } 921 state.IN_CIRCLE = false; 922 return usesTypeVariable_value; 923 } 924 if(usesTypeVariable_visited != state.CIRCLE_INDEX) { 925 usesTypeVariable_visited = state.CIRCLE_INDEX; 926 if (state.RESET_CYCLE) { 927 usesTypeVariable_computed = false; 928 usesTypeVariable_initialized = false; 929 usesTypeVariable_visited = -1; 930 return usesTypeVariable_value; 931 } 932 boolean new_usesTypeVariable_value = usesTypeVariable_compute(); 933 if (new_usesTypeVariable_value!=usesTypeVariable_value) 934 state.CHANGE = true; 935 usesTypeVariable_value = new_usesTypeVariable_value; 936 return usesTypeVariable_value; 937 } 938 return usesTypeVariable_value; 939 } 940 /** 941 * @apilevel internal 942 */ 943 private boolean usesTypeVariable_compute() { return true; } 944 protected java.util.Map subtype_TypeDecl_values; 945 /** 946 * @attribute syn 947 * @aspect GenericsSubtype 948 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:13 949 */ 950 @SuppressWarnings({"unchecked", "cast"}) 951 public boolean subtype(TypeDecl type) { 952 Object _parameters = type; 953 if(subtype_TypeDecl_values == null) subtype_TypeDecl_values = new java.util.HashMap(4); 954 ASTNode$State.CircularValue _value; 955 if(subtype_TypeDecl_values.containsKey(_parameters)) { 956 Object _o = subtype_TypeDecl_values.get(_parameters); 957 if(!(_o instanceof ASTNode$State.CircularValue)) { 958 return ((Boolean)_o).booleanValue(); 959 } 960 else 961 _value = (ASTNode$State.CircularValue)_o; 962 } 963 else { 964 _value = new ASTNode$State.CircularValue(); 965 subtype_TypeDecl_values.put(_parameters, _value); 966 _value.value = Boolean.valueOf(true); 967 } 968 ASTNode$State state = state(); 969 if (!state.IN_CIRCLE) { 970 state.IN_CIRCLE = true; 971 int num = state.boundariesCrossed; 972 boolean isFinal = this.is$Final(); 973 boolean new_subtype_TypeDecl_value; 974 do { 975 _value.visited = new Integer(state.CIRCLE_INDEX); 976 state.CHANGE = false; 977 new_subtype_TypeDecl_value = subtype_compute(type); 978 if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 979 state.CHANGE = true; 980 _value.value = Boolean.valueOf(new_subtype_TypeDecl_value); 981 } 982 state.CIRCLE_INDEX++; 983 } while (state.CHANGE); 984 if(isFinal && num == state().boundariesCrossed) { 985 subtype_TypeDecl_values.put(_parameters, new_subtype_TypeDecl_value); 986 } 987 else { 988 subtype_TypeDecl_values.remove(_parameters); 989 state.RESET_CYCLE = true; 990 subtype_compute(type); 991 state.RESET_CYCLE = false; 992 } 993 state.IN_CIRCLE = false; 994 return new_subtype_TypeDecl_value; 995 } 996 if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) { 997 _value.visited = new Integer(state.CIRCLE_INDEX); 998 boolean new_subtype_TypeDecl_value = subtype_compute(type); 999 if (state.RESET_CYCLE) { 1000 subtype_TypeDecl_values.remove(_parameters); 1001 } 1002 else if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 1003 state.CHANGE = true; 1004 _value.value = new_subtype_TypeDecl_value; 1005 } 1006 return new_subtype_TypeDecl_value; 1007 } 1008 return ((Boolean)_value.value).booleanValue(); 1009 } 1010 /** 1011 * @apilevel internal 1012 */ 1013 private boolean subtype_compute(TypeDecl type) { return type.supertypeGenericClassDecl(this); } 1014 /** 1015 * @attribute syn 1016 * @aspect GenericsSubtype 1017 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:125 1018 */ 1019 public boolean supertypeParClassDecl(ParClassDecl type) { 1020 ASTNode$State state = state(); 1021 try { return type.genericDecl().original().subtype(this); } 1022 finally { 1023 } 1024 } 1025 /** 1026 * @attribute syn 1027 * @aspect GenericsSubtype 1028 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:129 1029 */ 1030 public boolean supertypeParInterfaceDecl(ParInterfaceDecl type) { 1031 ASTNode$State state = state(); 1032 try { return type.genericDecl().original().subtype(this); } 1033 finally { 1034 } 1035 } 1036 protected java.util.Map instanceOf_TypeDecl_values; 1037 /** 1038 * @attribute syn 1039 * @aspect GenericsSubtype 1040 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:394 1041 */ 1042 @SuppressWarnings({"unchecked", "cast"}) 1043 public boolean instanceOf(TypeDecl type) { 1044 Object _parameters = type; 1045 if(instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new java.util.HashMap(4); 1046 if(instanceOf_TypeDecl_values.containsKey(_parameters)) { 1047 return ((Boolean)instanceOf_TypeDecl_values.get(_parameters)).booleanValue(); 1048 } 1049 ASTNode$State state = state(); 1050 int num = state.boundariesCrossed; 1051 boolean isFinal = this.is$Final(); 1052 boolean instanceOf_TypeDecl_value = instanceOf_compute(type); 1053 if(isFinal && num == state().boundariesCrossed){ instanceOf_TypeDecl_values.put(_parameters, Boolean.valueOf(instanceOf_TypeDecl_value)); } 1054 return instanceOf_TypeDecl_value; 1055 } 1056 /** 1057 * @apilevel internal 1058 */ 1059 private boolean instanceOf_compute(TypeDecl type) { return subtype(type); } 1060 /** 1061 * @apilevel internal 1062 */ 1063 protected boolean constantPoolName_computed = false; 1064 /** 1065 * @apilevel internal 1066 */ 1067 protected String constantPoolName_value; 1068 /** 1069 * @attribute syn 1070 * @aspect GenericsCodegen 1071 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:175 1072 */ 1073 @SuppressWarnings({"unchecked", "cast"}) 1074 public String constantPoolName() { 1075 if(constantPoolName_computed) { 1076 return constantPoolName_value; 1077 } 1078 ASTNode$State state = state(); 1079 int num = state.boundariesCrossed; 1080 boolean isFinal = this.is$Final(); 1081 constantPoolName_value = constantPoolName_compute(); 1082 if(isFinal && num == state().boundariesCrossed){ constantPoolName_computed = true; } 1083 return constantPoolName_value; 1084 } 1085 /** 1086 * @apilevel internal 1087 */ 1088 private String constantPoolName_compute() { 1089 if(!isNestedType()) { 1090 String packageName = packageName(); 1091 if(!packageName.equals("")) { 1092 packageName = packageName.replace('.', '/') + "/"; 1093 } 1094 return packageName + getID(); 1095 } 1096 else { 1097 String prefix = enclosingType().constantPoolName(); 1098 if(isAnonymous()) { 1099 return prefix + "$" + uniqueIndex(); 1100 } 1101 else if(isLocalClass()) { 1102 return prefix + "$" + uniqueIndex() + getID(); 1103 } 1104 return prefix + "$" + getID(); 1105 } 1106 } 1107 /** 1108 * @apilevel internal 1109 */ 1110 protected boolean needsSignatureAttribute_computed = false; 1111 /** 1112 * @apilevel internal 1113 */ 1114 protected boolean needsSignatureAttribute_value; 1115 /** 1116 * @attribute syn 1117 * @aspect GenericsCodegen 1118 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:340 1119 */ 1120 @SuppressWarnings({"unchecked", "cast"}) 1121 public boolean needsSignatureAttribute() { 1122 if(needsSignatureAttribute_computed) { 1123 return needsSignatureAttribute_value; 1124 } 1125 ASTNode$State state = state(); 1126 int num = state.boundariesCrossed; 1127 boolean isFinal = this.is$Final(); 1128 needsSignatureAttribute_value = needsSignatureAttribute_compute(); 1129 if(isFinal && num == state().boundariesCrossed){ needsSignatureAttribute_computed = true; } 1130 return needsSignatureAttribute_value; 1131 } 1132 /** 1133 * @apilevel internal 1134 */ 1135 private boolean needsSignatureAttribute_compute() { return true; } 1136 /** 1137 * @apilevel internal 1138 */ 1139 protected boolean classSignature_computed = false; 1140 /** 1141 * @apilevel internal 1142 */ 1143 protected String classSignature_value; 1144 /** 1145 * @attribute syn 1146 * @aspect GenericsCodegen 1147 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:404 1148 */ 1149 @SuppressWarnings({"unchecked", "cast"}) 1150 public String classSignature() { 1151 if(classSignature_computed) { 1152 return classSignature_value; 1153 } 1154 ASTNode$State state = state(); 1155 int num = state.boundariesCrossed; 1156 boolean isFinal = this.is$Final(); 1157 classSignature_value = classSignature_compute(); 1158 if(isFinal && num == state().boundariesCrossed){ classSignature_computed = true; } 1159 return classSignature_value; 1160 } 1161 /** 1162 * @apilevel internal 1163 */ 1164 private String classSignature_compute() { 1165 StringBuffer buf = new StringBuffer(); 1166 // FormalTypeParameters 1167 buf.append("<"); 1168 for(int i = 0; i < getNumTypeParameter(); i++) 1169 buf.append(getTypeParameter(i).formalTypeParameter()); 1170 buf.append(">"); 1171 buf.append(super.classSignature()); 1172 return buf.toString(); 1173 } 1174 /** 1175 * @apilevel internal 1176 */ 1177 protected boolean getPlaceholderMethodList_computed = false; 1178 /** 1179 * @apilevel internal 1180 */ 1181 protected List<PlaceholderMethodDecl> getPlaceholderMethodList_value; 1182 /** 1183 * The placeholder method list for the constructors of this generic 1184 * class. 1185 * 1186 * @return list of placeholder methods 1187 * @attribute syn 1188 * @aspect TypeInference 1189 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/TypeInference.jrag:124 1190 */ 1191 @SuppressWarnings({"unchecked", "cast"}) 1192 public List<PlaceholderMethodDecl> getPlaceholderMethodList() { 1193 if(getPlaceholderMethodList_computed) { 1194 return getPlaceholderMethodList_value; 1195 } 1196 ASTNode$State state = state(); 1197 int num = state.boundariesCrossed; 1198 boolean isFinal = this.is$Final(); 1199 getPlaceholderMethodList_value = getPlaceholderMethodList_compute(); 1200 getPlaceholderMethodList_value.setParent(this); 1201 getPlaceholderMethodList_value.is$Final = true; 1202 if(true){ getPlaceholderMethodList_computed = true; } 1203 return getPlaceholderMethodList_value; 1204 } 1205 /** 1206 * @apilevel internal 1207 */ 1208 private List<PlaceholderMethodDecl> getPlaceholderMethodList_compute() { 1209 List<PlaceholderMethodDecl> placeholderMethods = 1210 new List<PlaceholderMethodDecl>(); 1211 List<TypeVariable> typeParams = getTypeParameterList(); 1212 List<TypeVariable> classTypeVars = new List<TypeVariable>(); 1213 List<Access> typeArgs = new List<Access>(); 1214 1215 // copy the list of type parameters 1216 int arg = 0; 1217 for (Iterator iter = typeParams.iterator(); iter.hasNext(); ++arg) { 1218 String substName = "#"+arg; 1219 typeArgs.add(new TypeAccess(substName)); 1220 1221 TypeVariable typeVar = (TypeVariable) iter.next(); 1222 List<Access> typeBounds = new List<Access>(); 1223 for (Access typeBound : typeVar.getTypeBoundList()) 1224 typeBounds.add((Access) typeBound.cloneSubtree()); 1225 classTypeVars.add( 1226 new TypeVariable( 1227 new Modifiers(), 1228 substName, 1229 new List<BodyDecl>(), 1230 typeBounds)); 1231 } 1232 1233 ParTypeAccess returnType = new ParTypeAccess( 1234 createQualifiedAccess(), 1235 typeArgs); 1236 1237 for (Iterator iter = constructors().iterator(); iter.hasNext(); ) { 1238 ConstructorDecl decl = (ConstructorDecl)iter.next(); 1239 if (decl instanceof ConstructorDeclSubstituted) 1240 decl = ((ConstructorDeclSubstituted) decl).getOriginal(); 1241 1242 // filter accessible constructors 1243 if (!decl.accessibleFrom(hostType())) 1244 continue; 1245 1246 Collection<TypeVariable> originalTypeVars = 1247 new LinkedList<TypeVariable>(); 1248 List<TypeVariable> typeVars = new List<TypeVariable>(); 1249 for (TypeVariable typeVar : typeParams) 1250 originalTypeVars.add(typeVar); 1251 for (TypeVariable typeVar : classTypeVars) 1252 typeVars.add((TypeVariable) typeVar.cloneSubtree()); 1253 1254 if (decl instanceof GenericConstructorDecl) { 1255 GenericConstructorDecl genericDecl = 1256 (GenericConstructorDecl) decl; 1257 List<TypeVariable> typeVariables = new List<TypeVariable>(); 1258 for (int i = 0; i < genericDecl.getNumTypeParameter(); ++i) { 1259 String substName = "#" + (arg+i); 1260 1261 TypeVariable typeVar = genericDecl.getTypeParameter(i); 1262 originalTypeVars.add(typeVar); 1263 List<Access> typeBounds = new List<Access>(); 1264 for (Access typeBound : typeVar.getTypeBoundList()) 1265 typeBounds.add((Access) typeBound.cloneSubtree()); 1266 typeVars.add( 1267 new TypeVariable( 1268 new Modifiers(), 1269 substName, 1270 new List<BodyDecl>(), 1271 typeBounds)); 1272 } 1273 } 1274 1275 List<ParameterDeclaration> substParameters = 1276 new List<ParameterDeclaration>(); 1277 for (ParameterDeclaration param : decl.getParameterList()) { 1278 substParameters.add(param.substituted( 1279 originalTypeVars, typeVars)); 1280 } 1281 1282 List<Access> substExceptions = new List<Access>(); 1283 for (Access exception : decl.getExceptionList()) { 1284 substExceptions.add(exception.substituted( 1285 originalTypeVars, typeVars)); 1286 } 1287 1288 PlaceholderMethodDecl placeholderMethod = 1289 new PlaceholderMethodDecl( 1290 (Modifiers) decl.getModifiers().cloneSubtree(), 1291 (Access) returnType.cloneSubtree(), 1292 "#"+getID(), 1293 substParameters, 1294 substExceptions, 1295 new Opt(new Block()), 1296 typeVars); 1297 1298 placeholderMethods.add(placeholderMethod); 1299 } 1300 return placeholderMethods; 1301 } 1302 /** 1303 * @attribute syn 1304 * @aspect Generics 1305 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:158 1306 */ 1307 public boolean isGenericType() { 1308 ASTNode$State state = state(); 1309 try { return true; } 1310 finally { 1311 } 1312 } 1313 protected java.util.Map lookupParTypeDecl_ParTypeAccess_values; 1314 /** 1315 * @attribute syn 1316 * @aspect LookupParTypeDecl 1317 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:708 1318 */ 1319 @SuppressWarnings({"unchecked", "cast"}) 1320 public TypeDecl lookupParTypeDecl(ParTypeAccess p) { 1321 Object _parameters = p; 1322 if(lookupParTypeDecl_ParTypeAccess_values == null) lookupParTypeDecl_ParTypeAccess_values = new java.util.HashMap(4); 1323 if(lookupParTypeDecl_ParTypeAccess_values.containsKey(_parameters)) { 1324 return (TypeDecl)lookupParTypeDecl_ParTypeAccess_values.get(_parameters); 1325 } 1326 ASTNode$State state = state(); 1327 int num = state.boundariesCrossed; 1328 boolean isFinal = this.is$Final(); 1329 TypeDecl lookupParTypeDecl_ParTypeAccess_value = lookupParTypeDecl_compute(p); 1330 if(isFinal && num == state().boundariesCrossed){ lookupParTypeDecl_ParTypeAccess_values.put(_parameters, lookupParTypeDecl_ParTypeAccess_value); } 1331 return lookupParTypeDecl_ParTypeAccess_value; 1332 } 1333 /** 1334 * @apilevel internal 1335 */ 1336 private TypeDecl lookupParTypeDecl_compute(ParTypeAccess p) { 1337 ArrayList typeArguments = new ArrayList(); 1338 for(int i = 0; i < p.getNumTypeArgument(); i++) 1339 typeArguments.add(p.getTypeArgument(i).type()); 1340 return lookupParTypeDecl(typeArguments); 1341 } 1342 /** 1343 * @attribute inh 1344 * @aspect GenericsTypeCheck 1345 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:435 1346 */ 1347 @SuppressWarnings({"unchecked", "cast"}) 1348 public TypeDecl typeThrowable() { 1349 ASTNode$State state = state(); 1350 TypeDecl typeThrowable_value = getParent().Define_TypeDecl_typeThrowable(this, null); 1351 return typeThrowable_value; 1352 } 1353 /** 1354 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:481 1355 * @apilevel internal 1356 */ 1357 public boolean Define_boolean_isNestedType(ASTNode caller, ASTNode child) { 1358 if(caller == getTypeParameterListNoTransform()) { 1359 int childIndex = caller.getIndexOfChild(child); 1360 return true; 1361 } 1362 else { return super.Define_boolean_isNestedType(caller, child); 1363 } 1364 } 1365 /** 1366 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:482 1367 * @apilevel internal 1368 */ 1369 public TypeDecl Define_TypeDecl_enclosingType(ASTNode caller, ASTNode child) { 1370 if(caller == getTypeParameterListNoTransform()) { 1371 int childIndex = caller.getIndexOfChild(child); 1372 return this; 1373 } 1374 else { return super.Define_TypeDecl_enclosingType(caller, child); 1375 } 1376 } 1377 /** 1378 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:531 1379 * @apilevel internal 1380 */ 1381 public SimpleSet Define_SimpleSet_lookupType(ASTNode caller, ASTNode child, String name) { 1382 if(caller == getBodyDeclListNoTransform()) { 1383 int index = caller.getIndexOfChild(child); 1384 { 1385 SimpleSet c = memberTypes(name); 1386 if(getBodyDecl(index).visibleTypeParameters()) 1387 c = addTypeVariables(c, name); 1388 if(!c.isEmpty()) 1389 return c; 1390 // 8.5.2 1391 if(isClassDecl() && isStatic() && !isTopLevelType()) { 1392 for(Iterator iter = lookupType(name).iterator(); iter.hasNext(); ) { 1393 TypeDecl d = (TypeDecl)iter.next(); 1394 if(d.isStatic() || (d.enclosingType() != null && instanceOf(d.enclosingType()))) { 1395 c = c.add(d); 1396 } 1397 } 1398 } 1399 else 1400 c = lookupType(name); 1401 if(!c.isEmpty()) 1402 return c; 1403 return topLevelType().lookupType(name); // Fix to search imports 1404 // include type parameters if not static 1405 } 1406 } 1407 else if(caller == getTypeParameterListNoTransform()) { 1408 int childIndex = caller.getIndexOfChild(child); 1409 { 1410 SimpleSet c = memberTypes(name); 1411 c = addTypeVariables(c, name); 1412 if(!c.isEmpty()) return c; 1413 // 8.5.2 1414 if(isClassDecl() && isStatic() && !isTopLevelType()) { 1415 for(Iterator iter = lookupType(name).iterator(); iter.hasNext(); ) { 1416 TypeDecl d = (TypeDecl)iter.next(); 1417 if(d.isStatic() || (d.enclosingType() != null && instanceOf(d.enclosingType()))) { 1418 c = c.add(d); 1419 } 1420 } 1421 } 1422 else 1423 c = lookupType(name); 1424 if(!c.isEmpty()) 1425 return c; 1426 return topLevelType().lookupType(name); // Fix to search imports 1427 } 1428 } 1429 else if(caller == getImplementsListNoTransform()) { 1430 int childIndex = caller.getIndexOfChild(child); 1431 { 1432 SimpleSet c = addTypeVariables(SimpleSet.emptySet, name); 1433 return !c.isEmpty() ? c : lookupType(name); 1434 } 1435 } 1436 else if(caller == getSuperClassAccessOptNoTransform()){ 1437 SimpleSet c = addTypeVariables(SimpleSet.emptySet, name); 1438 return !c.isEmpty() ? c : lookupType(name); 1439 } 1440 else { return super.Define_SimpleSet_lookupType(caller, child, name); 1441 } 1442 } 1443 /** 1444 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsParTypeDecl.jrag:50 1445 * @apilevel internal 1446 */ 1447 public TypeDecl Define_TypeDecl_genericDecl(ASTNode caller, ASTNode child) { 1448 { 1449 int childIndex = this.getIndexOfChild(caller); 1450 return this; 1451 } 1452 } 1453 /** 1454 * @apilevel internal 1455 */ 1456 public ASTNode rewriteTo() { 1457 return super.rewriteTo(); 1458 } 1459 }