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/java4/grammar/Java.ast:67 027 * @production AnonymousDecl : {@link ClassDecl} ::= <span class="component">{@link Modifiers}</span> <span class="component"><ID:String></span> <span class="component">[SuperClass:{@link Access}]</span> <span class="component">Implements:{@link Access}*</span> <span class="component">{@link BodyDecl}*</span>; 028 029 */ 030 public class AnonymousDecl extends ClassDecl implements Cloneable { 031 /** 032 * @aspect GenerateClassfile 033 * @declaredat /home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag:411 034 */ 035 public boolean clear() { 036 for (int i = 0; i < getNumChild(); i++) { 037 getChild(i).clear(); 038 } 039 setParent(null); 040 flushCache(); 041 return true; 042 } 043 /** 044 * @declaredat ASTNode:1 045 */ 046 public AnonymousDecl() { 047 super(); 048 } 049 /** 050 * Initializes the child array to the correct size. 051 * Initializes List and Opt nta children. 052 * @apilevel internal 053 * @ast method 054 * @declaredat ASTNode:10 055 */ 056 public void init$Children() { 057 children = new ASTNode[5]; 058 setChild(new List(), 1); 059 setChild(new Opt(), 2); 060 setChild(new Opt(), 3); 061 setChild(new List(), 4); 062 } 063 /** 064 * @declaredat ASTNode:17 065 */ 066 public AnonymousDecl(Modifiers p0, String p1, List<BodyDecl> p2) { 067 setChild(p0, 0); 068 setID(p1); 069 setChild(p2, 1); 070 } 071 /** 072 * @declaredat ASTNode:22 073 */ 074 public AnonymousDecl(Modifiers p0, beaver.Symbol p1, List<BodyDecl> p2) { 075 setChild(p0, 0); 076 setID(p1); 077 setChild(p2, 1); 078 } 079 /** 080 * @apilevel low-level 081 * @declaredat ASTNode:30 082 */ 083 protected int numChildren() { 084 return 2; 085 } 086 /** 087 * @apilevel internal 088 * @declaredat ASTNode:36 089 */ 090 public boolean mayHaveRewrite() { 091 return false; 092 } 093 /** 094 * @apilevel internal 095 * @declaredat ASTNode:42 096 */ 097 public void flushAttrCache() { 098 super.flushAttrCache(); 099 isCircular_reset(); 100 getSuperClassOpt_reset(); 101 getImplementsList_reset(); 102 getImplicitConstructorOpt_reset(); 103 } 104 /** 105 * @apilevel internal 106 * @declaredat ASTNode:52 107 */ 108 public void flushCollectionCache() { 109 super.flushCollectionCache(); 110 } 111 /** 112 * @apilevel internal 113 * @declaredat ASTNode:58 114 */ 115 public void flushRewriteCache() { 116 super.flushRewriteCache(); 117 } 118 /** 119 * @apilevel internal 120 * @declaredat ASTNode:64 121 */ 122 public AnonymousDecl clone() throws CloneNotSupportedException { 123 AnonymousDecl node = (AnonymousDecl) super.clone(); 124 return node; 125 } 126 /** 127 * @apilevel internal 128 * @declaredat ASTNode:71 129 */ 130 public AnonymousDecl copy() { 131 try { 132 AnonymousDecl node = (AnonymousDecl) 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:90 149 */ 150 @Deprecated 151 public AnonymousDecl 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:100 160 */ 161 public AnonymousDecl treeCopyNoTransform() { 162 AnonymousDecl tree = (AnonymousDecl) copy(); 163 if (children != null) { 164 for (int i = 0; i < children.length; ++i) { 165 switch (i) { 166 case 2: 167 case 3: 168 tree.children[i] = new Opt(); 169 continue; 170 case 4: 171 tree.children[i] = new List(); 172 continue; 173 } 174 ASTNode child = (ASTNode) children[i]; 175 if (child != null) { 176 child = child.treeCopyNoTransform(); 177 tree.setChild(child, i); 178 } 179 } 180 } 181 return tree; 182 } 183 /** 184 * Create a deep copy of the AST subtree at this node. 185 * The subtree of this node is traversed to trigger rewrites before copy. 186 * The copy is dangling, i.e. has no parent. 187 * @return dangling copy of the subtree at this node 188 * @apilevel low-level 189 * @declaredat ASTNode:129 190 */ 191 public AnonymousDecl treeCopy() { 192 doFullTraversal(); 193 return treeCopyNoTransform(); 194 } 195 /** 196 * @apilevel internal 197 * @declaredat ASTNode:136 198 */ 199 protected boolean is$Equal(ASTNode node) { 200 return super.is$Equal(node) && (tokenString_ID == ((AnonymousDecl)node).tokenString_ID); 201 } 202 /** 203 * Replaces the Modifiers child. 204 * @param node The new node to replace the Modifiers child. 205 * @apilevel high-level 206 */ 207 public void setModifiers(Modifiers node) { 208 setChild(node, 0); 209 } 210 /** 211 * Retrieves the Modifiers child. 212 * @return The current node used as the Modifiers child. 213 * @apilevel high-level 214 */ 215 @ASTNodeAnnotation.Child(name="Modifiers") 216 public Modifiers getModifiers() { 217 return (Modifiers) getChild(0); 218 } 219 /** 220 * Retrieves the Modifiers child. 221 * <p><em>This method does not invoke AST transformations.</em></p> 222 * @return The current node used as the Modifiers child. 223 * @apilevel low-level 224 */ 225 public Modifiers getModifiersNoTransform() { 226 return (Modifiers) getChildNoTransform(0); 227 } 228 /** 229 * Replaces the lexeme ID. 230 * @param value The new value for the lexeme ID. 231 * @apilevel high-level 232 */ 233 public void setID(String value) { 234 tokenString_ID = value; 235 } 236 /** 237 * JastAdd-internal setter for lexeme ID using the Beaver parser. 238 * @param symbol Symbol containing the new value for the lexeme ID 239 * @apilevel internal 240 */ 241 public void setID(beaver.Symbol symbol) { 242 if (symbol.value != null && !(symbol.value instanceof String)) 243 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 244 tokenString_ID = (String)symbol.value; 245 IDstart = symbol.getStart(); 246 IDend = symbol.getEnd(); 247 } 248 /** 249 * Retrieves the value for the lexeme ID. 250 * @return The value for the lexeme ID. 251 * @apilevel high-level 252 */ 253 @ASTNodeAnnotation.Token(name="ID") 254 public String getID() { 255 return tokenString_ID != null ? tokenString_ID : ""; 256 } 257 /** 258 * Replaces the BodyDecl list. 259 * @param list The new list node to be used as the BodyDecl list. 260 * @apilevel high-level 261 */ 262 public void setBodyDeclList(List<BodyDecl> list) { 263 setChild(list, 1); 264 } 265 /** 266 * Retrieves the number of children in the BodyDecl list. 267 * @return Number of children in the BodyDecl list. 268 * @apilevel high-level 269 */ 270 public int getNumBodyDecl() { 271 return getBodyDeclList().getNumChild(); 272 } 273 /** 274 * Retrieves the number of children in the BodyDecl list. 275 * Calling this method will not trigger rewrites. 276 * @return Number of children in the BodyDecl list. 277 * @apilevel low-level 278 */ 279 public int getNumBodyDeclNoTransform() { 280 return getBodyDeclListNoTransform().getNumChildNoTransform(); 281 } 282 /** 283 * Retrieves the element at index {@code i} in the BodyDecl list. 284 * @param i Index of the element to return. 285 * @return The element at position {@code i} in the BodyDecl list. 286 * @apilevel high-level 287 */ 288 public BodyDecl getBodyDecl(int i) { 289 return (BodyDecl) getBodyDeclList().getChild(i); 290 } 291 /** 292 * Check whether the BodyDecl list has any children. 293 * @return {@code true} if it has at least one child, {@code false} otherwise. 294 * @apilevel high-level 295 */ 296 public boolean hasBodyDecl() { 297 return getBodyDeclList().getNumChild() != 0; 298 } 299 /** 300 * Append an element to the BodyDecl list. 301 * @param node The element to append to the BodyDecl list. 302 * @apilevel high-level 303 */ 304 public void addBodyDecl(BodyDecl node) { 305 List<BodyDecl> list = (parent == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); 306 list.addChild(node); 307 } 308 /** 309 * @apilevel low-level 310 */ 311 public void addBodyDeclNoTransform(BodyDecl node) { 312 List<BodyDecl> list = getBodyDeclListNoTransform(); 313 list.addChild(node); 314 } 315 /** 316 * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. 317 * @param node The new node to replace the old list element. 318 * @param i The list index of the node to be replaced. 319 * @apilevel high-level 320 */ 321 public void setBodyDecl(BodyDecl node, int i) { 322 List<BodyDecl> list = getBodyDeclList(); 323 list.setChild(node, i); 324 } 325 /** 326 * Retrieves the BodyDecl list. 327 * @return The node representing the BodyDecl list. 328 * @apilevel high-level 329 */ 330 @ASTNodeAnnotation.ListChild(name="BodyDecl") 331 public List<BodyDecl> getBodyDeclList() { 332 List<BodyDecl> list = (List<BodyDecl>) getChild(1); 333 return list; 334 } 335 /** 336 * Retrieves the BodyDecl list. 337 * <p><em>This method does not invoke AST transformations.</em></p> 338 * @return The node representing the BodyDecl list. 339 * @apilevel low-level 340 */ 341 public List<BodyDecl> getBodyDeclListNoTransform() { 342 return (List<BodyDecl>) getChildNoTransform(1); 343 } 344 /** 345 * Retrieves the BodyDecl list. 346 * @return The node representing the BodyDecl list. 347 * @apilevel high-level 348 */ 349 public List<BodyDecl> getBodyDecls() { 350 return getBodyDeclList(); 351 } 352 /** 353 * Retrieves the BodyDecl list. 354 * <p><em>This method does not invoke AST transformations.</em></p> 355 * @return The node representing the BodyDecl list. 356 * @apilevel low-level 357 */ 358 public List<BodyDecl> getBodyDeclsNoTransform() { 359 return getBodyDeclListNoTransform(); 360 } 361 /** 362 * Replaces the (optional) ImplicitConstructor child. 363 * @param node The new node to be used as the ImplicitConstructor child. 364 * @apilevel high-level 365 */ 366 public void setImplicitConstructor(ConstructorDecl node) { 367 getImplicitConstructorOpt().setChild(node, 0); 368 } 369 /** 370 * Check whether the optional ImplicitConstructor child exists. 371 * @return {@code true} if the optional ImplicitConstructor child exists, {@code false} if it does not. 372 * @apilevel high-level 373 */ 374 public boolean hasImplicitConstructor() { 375 return getImplicitConstructorOpt().getNumChild() != 0; 376 } 377 /** 378 * Retrieves the (optional) ImplicitConstructor child. 379 * @return The ImplicitConstructor child, if it exists. Returns {@code null} otherwise. 380 * @apilevel low-level 381 */ 382 public ConstructorDecl getImplicitConstructor() { 383 return (ConstructorDecl) getImplicitConstructorOpt().getChild(0); 384 } 385 /** 386 * Retrieves the optional node for child ImplicitConstructor. This is the <code>Opt</code> node containing the child ImplicitConstructor, not the actual child! 387 * <p><em>This method does not invoke AST transformations.</em></p> 388 * @return The optional node for child ImplicitConstructor. 389 * @apilevel low-level 390 */ 391 public Opt<ConstructorDecl> getImplicitConstructorOptNoTransform() { 392 return (Opt<ConstructorDecl>) getChildNoTransform(2); 393 } 394 /** 395 * Retrieves the child position of the optional child ImplicitConstructor. 396 * @return The the child position of the optional child ImplicitConstructor. 397 * @apilevel low-level 398 */ 399 protected int getImplicitConstructorOptChildPosition() { 400 return 2; 401 } 402 /** 403 * This method should not be called. This method throws an exception due to 404 * the corresponding child being an NTA shadowing a non-NTA child. 405 * @param node 406 * @apilevel internal 407 */ 408 public void setSuperClassOpt(Opt<Access> node) { 409 throw new Error("Can not replace NTA child SuperClassOpt in AnonymousDecl!"); 410 } 411 /** 412 * Replaces the (optional) SuperClass child. 413 * @param node The new node to be used as the SuperClass child. 414 * @apilevel high-level 415 */ 416 public void setSuperClass(Access node) { 417 getSuperClassOpt().setChild(node, 0); 418 } 419 /** 420 * Check whether the optional SuperClass child exists. 421 * @return {@code true} if the optional SuperClass child exists, {@code false} if it does not. 422 * @apilevel high-level 423 */ 424 public boolean hasSuperClass() { 425 return getSuperClassOpt().getNumChild() != 0; 426 } 427 /** 428 * Retrieves the (optional) SuperClass child. 429 * @return The SuperClass child, if it exists. Returns {@code null} otherwise. 430 * @apilevel low-level 431 */ 432 public Access getSuperClass() { 433 return (Access) getSuperClassOpt().getChild(0); 434 } 435 /** 436 * Retrieves the optional node for child SuperClass. This is the <code>Opt</code> node containing the child SuperClass, not the actual child! 437 * <p><em>This method does not invoke AST transformations.</em></p> 438 * @return The optional node for child SuperClass. 439 * @apilevel low-level 440 */ 441 public Opt<Access> getSuperClassOptNoTransform() { 442 return (Opt<Access>) getChildNoTransform(3); 443 } 444 /** 445 * Retrieves the child position of the optional child SuperClass. 446 * @return The the child position of the optional child SuperClass. 447 * @apilevel low-level 448 */ 449 protected int getSuperClassOptChildPosition() { 450 return 3; 451 } 452 /** 453 * This method should not be called. This method throws an exception due to 454 * the corresponding child being an NTA shadowing a non-NTA child. 455 * @param node 456 * @apilevel internal 457 */ 458 public void setImplementsList(List<Access> node) { 459 throw new Error("Can not replace NTA child ImplementsList in AnonymousDecl!"); 460 } 461 /** 462 * Retrieves the number of children in the Implements list. 463 * @return Number of children in the Implements list. 464 * @apilevel high-level 465 */ 466 public int getNumImplements() { 467 return getImplementsList().getNumChild(); 468 } 469 /** 470 * Retrieves the number of children in the Implements list. 471 * Calling this method will not trigger rewrites. 472 * @return Number of children in the Implements list. 473 * @apilevel low-level 474 */ 475 public int getNumImplementsNoTransform() { 476 return getImplementsListNoTransform().getNumChildNoTransform(); 477 } 478 /** 479 * Retrieves the element at index {@code i} in the Implements list. 480 * @param i Index of the element to return. 481 * @return The element at position {@code i} in the Implements list. 482 * @apilevel high-level 483 */ 484 public Access getImplements(int i) { 485 return (Access) getImplementsList().getChild(i); 486 } 487 /** 488 * Check whether the Implements list has any children. 489 * @return {@code true} if it has at least one child, {@code false} otherwise. 490 * @apilevel high-level 491 */ 492 public boolean hasImplements() { 493 return getImplementsList().getNumChild() != 0; 494 } 495 /** 496 * Append an element to the Implements list. 497 * @param node The element to append to the Implements list. 498 * @apilevel high-level 499 */ 500 public void addImplements(Access node) { 501 List<Access> list = (parent == null) ? getImplementsListNoTransform() : getImplementsList(); 502 list.addChild(node); 503 } 504 /** 505 * @apilevel low-level 506 */ 507 public void addImplementsNoTransform(Access node) { 508 List<Access> list = getImplementsListNoTransform(); 509 list.addChild(node); 510 } 511 /** 512 * Replaces the Implements list element at index {@code i} with the new node {@code node}. 513 * @param node The new node to replace the old list element. 514 * @param i The list index of the node to be replaced. 515 * @apilevel high-level 516 */ 517 public void setImplements(Access node, int i) { 518 List<Access> list = getImplementsList(); 519 list.setChild(node, i); 520 } 521 /** 522 * Retrieves the child position of the Implements list. 523 * @return The the child position of the Implements list. 524 * @apilevel low-level 525 */ 526 protected int getImplementsListChildPosition() { 527 return 4; 528 } 529 /** 530 * Retrieves the Implements list. 531 * <p><em>This method does not invoke AST transformations.</em></p> 532 * @return The node representing the Implements list. 533 * @apilevel low-level 534 */ 535 public List<Access> getImplementsListNoTransform() { 536 return (List<Access>) getChildNoTransform(4); 537 } 538 /** 539 * Retrieves the Implements list. 540 * @return The node representing the Implements list. 541 * @apilevel high-level 542 */ 543 public List<Access> getImplementss() { 544 return getImplementsList(); 545 } 546 /** 547 * Retrieves the Implements list. 548 * <p><em>This method does not invoke AST transformations.</em></p> 549 * @return The node representing the Implements list. 550 * @apilevel low-level 551 */ 552 public List<Access> getImplementssNoTransform() { 553 return getImplementsListNoTransform(); 554 } 555 /** 556 * @aspect VariableArityParameters 557 * @declaredat /home/jesper/git/extendj/java5/frontend/VariableArityParameters.jrag:127 558 */ 559 560 protected List constructorParameterList(ConstructorDecl decl) { 561 List parameterList = new List(); 562 for (int i = 0; i < decl.getNumParameter(); i++) { 563 ParameterDeclaration param = decl.getParameter(i); 564 if (param instanceof VariableArityParameterDeclaration) { 565 parameterList.add( 566 new VariableArityParameterDeclaration( 567 new Modifiers(new List()), 568 ((ArrayDecl) param.type()).componentType().createBoundAccess(), 569 param.name() 570 )); 571 } else { 572 parameterList.add( 573 new ParameterDeclaration( 574 param.type().createBoundAccess(), 575 param.name() 576 )); 577 } 578 } 579 580 return parameterList; 581 } 582 /** 583 * @apilevel internal 584 */ 585 protected int isCircular_visited = -1; 586 /** 587 * @apilevel internal 588 */ 589 private void isCircular_reset() { 590 isCircular_computed = false; 591 isCircular_initialized = false; 592 isCircular_visited = -1; 593 } 594 /** 595 * @apilevel internal 596 */ 597 protected boolean isCircular_computed = false; 598 /** 599 * @apilevel internal 600 */ 601 protected boolean isCircular_initialized = false; 602 /** 603 * @apilevel internal 604 */ 605 protected boolean isCircular_value; 606 @ASTNodeAnnotation.Attribute 607 public boolean isCircular() { 608 if (isCircular_computed) { 609 return isCircular_value; 610 } 611 ASTNode$State state = state(); 612 boolean new_isCircular_value; 613 if (!isCircular_initialized) { 614 isCircular_initialized = true; 615 isCircular_value = true; 616 } 617 if (!state.IN_CIRCLE) { 618 state.IN_CIRCLE = true; 619 int num = state.boundariesCrossed; 620 boolean isFinal = this.is$Final(); 621 do { 622 isCircular_visited = state.CIRCLE_INDEX; 623 state.CHANGE = false; 624 new_isCircular_value = false; 625 if (new_isCircular_value != isCircular_value) { 626 state.CHANGE = true; 627 } 628 isCircular_value = new_isCircular_value; 629 state.CIRCLE_INDEX++; 630 } while (state.CHANGE); 631 if (isFinal && num == state().boundariesCrossed) { 632 isCircular_computed = true; 633 } else { 634 state.RESET_CYCLE = true; 635 boolean $tmp = false; 636 state.RESET_CYCLE = false; 637 isCircular_computed = false; 638 isCircular_initialized = false; 639 } 640 state.IN_CIRCLE = false; 641 state.INTERMEDIATE_VALUE = false; 642 return isCircular_value; 643 } 644 if (isCircular_visited != state.CIRCLE_INDEX) { 645 isCircular_visited = state.CIRCLE_INDEX; 646 if (state.RESET_CYCLE) { 647 isCircular_computed = false; 648 isCircular_initialized = false; 649 isCircular_visited = -1; 650 return isCircular_value; 651 } 652 new_isCircular_value = false; 653 if (new_isCircular_value != isCircular_value) { 654 state.CHANGE = true; 655 } 656 isCircular_value = new_isCircular_value; 657 state.INTERMEDIATE_VALUE = true; 658 return isCircular_value; 659 } 660 state.INTERMEDIATE_VALUE = true; 661 return isCircular_value; 662 } 663 /** 664 * @apilevel internal 665 */ 666 protected boolean getSuperClassOpt_computed = false; 667 /** 668 * @apilevel internal 669 */ 670 protected Opt getSuperClassOpt_value; 671 /** 672 * @apilevel internal 673 */ 674 private void getSuperClassOpt_reset() { 675 getSuperClassOpt_computed = false; 676 getSuperClassOpt_value = null; 677 } 678 /** 679 * @attribute syn nta 680 * @aspect AnonymousClasses 681 * @declaredat /home/jesper/git/extendj/java4/frontend/AnonymousClasses.jrag:54 682 */ 683 @ASTNodeAnnotation.Attribute 684 public Opt getSuperClassOpt() { 685 ASTNode$State state = state(); 686 if (getSuperClassOpt_computed) { 687 return (Opt) getChild(getSuperClassOptChildPosition()); 688 } 689 boolean intermediate = state.INTERMEDIATE_VALUE; 690 state.INTERMEDIATE_VALUE = false; 691 int num = state.boundariesCrossed; 692 boolean isFinal = this.is$Final(); 693 getSuperClassOpt_value = getSuperClassOpt_compute(); 694 setChild(getSuperClassOpt_value, getSuperClassOptChildPosition()); 695 if (isFinal && num == state().boundariesCrossed) { 696 getSuperClassOpt_computed = true; 697 } else { 698 } 699 state.INTERMEDIATE_VALUE |= intermediate; 700 701 Opt node = (Opt) this.getChild(getSuperClassOptChildPosition()); 702 return node; 703 } 704 /** 705 * @apilevel internal 706 */ 707 private Opt getSuperClassOpt_compute() { 708 if (superType().isInterfaceDecl()) { 709 return new Opt(typeObject().createQualifiedAccess()); 710 } else { 711 return new Opt(superType().createBoundAccess()); 712 } 713 } 714 /** 715 * @apilevel internal 716 */ 717 protected boolean getImplementsList_computed = false; 718 /** 719 * @apilevel internal 720 */ 721 protected List getImplementsList_value; 722 /** 723 * @apilevel internal 724 */ 725 private void getImplementsList_reset() { 726 getImplementsList_computed = false; 727 getImplementsList_value = null; 728 } 729 /** 730 * @attribute syn nta 731 * @aspect AnonymousClasses 732 * @declaredat /home/jesper/git/extendj/java4/frontend/AnonymousClasses.jrag:62 733 */ 734 @ASTNodeAnnotation.Attribute 735 public List getImplementsList() { 736 ASTNode$State state = state(); 737 if (getImplementsList_computed) { 738 return (List) getChild(getImplementsListChildPosition()); 739 } 740 boolean intermediate = state.INTERMEDIATE_VALUE; 741 state.INTERMEDIATE_VALUE = false; 742 int num = state.boundariesCrossed; 743 boolean isFinal = this.is$Final(); 744 getImplementsList_value = getImplementsList_compute(); 745 setChild(getImplementsList_value, getImplementsListChildPosition()); 746 if (isFinal && num == state().boundariesCrossed) { 747 getImplementsList_computed = true; 748 } else { 749 } 750 state.INTERMEDIATE_VALUE |= intermediate; 751 752 List node = (List) this.getChild(getImplementsListChildPosition()); 753 return node; 754 } 755 /** 756 * @apilevel internal 757 */ 758 private List getImplementsList_compute() { 759 if (superType().isInterfaceDecl()) { 760 return new List().add(superType().createBoundAccess()); 761 } else { 762 return new List(); 763 } 764 } 765 /** 766 * @apilevel internal 767 */ 768 protected boolean getImplicitConstructorOpt_computed = false; 769 /** 770 * @apilevel internal 771 */ 772 protected Opt<ConstructorDecl> getImplicitConstructorOpt_value; 773 /** 774 * @apilevel internal 775 */ 776 private void getImplicitConstructorOpt_reset() { 777 getImplicitConstructorOpt_computed = false; 778 getImplicitConstructorOpt_value = null; 779 } 780 /** 781 * @attribute syn nta 782 * @aspect ImplicitConstructor 783 * @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:266 784 */ 785 @ASTNodeAnnotation.Attribute 786 public Opt<ConstructorDecl> getImplicitConstructorOpt() { 787 ASTNode$State state = state(); 788 if (getImplicitConstructorOpt_computed) { 789 return (Opt<ConstructorDecl>) getChild(getImplicitConstructorOptChildPosition()); 790 } 791 boolean intermediate = state.INTERMEDIATE_VALUE; 792 state.INTERMEDIATE_VALUE = false; 793 int num = state.boundariesCrossed; 794 boolean isFinal = this.is$Final(); 795 getImplicitConstructorOpt_value = getImplicitConstructorOpt_compute(); 796 setChild(getImplicitConstructorOpt_value, getImplicitConstructorOptChildPosition()); 797 if (isFinal && num == state().boundariesCrossed) { 798 getImplicitConstructorOpt_computed = true; 799 } else { 800 } 801 state.INTERMEDIATE_VALUE |= intermediate; 802 803 Opt<ConstructorDecl> node = (Opt<ConstructorDecl>) this.getChild(getImplicitConstructorOptChildPosition()); 804 return node; 805 } 806 /** 807 * @apilevel internal 808 */ 809 private Opt<ConstructorDecl> getImplicitConstructorOpt_compute() { 810 if (needsImplicitConstructor()) { 811 ConstructorDecl decl = constructorDecl(); 812 Modifiers modifiers = (Modifiers) decl.getModifiers().treeCopyNoTransform(); 813 String anonName = "Anonymous" + nextAnonymousIndex(); 814 815 ConstructorDecl constructor = new ConstructorDecl(modifiers, anonName, 816 constructorParameterList(decl), new List(), new Opt(), new Block()); 817 818 setID(anonName); 819 820 List argList = new List(); 821 for (int i = 0; i < constructor.getNumParameter(); i++) { 822 argList.add(new VarAccess(constructor.getParameter(i).name())); 823 } 824 825 constructor.setParsedConstructorInvocation( 826 new ExprStmt( 827 new SuperConstructorAccess("super", argList) 828 ) 829 ); 830 831 HashSet set = new HashSet(); 832 833 // add initializer and field declaration exceptions 834 for (int i = 0; i < getNumBodyDecl(); i++) { 835 if (getBodyDecl(i) instanceof InstanceInitializer) { 836 InstanceInitializer init = (InstanceInitializer) getBodyDecl(i); 837 set.addAll(init.exceptions()); 838 } else if (getBodyDecl(i) instanceof FieldDeclaration) { 839 FieldDeclaration f = (FieldDeclaration) getBodyDecl(i); 840 if (f.isInstanceVariable()) { 841 set.addAll(f.exceptions()); 842 } 843 } 844 } 845 846 // add superconstructor exceptions 847 for (int i = 0; i < decl.getNumException(); ++i) { 848 set.add(decl.getException(i).type()); 849 } 850 851 List exceptionList = new List(); 852 for (Iterator iter = set.iterator(); iter.hasNext(); ) { 853 TypeDecl exceptionType = (TypeDecl) iter.next(); 854 if (exceptionType.isNull()) { 855 exceptionType = typeNullPointerException(); 856 } 857 exceptionList.add(exceptionType.createQualifiedAccess()); 858 } 859 constructor.setExceptionList(exceptionList); 860 return new Opt<ConstructorDecl>(constructor); 861 } else { 862 return new Opt<ConstructorDecl>(); 863 } 864 } 865 /** 866 * @attribute syn 867 * @aspect GenerateClassfile 868 * @declaredat /home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag:379 869 */ 870 @ASTNodeAnnotation.Attribute 871 public boolean flush() { 872 boolean flush_value = true; 873 874 return flush_value; 875 } 876 /** 877 * @attribute inh 878 * @aspect AnonymousClasses 879 * @declaredat /home/jesper/git/extendj/java4/frontend/AnonymousClasses.jrag:33 880 */ 881 /** 882 * @attribute inh 883 * @aspect AnonymousClasses 884 * @declaredat /home/jesper/git/extendj/java4/frontend/AnonymousClasses.jrag:33 885 */ 886 @ASTNodeAnnotation.Attribute 887 public TypeDecl superType() { 888 TypeDecl superType_value = getParent().Define_superType(this, null); 889 890 return superType_value; 891 } 892 /** 893 * @attribute inh 894 * @aspect AnonymousClasses 895 * @declaredat /home/jesper/git/extendj/java4/frontend/AnonymousClasses.jrag:37 896 */ 897 /** 898 * @attribute inh 899 * @aspect AnonymousClasses 900 * @declaredat /home/jesper/git/extendj/java4/frontend/AnonymousClasses.jrag:37 901 */ 902 @ASTNodeAnnotation.Attribute 903 public ConstructorDecl constructorDecl() { 904 ConstructorDecl constructorDecl_value = getParent().Define_constructorDecl(this, null); 905 906 return constructorDecl_value; 907 } 908 /** 909 * @attribute inh 910 * @aspect AnonymousClasses 911 * @declaredat /home/jesper/git/extendj/java4/frontend/AnonymousClasses.jrag:95 912 */ 913 /** 914 * @attribute inh 915 * @aspect AnonymousClasses 916 * @declaredat /home/jesper/git/extendj/java4/frontend/AnonymousClasses.jrag:95 917 */ 918 @ASTNodeAnnotation.Attribute 919 public TypeDecl typeNullPointerException() { 920 TypeDecl typeNullPointerException_value = getParent().Define_typeNullPointerException(this, null); 921 922 return typeNullPointerException_value; 923 } 924 /** 925 * @apilevel internal 926 */ 927 public ASTNode rewriteTo() { 928 return super.rewriteTo(); 929 } 930 }