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 * A parameter declaration as used in either method parameter lists 026 * or as a catch clause parameter. 027 * @ast node 028 * @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:88 029 * @production ParameterDeclaration : {@link ASTNode} ::= <span class="component">{@link Modifiers}</span> <span class="component">TypeAccess:{@link Access}</span> <span class="component"><ID:String></span>; 030 031 */ 032 public class ParameterDeclaration extends ASTNode<ASTNode> implements Cloneable, SimpleSet, Iterator, Variable { 033 /** 034 * @aspect DataStructures 035 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:141 036 */ 037 public SimpleSet add(Object o) { 038 return new SimpleSetImpl().add(this).add(o); 039 } 040 /** 041 * @aspect DataStructures 042 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:145 043 */ 044 public boolean isSingleton() { return true; } 045 /** 046 * @aspect DataStructures 047 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:146 048 */ 049 public boolean isSingleton(Object o) { return contains(o); } 050 /** 051 * @aspect DataStructures 052 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:149 053 */ 054 private ParameterDeclaration iterElem; 055 /** 056 * @aspect DataStructures 057 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:150 058 */ 059 public Iterator iterator() { iterElem = this; return this; } 060 /** 061 * @aspect DataStructures 062 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:151 063 */ 064 public boolean hasNext() { return iterElem != null; } 065 /** 066 * @aspect DataStructures 067 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:152 068 */ 069 public Object next() { Object o = iterElem; iterElem = null; return o; } 070 /** 071 * @aspect DataStructures 072 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:153 073 */ 074 public void remove() { throw new UnsupportedOperationException(); } 075 /** 076 * @aspect NodeConstructors 077 * @declaredat /home/jesper/git/extendj/java4/frontend/NodeConstructors.jrag:32 078 */ 079 public ParameterDeclaration(Access type, String name) { 080 this(new Modifiers(new List()), type, name); 081 } 082 /** 083 * @aspect NodeConstructors 084 * @declaredat /home/jesper/git/extendj/java4/frontend/NodeConstructors.jrag:35 085 */ 086 public ParameterDeclaration(TypeDecl type, String name) { 087 this(new Modifiers(new List()), type.createQualifiedAccess(), name); 088 } 089 /** 090 * @aspect Java4PrettyPrint 091 * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:413 092 */ 093 public void prettyPrint(PrettyPrinter out) { 094 out.print(getModifiers()); 095 out.print(getTypeAccess()); 096 out.print(" "); 097 out.print(getID()); 098 } 099 /** 100 * @declaredat ASTNode:1 101 */ 102 public ParameterDeclaration() { 103 super(); 104 } 105 /** 106 * Initializes the child array to the correct size. 107 * Initializes List and Opt nta children. 108 * @apilevel internal 109 * @ast method 110 * @declaredat ASTNode:10 111 */ 112 public void init$Children() { 113 children = new ASTNode[2]; 114 } 115 /** 116 * @declaredat ASTNode:13 117 */ 118 public ParameterDeclaration(Modifiers p0, Access p1, String p2) { 119 setChild(p0, 0); 120 setChild(p1, 1); 121 setID(p2); 122 } 123 /** 124 * @declaredat ASTNode:18 125 */ 126 public ParameterDeclaration(Modifiers p0, Access p1, beaver.Symbol p2) { 127 setChild(p0, 0); 128 setChild(p1, 1); 129 setID(p2); 130 } 131 /** 132 * @apilevel low-level 133 * @declaredat ASTNode:26 134 */ 135 protected int numChildren() { 136 return 2; 137 } 138 /** 139 * @apilevel internal 140 * @declaredat ASTNode:32 141 */ 142 public boolean mayHaveRewrite() { 143 return false; 144 } 145 /** 146 * @apilevel internal 147 * @declaredat ASTNode:38 148 */ 149 public void flushAttrCache() { 150 super.flushAttrCache(); 151 type_reset(); 152 sourceVariableDecl_reset(); 153 throwTypes_reset(); 154 inferredReferenceAccess_TypeAccess_reset(); 155 localNum_reset(); 156 enclosingLambda_reset(); 157 } 158 /** 159 * @apilevel internal 160 * @declaredat ASTNode:50 161 */ 162 public void flushCollectionCache() { 163 super.flushCollectionCache(); 164 } 165 /** 166 * @apilevel internal 167 * @declaredat ASTNode:56 168 */ 169 public void flushRewriteCache() { 170 super.flushRewriteCache(); 171 } 172 /** 173 * @apilevel internal 174 * @declaredat ASTNode:62 175 */ 176 public ParameterDeclaration clone() throws CloneNotSupportedException { 177 ParameterDeclaration node = (ParameterDeclaration) super.clone(); 178 return node; 179 } 180 /** 181 * @apilevel internal 182 * @declaredat ASTNode:69 183 */ 184 public ParameterDeclaration copy() { 185 try { 186 ParameterDeclaration node = (ParameterDeclaration) clone(); 187 node.parent = null; 188 if (children != null) { 189 node.children = (ASTNode[]) children.clone(); 190 } 191 return node; 192 } catch (CloneNotSupportedException e) { 193 throw new Error("Error: clone not supported for " + getClass().getName()); 194 } 195 } 196 /** 197 * Create a deep copy of the AST subtree at this node. 198 * The copy is dangling, i.e. has no parent. 199 * @return dangling copy of the subtree at this node 200 * @apilevel low-level 201 * @deprecated Please use treeCopy or treeCopyNoTransform instead 202 * @declaredat ASTNode:88 203 */ 204 @Deprecated 205 public ParameterDeclaration fullCopy() { 206 return treeCopyNoTransform(); 207 } 208 /** 209 * Create a deep copy of the AST subtree at this node. 210 * The copy is dangling, i.e. has no parent. 211 * @return dangling copy of the subtree at this node 212 * @apilevel low-level 213 * @declaredat ASTNode:98 214 */ 215 public ParameterDeclaration treeCopyNoTransform() { 216 ParameterDeclaration tree = (ParameterDeclaration) copy(); 217 if (children != null) { 218 for (int i = 0; i < children.length; ++i) { 219 ASTNode child = (ASTNode) children[i]; 220 if (child != null) { 221 child = child.treeCopyNoTransform(); 222 tree.setChild(child, i); 223 } 224 } 225 } 226 return tree; 227 } 228 /** 229 * Create a deep copy of the AST subtree at this node. 230 * The subtree of this node is traversed to trigger rewrites before copy. 231 * The copy is dangling, i.e. has no parent. 232 * @return dangling copy of the subtree at this node 233 * @apilevel low-level 234 * @declaredat ASTNode:118 235 */ 236 public ParameterDeclaration treeCopy() { 237 doFullTraversal(); 238 return treeCopyNoTransform(); 239 } 240 /** 241 * @apilevel internal 242 * @declaredat ASTNode:125 243 */ 244 protected boolean is$Equal(ASTNode node) { 245 return super.is$Equal(node) && (tokenString_ID == ((ParameterDeclaration)node).tokenString_ID); 246 } 247 /** 248 * Replaces the Modifiers child. 249 * @param node The new node to replace the Modifiers child. 250 * @apilevel high-level 251 */ 252 public void setModifiers(Modifiers node) { 253 setChild(node, 0); 254 } 255 /** 256 * Retrieves the Modifiers child. 257 * @return The current node used as the Modifiers child. 258 * @apilevel high-level 259 */ 260 @ASTNodeAnnotation.Child(name="Modifiers") 261 public Modifiers getModifiers() { 262 return (Modifiers) getChild(0); 263 } 264 /** 265 * Retrieves the Modifiers child. 266 * <p><em>This method does not invoke AST transformations.</em></p> 267 * @return The current node used as the Modifiers child. 268 * @apilevel low-level 269 */ 270 public Modifiers getModifiersNoTransform() { 271 return (Modifiers) getChildNoTransform(0); 272 } 273 /** 274 * Replaces the TypeAccess child. 275 * @param node The new node to replace the TypeAccess child. 276 * @apilevel high-level 277 */ 278 public void setTypeAccess(Access node) { 279 setChild(node, 1); 280 } 281 /** 282 * Retrieves the TypeAccess child. 283 * @return The current node used as the TypeAccess child. 284 * @apilevel high-level 285 */ 286 @ASTNodeAnnotation.Child(name="TypeAccess") 287 public Access getTypeAccess() { 288 return (Access) getChild(1); 289 } 290 /** 291 * Retrieves the TypeAccess child. 292 * <p><em>This method does not invoke AST transformations.</em></p> 293 * @return The current node used as the TypeAccess child. 294 * @apilevel low-level 295 */ 296 public Access getTypeAccessNoTransform() { 297 return (Access) getChildNoTransform(1); 298 } 299 /** 300 * Replaces the lexeme ID. 301 * @param value The new value for the lexeme ID. 302 * @apilevel high-level 303 */ 304 public void setID(String value) { 305 tokenString_ID = value; 306 } 307 /** 308 * @apilevel internal 309 */ 310 protected String tokenString_ID; 311 /** 312 */ 313 public int IDstart; 314 /** 315 */ 316 public int IDend; 317 /** 318 * JastAdd-internal setter for lexeme ID using the Beaver parser. 319 * @param symbol Symbol containing the new value for the lexeme ID 320 * @apilevel internal 321 */ 322 public void setID(beaver.Symbol symbol) { 323 if (symbol.value != null && !(symbol.value instanceof String)) 324 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 325 tokenString_ID = (String)symbol.value; 326 IDstart = symbol.getStart(); 327 IDend = symbol.getEnd(); 328 } 329 /** 330 * Retrieves the value for the lexeme ID. 331 * @return The value for the lexeme ID. 332 * @apilevel high-level 333 */ 334 @ASTNodeAnnotation.Token(name="ID") 335 public String getID() { 336 return tokenString_ID != null ? tokenString_ID : ""; 337 } 338 /** 339 * @aspect MultiCatch 340 * @declaredat /home/jesper/git/extendj/java7/frontend/MultiCatch.jrag:216 341 */ 342 343 public void refined_MultiCatch_ParameterDeclaration_nameCheck() { 344 SimpleSet decls = outerScope().lookupVariable(name()); 345 for (Iterator iter = decls.iterator(); iter.hasNext(); ) { 346 Variable var = (Variable) iter.next(); 347 if (var instanceof VariableDeclaration) { 348 VariableDeclaration decl = (VariableDeclaration) var; 349 if (decl.enclosingBodyDecl() == enclosingBodyDecl()) { 350 errorf("duplicate declaration of parameter %s", name()); 351 } 352 } else if (var instanceof ParameterDeclaration) { 353 ParameterDeclaration decl = (ParameterDeclaration) var; 354 if (decl.enclosingBodyDecl() == enclosingBodyDecl()) { 355 errorf("duplicate declaration of parameter %s", name()); 356 } 357 } else if (var instanceof CatchParameterDeclaration) { 358 CatchParameterDeclaration decl = (CatchParameterDeclaration) var; 359 if (decl.enclosingBodyDecl() == enclosingBodyDecl()) { 360 errorf("duplicate declaration of parameter %s", name()); 361 } 362 } 363 } 364 365 // 8.4.1 366 if (!lookupVariable(name()).contains(this)) { 367 errorf("duplicate declaration of parameter %s", name()); 368 } 369 } 370 /** 371 * @aspect Java8NameCheck 372 * @declaredat /home/jesper/git/extendj/java8/frontend/NameCheck.jrag:105 373 */ 374 375 public void nameCheck() { 376 SimpleSet decls = outerScope().lookupVariable(name()); 377 for (Iterator iter = decls.iterator(); iter.hasNext(); ) { 378 Variable var = (Variable) iter.next(); 379 if (var instanceof VariableDeclaration) { 380 VariableDeclaration decl = (VariableDeclaration) var; 381 if (decl.enclosingBodyDecl() == enclosingBodyDecl()) { 382 errorf("duplicate declaration of parameter %s", name()); 383 } 384 } else if (var instanceof ParameterDeclaration) { 385 ParameterDeclaration decl = (ParameterDeclaration) var; 386 if (decl.enclosingBodyDecl() == enclosingBodyDecl()) { 387 errorf("duplicate declaration of parameter %s", name()); 388 } 389 } else if (var instanceof InferredParameterDeclaration) { 390 InferredParameterDeclaration decl = (InferredParameterDeclaration) var; 391 if (decl.enclosingBodyDecl() == enclosingBodyDecl()) { 392 errorf("duplicate declaration of parameter %s", name()); 393 } 394 } else if (var instanceof CatchParameterDeclaration) { 395 CatchParameterDeclaration decl = (CatchParameterDeclaration) var; 396 if (decl.enclosingBodyDecl() == enclosingBodyDecl()) { 397 errorf("duplicate declaration of parameter %s", name()); 398 } 399 } 400 } 401 402 // 8.4.1 403 if (!lookupVariable(name()).contains(this)) { 404 errorf("duplicate declaration of parameter %s", name()); 405 } 406 } 407 /** 408 * @attribute syn 409 * @aspect DataStructures 410 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:139 411 */ 412 @ASTNodeAnnotation.Attribute 413 public int size() { 414 int size_value = 1; 415 416 return size_value; 417 } 418 /** 419 * @attribute syn 420 * @aspect DataStructures 421 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:140 422 */ 423 @ASTNodeAnnotation.Attribute 424 public boolean isEmpty() { 425 boolean isEmpty_value = false; 426 427 return isEmpty_value; 428 } 429 /** 430 * @attribute syn 431 * @aspect DataStructures 432 * @declaredat /home/jesper/git/extendj/java4/frontend/DataStructures.jrag:144 433 */ 434 @ASTNodeAnnotation.Attribute 435 public boolean contains(Object o) { 436 boolean contains_Object_value = this == o; 437 438 return contains_Object_value; 439 } 440 /** 441 * @attribute syn 442 * @aspect Modifiers 443 * @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:261 444 */ 445 @ASTNodeAnnotation.Attribute 446 public boolean isSynthetic() { 447 boolean isSynthetic_value = getModifiers().isSynthetic(); 448 449 return isSynthetic_value; 450 } 451 /** 452 * @attribute syn 453 * @aspect PrettyPrintUtil 454 * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag:253 455 */ 456 @ASTNodeAnnotation.Attribute 457 public boolean hasModifiers() { 458 boolean hasModifiers_value = getModifiers().getNumModifier() > 0; 459 460 return hasModifiers_value; 461 } 462 /** 463 * @apilevel internal 464 */ 465 protected boolean type_computed = false; 466 /** 467 * @apilevel internal 468 */ 469 protected TypeDecl type_value; 470 /** 471 * @apilevel internal 472 */ 473 private void type_reset() { 474 type_computed = false; 475 type_value = null; 476 } 477 /** 478 * @attribute syn 479 * @aspect TypeAnalysis 480 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:277 481 */ 482 @ASTNodeAnnotation.Attribute 483 public TypeDecl type() { 484 ASTNode$State state = state(); 485 if (type_computed) { 486 return type_value; 487 } 488 boolean intermediate = state.INTERMEDIATE_VALUE; 489 state.INTERMEDIATE_VALUE = false; 490 int num = state.boundariesCrossed; 491 boolean isFinal = this.is$Final(); 492 type_value = getTypeAccess().type(); 493 if (isFinal && num == state().boundariesCrossed) { 494 type_computed = true; 495 } else { 496 } 497 state.INTERMEDIATE_VALUE |= intermediate; 498 499 return type_value; 500 } 501 /** 502 * @attribute syn 503 * @aspect Variables 504 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:68 505 */ 506 @ASTNodeAnnotation.Attribute 507 public boolean isParameter() { 508 boolean isParameter_value = true; 509 510 return isParameter_value; 511 } 512 /** 513 * @attribute syn 514 * @aspect Variables 515 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:71 516 */ 517 @ASTNodeAnnotation.Attribute 518 public boolean isClassVariable() { 519 boolean isClassVariable_value = false; 520 521 return isClassVariable_value; 522 } 523 /** 524 * @attribute syn 525 * @aspect Variables 526 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:72 527 */ 528 @ASTNodeAnnotation.Attribute 529 public boolean isInstanceVariable() { 530 boolean isInstanceVariable_value = false; 531 532 return isInstanceVariable_value; 533 } 534 /** 535 * @attribute syn 536 * @aspect Variables 537 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:76 538 */ 539 @ASTNodeAnnotation.Attribute 540 public boolean isLocalVariable() { 541 boolean isLocalVariable_value = false; 542 543 return isLocalVariable_value; 544 } 545 /** 546 * @attribute syn 547 * @aspect Variables 548 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:94 549 */ 550 @ASTNodeAnnotation.Attribute 551 public boolean isFinal() { 552 boolean isFinal_value = getModifiers().isFinal(); 553 554 return isFinal_value; 555 } 556 /** 557 * @attribute syn 558 * @aspect Variables 559 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:95 560 */ 561 @ASTNodeAnnotation.Attribute 562 public boolean isVolatile() { 563 boolean isVolatile_value = getModifiers().isVolatile(); 564 565 return isVolatile_value; 566 } 567 /** 568 * @attribute syn 569 * @aspect Variables 570 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:96 571 */ 572 @ASTNodeAnnotation.Attribute 573 public boolean isBlank() { 574 boolean isBlank_value = true; 575 576 return isBlank_value; 577 } 578 /** 579 * @attribute syn 580 * @aspect Variables 581 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:97 582 */ 583 @ASTNodeAnnotation.Attribute 584 public boolean isStatic() { 585 boolean isStatic_value = false; 586 587 return isStatic_value; 588 } 589 /** 590 * @attribute syn 591 * @aspect Variables 592 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:99 593 */ 594 @ASTNodeAnnotation.Attribute 595 public String name() { 596 String name_value = getID(); 597 598 return name_value; 599 } 600 /** 601 * @attribute syn 602 * @aspect Variables 603 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:101 604 */ 605 @ASTNodeAnnotation.Attribute 606 public boolean hasInit() { 607 boolean hasInit_value = false; 608 609 return hasInit_value; 610 } 611 /** 612 * @attribute syn 613 * @aspect Variables 614 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:102 615 */ 616 @ASTNodeAnnotation.Attribute 617 public Expr getInit() { 618 { throw new UnsupportedOperationException(); } 619 } 620 /** 621 * @attribute syn 622 * @aspect Variables 623 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:103 624 */ 625 @ASTNodeAnnotation.Attribute 626 public Constant constant() { 627 { throw new UnsupportedOperationException(); } 628 } 629 /** 630 * @apilevel internal 631 */ 632 protected boolean sourceVariableDecl_computed = false; 633 /** 634 * @apilevel internal 635 */ 636 protected Variable sourceVariableDecl_value; 637 /** 638 * @apilevel internal 639 */ 640 private void sourceVariableDecl_reset() { 641 sourceVariableDecl_computed = false; 642 sourceVariableDecl_value = null; 643 } 644 /** 645 * @attribute syn 646 * @aspect SourceDeclarations 647 * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1637 648 */ 649 @ASTNodeAnnotation.Attribute 650 public Variable sourceVariableDecl() { 651 ASTNode$State state = state(); 652 if (sourceVariableDecl_computed) { 653 return sourceVariableDecl_value; 654 } 655 boolean intermediate = state.INTERMEDIATE_VALUE; 656 state.INTERMEDIATE_VALUE = false; 657 int num = state.boundariesCrossed; 658 boolean isFinal = this.is$Final(); 659 sourceVariableDecl_value = this; 660 if (isFinal && num == state().boundariesCrossed) { 661 sourceVariableDecl_computed = true; 662 } else { 663 } 664 state.INTERMEDIATE_VALUE |= intermediate; 665 666 return sourceVariableDecl_value; 667 } 668 /** 669 * @attribute syn 670 * @aspect VariableArityParameters 671 * @declaredat /home/jesper/git/extendj/java5/frontend/VariableArityParameters.jrag:57 672 */ 673 @ASTNodeAnnotation.Attribute 674 public boolean isVariableArity() { 675 boolean isVariableArity_value = false; 676 677 return isVariableArity_value; 678 } 679 /** 680 * Builds a copy of this ParameterDeclaration node where all occurrences 681 * of type variables in the original type parameter list have been replaced 682 * by the substitution type parameters. 683 * 684 * @return the substituted ParameterDeclaration node 685 * @attribute syn 686 * @aspect Diamond 687 * @declaredat /home/jesper/git/extendj/java7/frontend/Diamond.jrag:347 688 */ 689 @ASTNodeAnnotation.Attribute 690 public ParameterDeclaration substituted(Collection<TypeVariable> original, List<TypeVariable> substitution) { 691 ParameterDeclaration substituted_Collection_TypeVariable__List_TypeVariable__value = new ParameterDeclaration( 692 (Modifiers) getModifiers().treeCopyNoTransform(), 693 getTypeAccess().substituted(original, substitution), 694 getID()); 695 696 return substituted_Collection_TypeVariable__List_TypeVariable__value; 697 } 698 /** 699 * @apilevel internal 700 */ 701 protected boolean throwTypes_computed = false; 702 /** 703 * @apilevel internal 704 */ 705 protected Collection<TypeDecl> throwTypes_value; 706 /** 707 * @apilevel internal 708 */ 709 private void throwTypes_reset() { 710 throwTypes_computed = false; 711 throwTypes_value = null; 712 } 713 /** 714 * @attribute syn 715 * @aspect PreciseRethrow 716 * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:53 717 */ 718 @ASTNodeAnnotation.Attribute 719 public Collection<TypeDecl> throwTypes() { 720 ASTNode$State state = state(); 721 if (throwTypes_computed) { 722 return throwTypes_value; 723 } 724 boolean intermediate = state.INTERMEDIATE_VALUE; 725 state.INTERMEDIATE_VALUE = false; 726 int num = state.boundariesCrossed; 727 boolean isFinal = this.is$Final(); 728 throwTypes_value = throwTypes_compute(); 729 if (isFinal && num == state().boundariesCrossed) { 730 throwTypes_computed = true; 731 } else { 732 } 733 state.INTERMEDIATE_VALUE |= intermediate; 734 735 return throwTypes_value; 736 } 737 /** 738 * @apilevel internal 739 */ 740 private Collection<TypeDecl> throwTypes_compute() { 741 if (isCatchParam() && isEffectivelyFinal()) { 742 // The catch parameter must be final to refine the throw type. 743 return catchClause().caughtExceptions(); 744 } else { 745 return Collections.singleton(type()); 746 } 747 } 748 /** 749 * Note: this attribute deviates from what the JLS says about "effectively final", 750 * simply because the attribute name would be too confusing if it did not return true 751 * when the variable was explicitly declared final. The JLS considers declared final 752 * and effectively final to be mutually exclusive, we don't. 753 * @attribute syn 754 * @aspect PreciseRethrow 755 * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:71 756 */ 757 @ASTNodeAnnotation.Attribute 758 public boolean isEffectivelyFinal() { 759 boolean isEffectivelyFinal_value = isFinal() || !inhModifiedInScope(this); 760 761 return isEffectivelyFinal_value; 762 } 763 /** 764 * @apilevel internal 765 */ 766 protected List inferredReferenceAccess_TypeAccess_list; 767 /** 768 * @apilevel internal 769 */ 770 protected java.util.Map inferredReferenceAccess_TypeAccess_values; 771 /** 772 * @apilevel internal 773 */ 774 private void inferredReferenceAccess_TypeAccess_reset() { 775 inferredReferenceAccess_TypeAccess_values = null; 776 inferredReferenceAccess_TypeAccess_list = null; 777 } 778 /** 779 * @attribute syn 780 * @aspect MethodReference 781 * @declaredat /home/jesper/git/extendj/java8/frontend/MethodReference.jrag:106 782 */ 783 @ASTNodeAnnotation.Attribute 784 public ParTypeAccess inferredReferenceAccess(TypeAccess typeAccess) { 785 Object _parameters = typeAccess; 786 if (inferredReferenceAccess_TypeAccess_values == null) inferredReferenceAccess_TypeAccess_values = new org.jastadd.util.RobustMap(new java.util.HashMap()); 787 ASTNode$State state = state(); 788 if (inferredReferenceAccess_TypeAccess_values.containsKey(_parameters)) { 789 return (ParTypeAccess) inferredReferenceAccess_TypeAccess_values.get(_parameters); 790 } 791 boolean intermediate = state.INTERMEDIATE_VALUE; 792 state.INTERMEDIATE_VALUE = false; 793 int num = state.boundariesCrossed; 794 boolean isFinal = this.is$Final(); 795 ParTypeAccess inferredReferenceAccess_TypeAccess_value = inferredReferenceAccess_compute(typeAccess); 796 if (inferredReferenceAccess_TypeAccess_list == null) { 797 inferredReferenceAccess_TypeAccess_list = new List(); 798 inferredReferenceAccess_TypeAccess_list.is$Final = true; 799 inferredReferenceAccess_TypeAccess_list.setParent(this); 800 } 801 inferredReferenceAccess_TypeAccess_list.add(inferredReferenceAccess_TypeAccess_value); 802 if (inferredReferenceAccess_TypeAccess_value != null) { 803 inferredReferenceAccess_TypeAccess_value = (ParTypeAccess) inferredReferenceAccess_TypeAccess_list.getChild(inferredReferenceAccess_TypeAccess_list.numChildren-1); 804 inferredReferenceAccess_TypeAccess_value.is$Final = true; 805 } 806 if (true) { 807 inferredReferenceAccess_TypeAccess_values.put(_parameters, inferredReferenceAccess_TypeAccess_value); 808 } else { 809 } 810 state.INTERMEDIATE_VALUE |= intermediate; 811 812 return inferredReferenceAccess_TypeAccess_value; 813 } 814 /** 815 * @apilevel internal 816 */ 817 private ParTypeAccess inferredReferenceAccess_compute(TypeAccess typeAccess) { 818 if (!(getTypeAccess() instanceof ParTypeAccess)) { 819 return new ParTypeAccess((TypeAccess) typeAccess.treeCopyNoTransform(), new List<Access>()); 820 } 821 ParTypeAccess parTypeAccess = (ParTypeAccess)getTypeAccess(); 822 return new ParTypeAccess((TypeAccess) typeAccess.treeCopyNoTransform(), 823 (List<Access>) parTypeAccess.getTypeArgumentList().treeCopyNoTransform()); 824 } 825 /** 826 * @attribute inh 827 * @aspect VariableScope 828 * @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:43 829 */ 830 /** 831 * @attribute inh 832 * @aspect VariableScope 833 * @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:43 834 */ 835 @ASTNodeAnnotation.Attribute 836 public SimpleSet lookupVariable(String name) { 837 SimpleSet lookupVariable_String_value = getParent().Define_lookupVariable(this, null, name); 838 839 return lookupVariable_String_value; 840 } 841 /** 842 * @attribute inh 843 * @aspect NameCheck 844 * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:364 845 */ 846 /** 847 * @attribute inh 848 * @aspect NameCheck 849 * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:364 850 */ 851 @ASTNodeAnnotation.Attribute 852 public VariableScope outerScope() { 853 VariableScope outerScope_value = getParent().Define_outerScope(this, null); 854 855 return outerScope_value; 856 } 857 /** 858 * @attribute inh 859 * @aspect NameCheck 860 * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:429 861 */ 862 /** 863 * @attribute inh 864 * @aspect NameCheck 865 * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:429 866 */ 867 @ASTNodeAnnotation.Attribute 868 public BodyDecl enclosingBodyDecl() { 869 BodyDecl enclosingBodyDecl_value = getParent().Define_enclosingBodyDecl(this, null); 870 871 return enclosingBodyDecl_value; 872 } 873 /** 874 * @attribute inh 875 * @aspect NestedTypes 876 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:641 877 */ 878 /** 879 * @attribute inh 880 * @aspect NestedTypes 881 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:641 882 */ 883 @ASTNodeAnnotation.Attribute 884 public TypeDecl hostType() { 885 TypeDecl hostType_value = getParent().Define_hostType(this, null); 886 887 return hostType_value; 888 } 889 /** 890 * @attribute inh 891 * @aspect Variables 892 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:73 893 */ 894 /** 895 * @attribute inh 896 * @aspect Variables 897 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:73 898 */ 899 @ASTNodeAnnotation.Attribute 900 public boolean isMethodParameter() { 901 boolean isMethodParameter_value = getParent().Define_isMethodParameter(this, null); 902 903 return isMethodParameter_value; 904 } 905 /** 906 * @attribute inh 907 * @aspect Variables 908 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:74 909 */ 910 /** 911 * @attribute inh 912 * @aspect Variables 913 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:74 914 */ 915 @ASTNodeAnnotation.Attribute 916 public boolean isConstructorParameter() { 917 boolean isConstructorParameter_value = getParent().Define_isConstructorParameter(this, null); 918 919 return isConstructorParameter_value; 920 } 921 /** 922 * @attribute inh 923 * @aspect Variables 924 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:75 925 */ 926 /** 927 * @attribute inh 928 * @aspect Variables 929 * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:75 930 */ 931 @ASTNodeAnnotation.Attribute 932 public boolean isExceptionHandlerParameter() { 933 boolean isExceptionHandlerParameter_value = getParent().Define_isExceptionHandlerParameter(this, null); 934 935 return isExceptionHandlerParameter_value; 936 } 937 /** 938 * @attribute inh 939 * @aspect LocalNum 940 * @declaredat /home/jesper/git/extendj/java4/backend/LocalNum.jrag:65 941 */ 942 /** 943 * @attribute inh 944 * @aspect LocalNum 945 * @declaredat /home/jesper/git/extendj/java4/backend/LocalNum.jrag:65 946 */ 947 @ASTNodeAnnotation.Attribute 948 public int localNum() { 949 ASTNode$State state = state(); 950 if (localNum_computed) { 951 return localNum_value; 952 } 953 boolean intermediate = state.INTERMEDIATE_VALUE; 954 state.INTERMEDIATE_VALUE = false; 955 int num = state.boundariesCrossed; 956 boolean isFinal = this.is$Final(); 957 localNum_value = getParent().Define_localNum(this, null); 958 if (isFinal && num == state().boundariesCrossed) { 959 localNum_computed = true; 960 } else { 961 } 962 state.INTERMEDIATE_VALUE |= intermediate; 963 964 return localNum_value; 965 } 966 /** 967 * @apilevel internal 968 */ 969 protected boolean localNum_computed = false; 970 /** 971 * @apilevel internal 972 */ 973 protected int localNum_value; 974 /** 975 * @apilevel internal 976 */ 977 private void localNum_reset() { 978 localNum_computed = false; 979 } 980 /** 981 * @return true if the variable var is modified in the local scope 982 * @attribute inh 983 * @aspect PreciseRethrow 984 * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:76 985 */ 986 /** 987 * @return true if the variable var is modified in the local scope 988 * @attribute inh 989 * @aspect PreciseRethrow 990 * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:76 991 */ 992 @ASTNodeAnnotation.Attribute 993 public boolean inhModifiedInScope(Variable var) { 994 boolean inhModifiedInScope_Variable_value = getParent().Define_inhModifiedInScope(this, null, var); 995 996 return inhModifiedInScope_Variable_value; 997 } 998 /** 999 * @return true if this is the parameter declaration of a catch clause 1000 * @attribute inh 1001 * @aspect PreciseRethrow 1002 * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:206 1003 */ 1004 /** 1005 * @return true if this is the parameter declaration of a catch clause 1006 * @attribute inh 1007 * @aspect PreciseRethrow 1008 * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:206 1009 */ 1010 @ASTNodeAnnotation.Attribute 1011 public boolean isCatchParam() { 1012 boolean isCatchParam_value = getParent().Define_isCatchParam(this, null); 1013 1014 return isCatchParam_value; 1015 } 1016 /** 1017 * @attribute inh 1018 * @aspect PreciseRethrow 1019 * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:212 1020 */ 1021 /** 1022 * @attribute inh 1023 * @aspect PreciseRethrow 1024 * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:212 1025 */ 1026 @ASTNodeAnnotation.Attribute 1027 public CatchClause catchClause() { 1028 CatchClause catchClause_value = getParent().Define_catchClause(this, null); 1029 1030 return catchClause_value; 1031 } 1032 /** 1033 * @attribute inh 1034 * @aspect EnclosingLambda 1035 * @declaredat /home/jesper/git/extendj/java8/frontend/EnclosingLambda.jrag:34 1036 */ 1037 /** 1038 * @attribute inh 1039 * @aspect EnclosingLambda 1040 * @declaredat /home/jesper/git/extendj/java8/frontend/EnclosingLambda.jrag:34 1041 */ 1042 @ASTNodeAnnotation.Attribute 1043 public LambdaExpr enclosingLambda() { 1044 ASTNode$State state = state(); 1045 if (enclosingLambda_computed) { 1046 return enclosingLambda_value; 1047 } 1048 boolean intermediate = state.INTERMEDIATE_VALUE; 1049 state.INTERMEDIATE_VALUE = false; 1050 int num = state.boundariesCrossed; 1051 boolean isFinal = this.is$Final(); 1052 enclosingLambda_value = getParent().Define_enclosingLambda(this, null); 1053 if (isFinal && num == state().boundariesCrossed) { 1054 enclosingLambda_computed = true; 1055 } else { 1056 } 1057 state.INTERMEDIATE_VALUE |= intermediate; 1058 1059 return enclosingLambda_value; 1060 } 1061 /** 1062 * @apilevel internal 1063 */ 1064 protected boolean enclosingLambda_computed = false; 1065 /** 1066 * @apilevel internal 1067 */ 1068 protected LambdaExpr enclosingLambda_value; 1069 /** 1070 * @apilevel internal 1071 */ 1072 private void enclosingLambda_reset() { 1073 enclosingLambda_computed = false; 1074 enclosingLambda_value = null; 1075 } 1076 /** 1077 * @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:423 1078 * @apilevel internal 1079 */ 1080 public boolean Define_mayBeFinal(ASTNode caller, ASTNode child) { 1081 if (caller == getModifiersNoTransform()) { 1082 // @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:329 1083 return true; 1084 } 1085 else { 1086 return getParent().Define_mayBeFinal(this, caller); 1087 } 1088 } 1089 protected boolean canDefine_mayBeFinal(ASTNode caller, ASTNode child) { 1090 return true; 1091 } 1092 /** 1093 * @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:96 1094 * @apilevel internal 1095 */ 1096 public boolean Define_mayUseAnnotationTarget(ASTNode caller, ASTNode child, String name) { 1097 if (caller == getModifiersNoTransform()) { 1098 // @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:110 1099 return name.equals("PARAMETER"); 1100 } 1101 else { 1102 return getParent().Define_mayUseAnnotationTarget(this, caller, name); 1103 } 1104 } 1105 protected boolean canDefine_mayUseAnnotationTarget(ASTNode caller, ASTNode child, String name) { 1106 return true; 1107 } 1108 /** 1109 * @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36 1110 * @apilevel internal 1111 */ 1112 public NameType Define_nameType(ASTNode caller, ASTNode child) { 1113 if (caller == getTypeAccessNoTransform()) { 1114 // @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:102 1115 return NameType.TYPE_NAME; 1116 } 1117 else { 1118 return getParent().Define_nameType(this, caller); 1119 } 1120 } 1121 protected boolean canDefine_nameType(ASTNode caller, ASTNode child) { 1122 return true; 1123 } 1124 /** 1125 * @apilevel internal 1126 */ 1127 public ASTNode rewriteTo() { 1128 return super.rewriteTo(); 1129 } 1130 }