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:41 027 * @production ClassDeclSubstituted : {@link ClassDecl} ::= <span class="component"><Original:TypeDecl></span> <span class="component">{@link BodyDecl}*</span>; 028 029 */ 030 public class ClassDeclSubstituted extends ClassDecl implements Cloneable, MemberSubstitutor { 031 /** 032 * @declaredat ASTNode:1 033 */ 034 public ClassDeclSubstituted() { 035 super(); 036 } 037 /** 038 * Initializes the child array to the correct size. 039 * Initializes List and Opt nta children. 040 * @apilevel internal 041 * @ast method 042 * @declaredat ASTNode:10 043 */ 044 public void init$Children() { 045 children = new ASTNode[5]; 046 setChild(new Opt(), 1); 047 setChild(new List(), 2); 048 setChild(new Opt(), 3); 049 setChild(new List(), 4); 050 } 051 /** 052 * @declaredat ASTNode:17 053 */ 054 public ClassDeclSubstituted(Modifiers p0, String p1, Opt<Access> p2, List<Access> p3, TypeDecl p4) { 055 setChild(p0, 0); 056 setID(p1); 057 setChild(p2, 1); 058 setChild(p3, 2); 059 setOriginal(p4); 060 } 061 /** 062 * @declaredat ASTNode:24 063 */ 064 public ClassDeclSubstituted(Modifiers p0, beaver.Symbol p1, Opt<Access> p2, List<Access> p3, TypeDecl p4) { 065 setChild(p0, 0); 066 setID(p1); 067 setChild(p2, 1); 068 setChild(p3, 2); 069 setOriginal(p4); 070 } 071 /** 072 * @apilevel low-level 073 * @declaredat ASTNode:34 074 */ 075 protected int numChildren() { 076 return 3; 077 } 078 /** 079 * @apilevel internal 080 * @declaredat ASTNode:40 081 */ 082 public boolean mayHaveRewrite() { 083 return false; 084 } 085 /** 086 * @apilevel internal 087 * @declaredat ASTNode:46 088 */ 089 public void flushAttrCache() { 090 super.flushAttrCache(); 091 getBodyDeclList_reset(); 092 sourceTypeDecl_reset(); 093 instanceOf_TypeDecl_reset(); 094 subtype_TypeDecl_reset(); 095 typeDescriptor_reset(); 096 constantPoolName_reset(); 097 uniqueIndex_reset(); 098 strictSubtype_TypeDecl_reset(); 099 localMethodsSignatureMap_reset(); 100 localFields_String_reset(); 101 localTypeDecls_String_reset(); 102 constructors_reset(); 103 } 104 /** 105 * @apilevel internal 106 * @declaredat ASTNode:64 107 */ 108 public void flushCollectionCache() { 109 super.flushCollectionCache(); 110 } 111 /** 112 * @apilevel internal 113 * @declaredat ASTNode:70 114 */ 115 public void flushRewriteCache() { 116 super.flushRewriteCache(); 117 } 118 /** 119 * @apilevel internal 120 * @declaredat ASTNode:76 121 */ 122 public ClassDeclSubstituted clone() throws CloneNotSupportedException { 123 ClassDeclSubstituted node = (ClassDeclSubstituted) super.clone(); 124 return node; 125 } 126 /** 127 * @apilevel internal 128 * @declaredat ASTNode:83 129 */ 130 public ClassDeclSubstituted copy() { 131 try { 132 ClassDeclSubstituted node = (ClassDeclSubstituted) clone(); 133 node.parent = null; 134 if (children != null) { 135 node.children = (ASTNode[]) children.clone(); 136 } 137 return node; 138 } catch (CloneNotSupportedException e) { 139 throw new Error("Error: clone not supported for " + getClass().getName()); 140 } 141 } 142 /** 143 * Create a deep copy of the AST subtree at this node. 144 * The copy is dangling, i.e. has no parent. 145 * @return dangling copy of the subtree at this node 146 * @apilevel low-level 147 * @deprecated Please use treeCopy or treeCopyNoTransform instead 148 * @declaredat ASTNode:102 149 */ 150 @Deprecated 151 public ClassDeclSubstituted fullCopy() { 152 return treeCopyNoTransform(); 153 } 154 /** 155 * Create a deep copy of the AST subtree at this node. 156 * The copy is dangling, i.e. has no parent. 157 * @return dangling copy of the subtree at this node 158 * @apilevel low-level 159 * @declaredat ASTNode:112 160 */ 161 public ClassDeclSubstituted treeCopyNoTransform() { 162 ClassDeclSubstituted tree = (ClassDeclSubstituted) copy(); 163 if (children != null) { 164 for (int i = 0; i < children.length; ++i) { 165 switch (i) { 166 case 3: 167 tree.children[i] = new Opt(); 168 continue; 169 case 4: 170 tree.children[i] = new List(); 171 continue; 172 } 173 ASTNode child = (ASTNode) children[i]; 174 if (child != null) { 175 child = child.treeCopyNoTransform(); 176 tree.setChild(child, i); 177 } 178 } 179 } 180 return tree; 181 } 182 /** 183 * Create a deep copy of the AST subtree at this node. 184 * The subtree of this node is traversed to trigger rewrites before copy. 185 * The copy is dangling, i.e. has no parent. 186 * @return dangling copy of the subtree at this node 187 * @apilevel low-level 188 * @declaredat ASTNode:140 189 */ 190 public ClassDeclSubstituted treeCopy() { 191 doFullTraversal(); 192 return treeCopyNoTransform(); 193 } 194 /** 195 * @apilevel internal 196 * @declaredat ASTNode:147 197 */ 198 protected boolean is$Equal(ASTNode node) { 199 return super.is$Equal(node) && (tokenString_ID == ((ClassDeclSubstituted)node).tokenString_ID) && (tokenTypeDecl_Original == ((ClassDeclSubstituted)node).tokenTypeDecl_Original); 200 } 201 /** 202 * Replaces the Modifiers child. 203 * @param node The new node to replace the Modifiers child. 204 * @apilevel high-level 205 */ 206 public void setModifiers(Modifiers node) { 207 setChild(node, 0); 208 } 209 /** 210 * Retrieves the Modifiers child. 211 * @return The current node used as the Modifiers child. 212 * @apilevel high-level 213 */ 214 @ASTNodeAnnotation.Child(name="Modifiers") 215 public Modifiers getModifiers() { 216 return (Modifiers) getChild(0); 217 } 218 /** 219 * Retrieves the Modifiers child. 220 * <p><em>This method does not invoke AST transformations.</em></p> 221 * @return The current node used as the Modifiers child. 222 * @apilevel low-level 223 */ 224 public Modifiers getModifiersNoTransform() { 225 return (Modifiers) getChildNoTransform(0); 226 } 227 /** 228 * Replaces the lexeme ID. 229 * @param value The new value for the lexeme ID. 230 * @apilevel high-level 231 */ 232 public void setID(String value) { 233 tokenString_ID = value; 234 } 235 /** 236 * JastAdd-internal setter for lexeme ID using the Beaver parser. 237 * @param symbol Symbol containing the new value for the lexeme ID 238 * @apilevel internal 239 */ 240 public void setID(beaver.Symbol symbol) { 241 if (symbol.value != null && !(symbol.value instanceof String)) 242 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 243 tokenString_ID = (String)symbol.value; 244 IDstart = symbol.getStart(); 245 IDend = symbol.getEnd(); 246 } 247 /** 248 * Retrieves the value for the lexeme ID. 249 * @return The value for the lexeme ID. 250 * @apilevel high-level 251 */ 252 @ASTNodeAnnotation.Token(name="ID") 253 public String getID() { 254 return tokenString_ID != null ? tokenString_ID : ""; 255 } 256 /** 257 * Replaces the optional node for the SuperClass child. This is the <code>Opt</code> 258 * node containing the child SuperClass, not the actual child! 259 * @param opt The new node to be used as the optional node for the SuperClass child. 260 * @apilevel low-level 261 */ 262 public void setSuperClassOpt(Opt<Access> opt) { 263 setChild(opt, 1); 264 } 265 /** 266 * Replaces the (optional) SuperClass child. 267 * @param node The new node to be used as the SuperClass child. 268 * @apilevel high-level 269 */ 270 public void setSuperClass(Access node) { 271 getSuperClassOpt().setChild(node, 0); 272 } 273 /** 274 * Check whether the optional SuperClass child exists. 275 * @return {@code true} if the optional SuperClass child exists, {@code false} if it does not. 276 * @apilevel high-level 277 */ 278 public boolean hasSuperClass() { 279 return getSuperClassOpt().getNumChild() != 0; 280 } 281 /** 282 * Retrieves the (optional) SuperClass child. 283 * @return The SuperClass child, if it exists. Returns {@code null} otherwise. 284 * @apilevel low-level 285 */ 286 public Access getSuperClass() { 287 return (Access) getSuperClassOpt().getChild(0); 288 } 289 /** 290 * Retrieves the optional node for the SuperClass child. This is the <code>Opt</code> node containing the child SuperClass, not the actual child! 291 * @return The optional node for child the SuperClass child. 292 * @apilevel low-level 293 */ 294 @ASTNodeAnnotation.OptChild(name="SuperClass") 295 public Opt<Access> getSuperClassOpt() { 296 return (Opt<Access>) getChild(1); 297 } 298 /** 299 * Retrieves the optional node for child SuperClass. This is the <code>Opt</code> node containing the child SuperClass, not the actual child! 300 * <p><em>This method does not invoke AST transformations.</em></p> 301 * @return The optional node for child SuperClass. 302 * @apilevel low-level 303 */ 304 public Opt<Access> getSuperClassOptNoTransform() { 305 return (Opt<Access>) getChildNoTransform(1); 306 } 307 /** 308 * Replaces the Implements list. 309 * @param list The new list node to be used as the Implements list. 310 * @apilevel high-level 311 */ 312 public void setImplementsList(List<Access> list) { 313 setChild(list, 2); 314 } 315 /** 316 * Retrieves the number of children in the Implements list. 317 * @return Number of children in the Implements list. 318 * @apilevel high-level 319 */ 320 public int getNumImplements() { 321 return getImplementsList().getNumChild(); 322 } 323 /** 324 * Retrieves the number of children in the Implements list. 325 * Calling this method will not trigger rewrites. 326 * @return Number of children in the Implements list. 327 * @apilevel low-level 328 */ 329 public int getNumImplementsNoTransform() { 330 return getImplementsListNoTransform().getNumChildNoTransform(); 331 } 332 /** 333 * Retrieves the element at index {@code i} in the Implements list. 334 * @param i Index of the element to return. 335 * @return The element at position {@code i} in the Implements list. 336 * @apilevel high-level 337 */ 338 public Access getImplements(int i) { 339 return (Access) getImplementsList().getChild(i); 340 } 341 /** 342 * Check whether the Implements list has any children. 343 * @return {@code true} if it has at least one child, {@code false} otherwise. 344 * @apilevel high-level 345 */ 346 public boolean hasImplements() { 347 return getImplementsList().getNumChild() != 0; 348 } 349 /** 350 * Append an element to the Implements list. 351 * @param node The element to append to the Implements list. 352 * @apilevel high-level 353 */ 354 public void addImplements(Access node) { 355 List<Access> list = (parent == null) ? getImplementsListNoTransform() : getImplementsList(); 356 list.addChild(node); 357 } 358 /** 359 * @apilevel low-level 360 */ 361 public void addImplementsNoTransform(Access node) { 362 List<Access> list = getImplementsListNoTransform(); 363 list.addChild(node); 364 } 365 /** 366 * Replaces the Implements list element at index {@code i} with the new node {@code node}. 367 * @param node The new node to replace the old list element. 368 * @param i The list index of the node to be replaced. 369 * @apilevel high-level 370 */ 371 public void setImplements(Access node, int i) { 372 List<Access> list = getImplementsList(); 373 list.setChild(node, i); 374 } 375 /** 376 * Retrieves the Implements list. 377 * @return The node representing the Implements list. 378 * @apilevel high-level 379 */ 380 @ASTNodeAnnotation.ListChild(name="Implements") 381 public List<Access> getImplementsList() { 382 List<Access> list = (List<Access>) getChild(2); 383 return list; 384 } 385 /** 386 * Retrieves the Implements list. 387 * <p><em>This method does not invoke AST transformations.</em></p> 388 * @return The node representing the Implements list. 389 * @apilevel low-level 390 */ 391 public List<Access> getImplementsListNoTransform() { 392 return (List<Access>) getChildNoTransform(2); 393 } 394 /** 395 * Retrieves the Implements list. 396 * @return The node representing the Implements list. 397 * @apilevel high-level 398 */ 399 public List<Access> getImplementss() { 400 return getImplementsList(); 401 } 402 /** 403 * Retrieves the Implements list. 404 * <p><em>This method does not invoke AST transformations.</em></p> 405 * @return The node representing the Implements list. 406 * @apilevel low-level 407 */ 408 public List<Access> getImplementssNoTransform() { 409 return getImplementsListNoTransform(); 410 } 411 /** 412 * Replaces the lexeme Original. 413 * @param value The new value for the lexeme Original. 414 * @apilevel high-level 415 */ 416 public void setOriginal(TypeDecl value) { 417 tokenTypeDecl_Original = value; 418 } 419 /** 420 * @apilevel internal 421 */ 422 protected TypeDecl tokenTypeDecl_Original; 423 /** 424 * Retrieves the value for the lexeme Original. 425 * @return The value for the lexeme Original. 426 * @apilevel high-level 427 */ 428 @ASTNodeAnnotation.Token(name="Original") 429 public TypeDecl getOriginal() { 430 return tokenTypeDecl_Original; 431 } 432 /** 433 * Replaces the (optional) ImplicitConstructor child. 434 * @param node The new node to be used as the ImplicitConstructor child. 435 * @apilevel high-level 436 */ 437 public void setImplicitConstructor(ConstructorDecl node) { 438 getImplicitConstructorOpt().setChild(node, 0); 439 } 440 /** 441 * Check whether the optional ImplicitConstructor child exists. 442 * @return {@code true} if the optional ImplicitConstructor child exists, {@code false} if it does not. 443 * @apilevel high-level 444 */ 445 public boolean hasImplicitConstructor() { 446 return getImplicitConstructorOpt().getNumChild() != 0; 447 } 448 /** 449 * Retrieves the (optional) ImplicitConstructor child. 450 * @return The ImplicitConstructor child, if it exists. Returns {@code null} otherwise. 451 * @apilevel low-level 452 */ 453 public ConstructorDecl getImplicitConstructor() { 454 return (ConstructorDecl) getImplicitConstructorOpt().getChild(0); 455 } 456 /** 457 * Retrieves the optional node for child ImplicitConstructor. This is the <code>Opt</code> node containing the child ImplicitConstructor, not the actual child! 458 * <p><em>This method does not invoke AST transformations.</em></p> 459 * @return The optional node for child ImplicitConstructor. 460 * @apilevel low-level 461 */ 462 public Opt<ConstructorDecl> getImplicitConstructorOptNoTransform() { 463 return (Opt<ConstructorDecl>) getChildNoTransform(3); 464 } 465 /** 466 * Retrieves the child position of the optional child ImplicitConstructor. 467 * @return The the child position of the optional child ImplicitConstructor. 468 * @apilevel low-level 469 */ 470 protected int getImplicitConstructorOptChildPosition() { 471 return 3; 472 } 473 /** 474 * This method should not be called. This method throws an exception due to 475 * the corresponding child being an NTA shadowing a non-NTA child. 476 * @param node 477 * @apilevel internal 478 */ 479 public void setBodyDeclList(List<BodyDecl> node) { 480 throw new Error("Can not replace NTA child BodyDeclList in ClassDeclSubstituted!"); 481 } 482 /** 483 * Retrieves the number of children in the BodyDecl list. 484 * @return Number of children in the BodyDecl list. 485 * @apilevel high-level 486 */ 487 public int getNumBodyDecl() { 488 return getBodyDeclList().getNumChild(); 489 } 490 /** 491 * Retrieves the number of children in the BodyDecl list. 492 * Calling this method will not trigger rewrites. 493 * @return Number of children in the BodyDecl list. 494 * @apilevel low-level 495 */ 496 public int getNumBodyDeclNoTransform() { 497 return getBodyDeclListNoTransform().getNumChildNoTransform(); 498 } 499 /** 500 * Retrieves the element at index {@code i} in the BodyDecl list. 501 * @param i Index of the element to return. 502 * @return The element at position {@code i} in the BodyDecl list. 503 * @apilevel high-level 504 */ 505 public BodyDecl getBodyDecl(int i) { 506 return (BodyDecl) getBodyDeclList().getChild(i); 507 } 508 /** 509 * Check whether the BodyDecl list has any children. 510 * @return {@code true} if it has at least one child, {@code false} otherwise. 511 * @apilevel high-level 512 */ 513 public boolean hasBodyDecl() { 514 return getBodyDeclList().getNumChild() != 0; 515 } 516 /** 517 * Append an element to the BodyDecl list. 518 * @param node The element to append to the BodyDecl list. 519 * @apilevel high-level 520 */ 521 public void addBodyDecl(BodyDecl node) { 522 List<BodyDecl> list = (parent == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); 523 list.addChild(node); 524 } 525 /** 526 * @apilevel low-level 527 */ 528 public void addBodyDeclNoTransform(BodyDecl node) { 529 List<BodyDecl> list = getBodyDeclListNoTransform(); 530 list.addChild(node); 531 } 532 /** 533 * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. 534 * @param node The new node to replace the old list element. 535 * @param i The list index of the node to be replaced. 536 * @apilevel high-level 537 */ 538 public void setBodyDecl(BodyDecl node, int i) { 539 List<BodyDecl> list = getBodyDeclList(); 540 list.setChild(node, i); 541 } 542 /** 543 * Retrieves the child position of the BodyDecl list. 544 * @return The the child position of the BodyDecl list. 545 * @apilevel low-level 546 */ 547 protected int getBodyDeclListChildPosition() { 548 return 4; 549 } 550 /** 551 * Retrieves the BodyDecl list. 552 * <p><em>This method does not invoke AST transformations.</em></p> 553 * @return The node representing the BodyDecl list. 554 * @apilevel low-level 555 */ 556 public List<BodyDecl> getBodyDeclListNoTransform() { 557 return (List<BodyDecl>) getChildNoTransform(4); 558 } 559 /** 560 * Retrieves the BodyDecl list. 561 * @return The node representing the BodyDecl list. 562 * @apilevel high-level 563 */ 564 public List<BodyDecl> getBodyDecls() { 565 return getBodyDeclList(); 566 } 567 /** 568 * Retrieves the BodyDecl list. 569 * <p><em>This method does not invoke AST transformations.</em></p> 570 * @return The node representing the BodyDecl list. 571 * @apilevel low-level 572 */ 573 public List<BodyDecl> getBodyDeclsNoTransform() { 574 return getBodyDeclListNoTransform(); 575 } 576 /** 577 * @attribute syn 578 * @aspect NestedTypes 579 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:624 580 */ 581 @ASTNodeAnnotation.Attribute 582 public TypeDecl hostType() { 583 TypeDecl hostType_value = getOriginal(); 584 585 return hostType_value; 586 } 587 /** 588 * @apilevel internal 589 */ 590 protected boolean getBodyDeclList_computed = false; 591 /** 592 * @apilevel internal 593 */ 594 protected List getBodyDeclList_value; 595 /** 596 * @apilevel internal 597 */ 598 private void getBodyDeclList_reset() { 599 getBodyDeclList_computed = false; 600 getBodyDeclList_value = null; 601 } 602 /** 603 * @attribute syn nta 604 * @aspect LookupParTypeDecl 605 * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1234 606 */ 607 @ASTNodeAnnotation.Attribute 608 public List getBodyDeclList() { 609 ASTNode$State state = state(); 610 if (getBodyDeclList_computed) { 611 return (List) getChild(getBodyDeclListChildPosition()); 612 } 613 boolean intermediate = state.INTERMEDIATE_VALUE; 614 state.INTERMEDIATE_VALUE = false; 615 int num = state.boundariesCrossed; 616 boolean isFinal = this.is$Final(); 617 getBodyDeclList_value = new BodyDeclList(); 618 setChild(getBodyDeclList_value, getBodyDeclListChildPosition()); 619 if (isFinal && num == state().boundariesCrossed) { 620 getBodyDeclList_computed = true; 621 } else { 622 } 623 state.INTERMEDIATE_VALUE |= intermediate; 624 625 List node = (List) this.getChild(getBodyDeclListChildPosition()); 626 return node; 627 } 628 /** 629 * @attribute syn 630 * @aspect LookupParTypeDecl 631 * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1417 632 */ 633 @ASTNodeAnnotation.Attribute 634 public TypeDecl original() { 635 TypeDecl original_value = getOriginal().original(); 636 637 return original_value; 638 } 639 /** 640 * @apilevel internal 641 */ 642 protected boolean sourceTypeDecl_computed = false; 643 /** 644 * @apilevel internal 645 */ 646 protected TypeDecl sourceTypeDecl_value; 647 /** 648 * @apilevel internal 649 */ 650 private void sourceTypeDecl_reset() { 651 sourceTypeDecl_computed = false; 652 sourceTypeDecl_value = null; 653 } 654 /** 655 * @attribute syn 656 * @aspect SourceDeclarations 657 * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1618 658 */ 659 @ASTNodeAnnotation.Attribute 660 public TypeDecl sourceTypeDecl() { 661 ASTNode$State state = state(); 662 if (sourceTypeDecl_computed) { 663 return sourceTypeDecl_value; 664 } 665 boolean intermediate = state.INTERMEDIATE_VALUE; 666 state.INTERMEDIATE_VALUE = false; 667 int num = state.boundariesCrossed; 668 boolean isFinal = this.is$Final(); 669 sourceTypeDecl_value = original().sourceTypeDecl(); 670 if (isFinal && num == state().boundariesCrossed) { 671 sourceTypeDecl_computed = true; 672 } else { 673 } 674 state.INTERMEDIATE_VALUE |= intermediate; 675 676 return sourceTypeDecl_value; 677 } 678 /** 679 * @apilevel internal 680 */ 681 protected java.util.Map instanceOf_TypeDecl_values; 682 /** 683 * @apilevel internal 684 */ 685 private void instanceOf_TypeDecl_reset() { 686 instanceOf_TypeDecl_values = null; 687 } 688 /** 689 * @attribute syn 690 * @aspect TypeWideningAndIdentity 691 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:442 692 */ 693 @ASTNodeAnnotation.Attribute 694 public boolean instanceOf(TypeDecl type) { 695 Object _parameters = type; 696 if (instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap()); 697 ASTNode$State state = state(); 698 if (instanceOf_TypeDecl_values.containsKey(_parameters)) { 699 return (Boolean) instanceOf_TypeDecl_values.get(_parameters); 700 } 701 boolean intermediate = state.INTERMEDIATE_VALUE; 702 state.INTERMEDIATE_VALUE = false; 703 int num = state.boundariesCrossed; 704 boolean isFinal = this.is$Final(); 705 boolean instanceOf_TypeDecl_value = subtype(type); 706 if (isFinal && num == state().boundariesCrossed) { 707 instanceOf_TypeDecl_values.put(_parameters, instanceOf_TypeDecl_value); 708 } else { 709 } 710 state.INTERMEDIATE_VALUE |= intermediate; 711 712 return instanceOf_TypeDecl_value; 713 } 714 /** 715 * @apilevel internal 716 */ 717 private void subtype_TypeDecl_reset() { 718 subtype_TypeDecl_values = null; 719 } 720 protected java.util.Map subtype_TypeDecl_values; 721 @ASTNodeAnnotation.Attribute 722 public boolean subtype(TypeDecl type) { 723 Object _parameters = type; 724 if (subtype_TypeDecl_values == null) subtype_TypeDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap()); 725 ASTNode$State.CircularValue _value; 726 if (subtype_TypeDecl_values.containsKey(_parameters)) { 727 Object _o = subtype_TypeDecl_values.get(_parameters); 728 if (!(_o instanceof ASTNode$State.CircularValue)) { 729 return (Boolean) _o; 730 } else { 731 _value = (ASTNode$State.CircularValue) _o; 732 } 733 } else { 734 _value = new ASTNode$State.CircularValue(); 735 subtype_TypeDecl_values.put(_parameters, _value); 736 _value.value = true; 737 } 738 ASTNode$State state = state(); 739 boolean new_subtype_TypeDecl_value; 740 if (!state.IN_CIRCLE) { 741 state.IN_CIRCLE = true; 742 int num = state.boundariesCrossed; 743 boolean isFinal = this.is$Final(); 744 // TODO: fixme 745 // state().CIRCLE_INDEX = 1; 746 do { 747 _value.visited = state.CIRCLE_INDEX; 748 state.CHANGE = false; 749 new_subtype_TypeDecl_value = type.supertypeClassDeclSubstituted(this); 750 if (new_subtype_TypeDecl_value != ((Boolean)_value.value)) { 751 state.CHANGE = true; 752 _value.value = new_subtype_TypeDecl_value; 753 } 754 state.CIRCLE_INDEX++; 755 } while (state.CHANGE); 756 if (isFinal && num == state().boundariesCrossed) { 757 subtype_TypeDecl_values.put(_parameters, new_subtype_TypeDecl_value); 758 } else { 759 subtype_TypeDecl_values.remove(_parameters); 760 state.RESET_CYCLE = true; 761 boolean $tmp = type.supertypeClassDeclSubstituted(this); 762 state.RESET_CYCLE = false; 763 } 764 state.IN_CIRCLE = false; 765 state.INTERMEDIATE_VALUE = false; 766 return new_subtype_TypeDecl_value; 767 } 768 if (state.CIRCLE_INDEX != _value.visited) { 769 _value.visited = state.CIRCLE_INDEX; 770 new_subtype_TypeDecl_value = type.supertypeClassDeclSubstituted(this); 771 if (state.RESET_CYCLE) { 772 subtype_TypeDecl_values.remove(_parameters); 773 } 774 else if (new_subtype_TypeDecl_value != ((Boolean)_value.value)) { 775 state.CHANGE = true; 776 _value.value = new_subtype_TypeDecl_value; 777 } 778 state.INTERMEDIATE_VALUE = true; 779 return new_subtype_TypeDecl_value; 780 } 781 state.INTERMEDIATE_VALUE = true; 782 return (Boolean) _value.value; 783 } 784 /** 785 * @attribute syn 786 * @aspect GenericsSubtype 787 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:527 788 */ 789 @ASTNodeAnnotation.Attribute 790 public boolean supertypeClassDeclSubstituted(ClassDeclSubstituted type) { 791 boolean supertypeClassDeclSubstituted_ClassDeclSubstituted_value = original() == type.original() && type.enclosingType().subtype(enclosingType()) 792 || super.supertypeClassDeclSubstituted(type); 793 794 return supertypeClassDeclSubstituted_ClassDeclSubstituted_value; 795 } 796 /** 797 * @attribute syn 798 * @aspect GenericsSubtype 799 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:448 800 */ 801 @ASTNodeAnnotation.Attribute 802 public boolean supertypeClassDecl(ClassDecl type) { 803 boolean supertypeClassDecl_ClassDecl_value = super.supertypeClassDecl(type) || original().supertypeClassDecl(type); 804 805 return supertypeClassDecl_ClassDecl_value; 806 } 807 /** 808 * @apilevel internal 809 */ 810 protected boolean typeDescriptor_computed = false; 811 /** 812 * @apilevel internal 813 */ 814 protected String typeDescriptor_value; 815 /** 816 * @apilevel internal 817 */ 818 private void typeDescriptor_reset() { 819 typeDescriptor_computed = false; 820 typeDescriptor_value = null; 821 } 822 /** 823 * @attribute syn 824 * @aspect ConstantPoolNames 825 * @declaredat /home/jesper/git/extendj/java4/backend/ConstantPoolNames.jrag:77 826 */ 827 @ASTNodeAnnotation.Attribute 828 public String typeDescriptor() { 829 ASTNode$State state = state(); 830 if (typeDescriptor_computed) { 831 return typeDescriptor_value; 832 } 833 boolean intermediate = state.INTERMEDIATE_VALUE; 834 state.INTERMEDIATE_VALUE = false; 835 int num = state.boundariesCrossed; 836 boolean isFinal = this.is$Final(); 837 typeDescriptor_value = original().typeDescriptor(); 838 if (isFinal && num == state().boundariesCrossed) { 839 typeDescriptor_computed = true; 840 } else { 841 } 842 state.INTERMEDIATE_VALUE |= intermediate; 843 844 return typeDescriptor_value; 845 } 846 /** 847 * @apilevel internal 848 */ 849 protected boolean constantPoolName_computed = false; 850 /** 851 * @apilevel internal 852 */ 853 protected String constantPoolName_value; 854 /** 855 * @apilevel internal 856 */ 857 private void constantPoolName_reset() { 858 constantPoolName_computed = false; 859 constantPoolName_value = null; 860 } 861 /** 862 * For a top-level type the constant pool name of the type is the same as the 863 * canonical name but with dots replaced by solidus. 864 * 865 * <p>For nested types the constant pool name is based on the enclosing top-level 866 * types constant pool name followed by a dollar sign and a unique index and/or 867 * the type name. 868 * 869 * @return constant pool name of this type 870 * @attribute syn 871 * @aspect ConstantPoolNames 872 * @declaredat /home/jesper/git/extendj/java4/backend/ConstantPoolNames.jrag:44 873 */ 874 @ASTNodeAnnotation.Attribute 875 public String constantPoolName() { 876 ASTNode$State state = state(); 877 if (constantPoolName_computed) { 878 return constantPoolName_value; 879 } 880 boolean intermediate = state.INTERMEDIATE_VALUE; 881 state.INTERMEDIATE_VALUE = false; 882 int num = state.boundariesCrossed; 883 boolean isFinal = this.is$Final(); 884 constantPoolName_value = original().constantPoolName(); 885 if (isFinal && num == state().boundariesCrossed) { 886 constantPoolName_computed = true; 887 } else { 888 } 889 state.INTERMEDIATE_VALUE |= intermediate; 890 891 return constantPoolName_value; 892 } 893 /** 894 * @apilevel internal 895 */ 896 protected boolean uniqueIndex_computed = false; 897 /** 898 * @apilevel internal 899 */ 900 protected int uniqueIndex_value; 901 /** 902 * @apilevel internal 903 */ 904 private void uniqueIndex_reset() { 905 uniqueIndex_computed = false; 906 } 907 /** 908 * @attribute syn 909 * @aspect Java2Rewrites 910 * @declaredat /home/jesper/git/extendj/java4/backend/Java2Rewrites.jrag:33 911 */ 912 @ASTNodeAnnotation.Attribute 913 public int uniqueIndex() { 914 ASTNode$State state = state(); 915 if (uniqueIndex_computed) { 916 return uniqueIndex_value; 917 } 918 boolean intermediate = state.INTERMEDIATE_VALUE; 919 state.INTERMEDIATE_VALUE = false; 920 int num = state.boundariesCrossed; 921 boolean isFinal = this.is$Final(); 922 uniqueIndex_value = original().uniqueIndex(); 923 if (isFinal && num == state().boundariesCrossed) { 924 uniqueIndex_computed = true; 925 } else { 926 } 927 state.INTERMEDIATE_VALUE |= intermediate; 928 929 return uniqueIndex_value; 930 } 931 /** 932 * @attribute syn 933 * @aspect CreateBCode 934 * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:900 935 */ 936 @ASTNodeAnnotation.Attribute 937 public String arrayTypeDescriptor() { 938 String arrayTypeDescriptor_value = original().arrayTypeDescriptor(); 939 940 return arrayTypeDescriptor_value; 941 } 942 /** 943 * @apilevel internal 944 */ 945 private void strictSubtype_TypeDecl_reset() { 946 strictSubtype_TypeDecl_values = null; 947 } 948 protected java.util.Map strictSubtype_TypeDecl_values; 949 @ASTNodeAnnotation.Attribute 950 public boolean strictSubtype(TypeDecl type) { 951 Object _parameters = type; 952 if (strictSubtype_TypeDecl_values == null) strictSubtype_TypeDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap()); 953 ASTNode$State.CircularValue _value; 954 if (strictSubtype_TypeDecl_values.containsKey(_parameters)) { 955 Object _o = strictSubtype_TypeDecl_values.get(_parameters); 956 if (!(_o instanceof ASTNode$State.CircularValue)) { 957 return (Boolean) _o; 958 } else { 959 _value = (ASTNode$State.CircularValue) _o; 960 } 961 } else { 962 _value = new ASTNode$State.CircularValue(); 963 strictSubtype_TypeDecl_values.put(_parameters, _value); 964 _value.value = true; 965 } 966 ASTNode$State state = state(); 967 boolean new_strictSubtype_TypeDecl_value; 968 if (!state.IN_CIRCLE) { 969 state.IN_CIRCLE = true; 970 int num = state.boundariesCrossed; 971 boolean isFinal = this.is$Final(); 972 // TODO: fixme 973 // state().CIRCLE_INDEX = 1; 974 do { 975 _value.visited = state.CIRCLE_INDEX; 976 state.CHANGE = false; 977 new_strictSubtype_TypeDecl_value = type.strictSupertypeClassDeclSubstituted(this); 978 if (new_strictSubtype_TypeDecl_value != ((Boolean)_value.value)) { 979 state.CHANGE = true; 980 _value.value = new_strictSubtype_TypeDecl_value; 981 } 982 state.CIRCLE_INDEX++; 983 } while (state.CHANGE); 984 if (isFinal && num == state().boundariesCrossed) { 985 strictSubtype_TypeDecl_values.put(_parameters, new_strictSubtype_TypeDecl_value); 986 } else { 987 strictSubtype_TypeDecl_values.remove(_parameters); 988 state.RESET_CYCLE = true; 989 boolean $tmp = type.strictSupertypeClassDeclSubstituted(this); 990 state.RESET_CYCLE = false; 991 } 992 state.IN_CIRCLE = false; 993 state.INTERMEDIATE_VALUE = false; 994 return new_strictSubtype_TypeDecl_value; 995 } 996 if (state.CIRCLE_INDEX != _value.visited) { 997 _value.visited = state.CIRCLE_INDEX; 998 new_strictSubtype_TypeDecl_value = type.strictSupertypeClassDeclSubstituted(this); 999 if (state.RESET_CYCLE) { 1000 strictSubtype_TypeDecl_values.remove(_parameters); 1001 } 1002 else if (new_strictSubtype_TypeDecl_value != ((Boolean)_value.value)) { 1003 state.CHANGE = true; 1004 _value.value = new_strictSubtype_TypeDecl_value; 1005 } 1006 state.INTERMEDIATE_VALUE = true; 1007 return new_strictSubtype_TypeDecl_value; 1008 } 1009 state.INTERMEDIATE_VALUE = true; 1010 return (Boolean) _value.value; 1011 } 1012 /** 1013 * @attribute syn 1014 * @aspect StrictSubtype 1015 * @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:455 1016 */ 1017 @ASTNodeAnnotation.Attribute 1018 public boolean strictSupertypeClassDeclSubstituted(ClassDeclSubstituted type) { 1019 boolean strictSupertypeClassDeclSubstituted_ClassDeclSubstituted_value = original() == type.original() && type.enclosingType().strictSubtype(enclosingType()) 1020 || super.strictSupertypeClassDeclSubstituted(type); 1021 1022 return strictSupertypeClassDeclSubstituted_ClassDeclSubstituted_value; 1023 } 1024 /** 1025 * @attribute syn 1026 * @aspect StrictSubtype 1027 * @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:370 1028 */ 1029 @ASTNodeAnnotation.Attribute 1030 public boolean strictSupertypeClassDecl(ClassDecl type) { 1031 boolean strictSupertypeClassDecl_ClassDecl_value = super.strictSupertypeClassDecl(type) || original().strictSupertypeClassDecl(type); 1032 1033 return strictSupertypeClassDecl_ClassDecl_value; 1034 } 1035 /** 1036 * @apilevel internal 1037 */ 1038 protected boolean localMethodsSignatureMap_computed = false; 1039 /** 1040 * @apilevel internal 1041 */ 1042 protected Map<String,SimpleSet> localMethodsSignatureMap_value; 1043 /** 1044 * @apilevel internal 1045 */ 1046 private void localMethodsSignatureMap_reset() { 1047 localMethodsSignatureMap_computed = false; 1048 localMethodsSignatureMap_value = null; 1049 } 1050 /** 1051 * @attribute syn 1052 * @aspect LookupParTypeDecl 1053 * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1278 1054 */ 1055 @ASTNodeAnnotation.Attribute 1056 public Map<String,SimpleSet> localMethodsSignatureMap() { 1057 ASTNode$State state = state(); 1058 if (localMethodsSignatureMap_computed) { 1059 return localMethodsSignatureMap_value; 1060 } 1061 boolean intermediate = state.INTERMEDIATE_VALUE; 1062 state.INTERMEDIATE_VALUE = false; 1063 int num = state.boundariesCrossed; 1064 boolean isFinal = this.is$Final(); 1065 localMethodsSignatureMap_value = localMethodsSignatureMap_compute(); 1066 if (true) { 1067 localMethodsSignatureMap_computed = true; 1068 } else { 1069 } 1070 state.INTERMEDIATE_VALUE |= intermediate; 1071 1072 return localMethodsSignatureMap_value; 1073 } 1074 /** 1075 * @apilevel internal 1076 */ 1077 private Map<String,SimpleSet> localMethodsSignatureMap_compute() { 1078 Map<String,SimpleSet> map = new HashMap<String,SimpleSet>(); 1079 for (Iterator<MethodDecl> iter = original().localMethodsIterator(); iter.hasNext(); ) { 1080 MethodDecl decl = iter.next(); 1081 1082 if (!decl.isStatic() && (decl.usesTypeVariable() || isRawType())) { 1083 BodyDecl copyDecl = ((BodyDeclList) getBodyDeclList()).localMethodSignatureCopy(decl, this); 1084 decl = (MethodDecl) copyDecl; 1085 } 1086 putSimpleSetElement(map, decl.signature(), decl); 1087 1088 } 1089 return map; 1090 } 1091 /** 1092 * @apilevel internal 1093 */ 1094 protected java.util.Map localFields_String_values; 1095 /** 1096 * @apilevel internal 1097 */ 1098 private void localFields_String_reset() { 1099 localFields_String_values = null; 1100 } 1101 /** 1102 * @attribute syn 1103 * @aspect LookupParTypeDecl 1104 * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1296 1105 */ 1106 @ASTNodeAnnotation.Attribute 1107 public SimpleSet localFields(String name) { 1108 Object _parameters = name; 1109 if (localFields_String_values == null) localFields_String_values = new org.jastadd.util.RobustMap(new java.util.HashMap()); 1110 ASTNode$State state = state(); 1111 if (localFields_String_values.containsKey(_parameters)) { 1112 return (SimpleSet) localFields_String_values.get(_parameters); 1113 } 1114 boolean intermediate = state.INTERMEDIATE_VALUE; 1115 state.INTERMEDIATE_VALUE = false; 1116 int num = state.boundariesCrossed; 1117 boolean isFinal = this.is$Final(); 1118 SimpleSet localFields_String_value = localFields_compute(name); 1119 if (true) { 1120 localFields_String_values.put(_parameters, localFields_String_value); 1121 } else { 1122 } 1123 state.INTERMEDIATE_VALUE |= intermediate; 1124 1125 return localFields_String_value; 1126 } 1127 /** 1128 * @apilevel internal 1129 */ 1130 private SimpleSet localFields_compute(String name) { 1131 SimpleSet set = SimpleSet.emptySet; 1132 for (Iterator iter = original().localFields(name).iterator(); iter.hasNext(); ) { 1133 FieldDeclaration f = (FieldDeclaration) iter.next(); 1134 1135 if (!f.isStatic() && (f.usesTypeVariable() || isRawType())) { 1136 BodyDecl fCopy = ((BodyDeclList) getBodyDeclList()).localFieldCopy(f, this); 1137 f = (FieldDeclaration) fCopy; 1138 } 1139 set = set.add(f); 1140 1141 } 1142 return set; 1143 } 1144 /** 1145 * @apilevel internal 1146 */ 1147 private void localTypeDecls_String_reset() { 1148 localTypeDecls_String_values = null; 1149 } 1150 protected java.util.Map localTypeDecls_String_values; 1151 @ASTNodeAnnotation.Attribute 1152 public SimpleSet localTypeDecls(String name) { 1153 Object _parameters = name; 1154 if (localTypeDecls_String_values == null) localTypeDecls_String_values = new org.jastadd.util.RobustMap(new java.util.HashMap()); 1155 ASTNode$State.CircularValue _value; 1156 if (localTypeDecls_String_values.containsKey(_parameters)) { 1157 Object _o = localTypeDecls_String_values.get(_parameters); 1158 if (!(_o instanceof ASTNode$State.CircularValue)) { 1159 return (SimpleSet) _o; 1160 } else { 1161 _value = (ASTNode$State.CircularValue) _o; 1162 } 1163 } else { 1164 _value = new ASTNode$State.CircularValue(); 1165 localTypeDecls_String_values.put(_parameters, _value); 1166 _value.value = SimpleSet.emptySet; 1167 } 1168 ASTNode$State state = state(); 1169 SimpleSet new_localTypeDecls_String_value; 1170 if (!state.IN_CIRCLE) { 1171 state.IN_CIRCLE = true; 1172 int num = state.boundariesCrossed; 1173 boolean isFinal = this.is$Final(); 1174 // TODO: fixme 1175 // state().CIRCLE_INDEX = 1; 1176 do { 1177 _value.visited = state.CIRCLE_INDEX; 1178 state.CHANGE = false; 1179 new_localTypeDecls_String_value = localTypeDecls_compute(name); 1180 if ((new_localTypeDecls_String_value==null && (SimpleSet)_value.value!=null) || (new_localTypeDecls_String_value!=null && !new_localTypeDecls_String_value.equals((SimpleSet)_value.value))) { 1181 state.CHANGE = true; 1182 _value.value = new_localTypeDecls_String_value; 1183 } 1184 state.CIRCLE_INDEX++; 1185 } while (state.CHANGE); 1186 if (true) { 1187 localTypeDecls_String_values.put(_parameters, new_localTypeDecls_String_value); 1188 } else { 1189 localTypeDecls_String_values.remove(_parameters); 1190 state.RESET_CYCLE = true; 1191 SimpleSet $tmp = localTypeDecls_compute(name); 1192 state.RESET_CYCLE = false; 1193 } 1194 state.IN_CIRCLE = false; 1195 state.INTERMEDIATE_VALUE = false; 1196 return new_localTypeDecls_String_value; 1197 } 1198 if (state.CIRCLE_INDEX != _value.visited) { 1199 _value.visited = state.CIRCLE_INDEX; 1200 new_localTypeDecls_String_value = localTypeDecls_compute(name); 1201 if (state.RESET_CYCLE) { 1202 localTypeDecls_String_values.remove(_parameters); 1203 } 1204 else if ((new_localTypeDecls_String_value==null && (SimpleSet)_value.value!=null) || (new_localTypeDecls_String_value!=null && !new_localTypeDecls_String_value.equals((SimpleSet)_value.value))) { 1205 state.CHANGE = true; 1206 _value.value = new_localTypeDecls_String_value; 1207 } 1208 state.INTERMEDIATE_VALUE = true; 1209 return new_localTypeDecls_String_value; 1210 } 1211 state.INTERMEDIATE_VALUE = true; 1212 return (SimpleSet) _value.value; 1213 } 1214 /** 1215 * @apilevel internal 1216 */ 1217 private SimpleSet localTypeDecls_compute(String name) { 1218 SimpleSet set = SimpleSet.emptySet; 1219 for (Iterator iter = original().localTypeDecls(name).iterator(); iter.hasNext(); ) { 1220 TypeDecl t = (TypeDecl) iter.next(); 1221 1222 if (t.isStatic()) { 1223 set = set.add(t); 1224 } else if (t instanceof ClassDecl) { 1225 MemberClassDecl copy = 1226 ((BodyDeclList) getBodyDeclList()).localClassDeclCopy((ClassDecl) t, this); 1227 set = set.add(copy.getClassDecl()); 1228 } else if (t instanceof InterfaceDecl) { 1229 MemberInterfaceDecl copy = 1230 ((BodyDeclList) getBodyDeclList()).localInterfaceDeclCopy((InterfaceDecl) t, this); 1231 set = set.add(copy.getInterfaceDecl()); 1232 } 1233 } 1234 return set; 1235 } 1236 /** 1237 * @apilevel internal 1238 */ 1239 protected boolean constructors_computed = false; 1240 /** 1241 * @apilevel internal 1242 */ 1243 protected Collection<ConstructorDecl> constructors_value; 1244 /** 1245 * @apilevel internal 1246 */ 1247 private void constructors_reset() { 1248 constructors_computed = false; 1249 constructors_value = null; 1250 } 1251 /** 1252 * @attribute syn 1253 * @aspect LookupParTypeDecl 1254 * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1347 1255 */ 1256 @ASTNodeAnnotation.Attribute 1257 public Collection<ConstructorDecl> constructors() { 1258 ASTNode$State state = state(); 1259 if (constructors_computed) { 1260 return constructors_value; 1261 } 1262 boolean intermediate = state.INTERMEDIATE_VALUE; 1263 state.INTERMEDIATE_VALUE = false; 1264 int num = state.boundariesCrossed; 1265 boolean isFinal = this.is$Final(); 1266 constructors_value = constructors_compute(); 1267 if (isFinal && num == state().boundariesCrossed) { 1268 constructors_computed = true; 1269 } else { 1270 } 1271 state.INTERMEDIATE_VALUE |= intermediate; 1272 1273 return constructors_value; 1274 } 1275 /** 1276 * @apilevel internal 1277 */ 1278 private Collection<ConstructorDecl> constructors_compute() { 1279 Collection<ConstructorDecl> constructors = new ArrayList<ConstructorDecl>(); 1280 for (Iterator iter = original().constructors().iterator(); iter.hasNext(); ) { 1281 ConstructorDecl c = (ConstructorDecl) iter.next(); 1282 1283 ConstructorDecl b = ((BodyDeclList) getBodyDeclList()).constructorCopy(c, this); 1284 constructors.add(b); 1285 } 1286 return constructors; 1287 } 1288 /** 1289 * @apilevel internal 1290 */ 1291 public ASTNode rewriteTo() { 1292 return super.rewriteTo(); 1293 } 1294 }