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