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