001 /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */ 002 package AST; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.*; 007 import beaver.*; 008 import java.util.ArrayList; 009 import java.util.zip.*; 010 import java.io.*; 011 import java.io.FileNotFoundException; 012 import java.util.Collection; 013 /** 014 * @production InterfaceDecl : {@link ReferenceType} ::= <span class="component">{@link Modifiers}</span> <span class="component"><ID:String></span> <span class="component">SuperInterfaceId:{@link Access}*</span> <span class="component">{@link BodyDecl}*</span>; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:67 017 */ 018 public class InterfaceDecl extends ReferenceType implements Cloneable { 019 /** 020 * @apilevel low-level 021 */ 022 public void flushCache() { 023 } 024 /** 025 * @apilevel internal 026 */ 027 public void flushCollectionCache() { 028 } 029 /** 030 * @apilevel internal 031 */ 032 @SuppressWarnings({"unchecked", "cast"}) 033 public InterfaceDecl clone() throws CloneNotSupportedException { 034 InterfaceDecl node = (InterfaceDecl)super.clone(); 035 node.methodsSignatureMap_computed = false; 036 node.methodsSignatureMap_value = null; 037 node.ancestorMethods_String_values = null; 038 node.memberTypes_String_values = null; 039 node.memberFieldsMap_computed = false; 040 node.memberFieldsMap_value = null; 041 node.memberFields_String_values = null; 042 node.isStatic_computed = false; 043 node.castingConversionTo_TypeDecl_values = null; 044 node.instanceOf_TypeDecl_values = null; 045 node.isCircular_visited = -1; 046 node.isCircular_computed = false; 047 node.isCircular_initialized = false; 048 node.typeDescriptor_computed = false; 049 node.typeDescriptor_value = null; 050 node.implementedInterfaces_computed = false; 051 node.implementedInterfaces_value = null; 052 node.subtype_TypeDecl_values = null; 053 node.needsSignatureAttribute_computed = false; 054 node.classSignature_computed = false; 055 node.classSignature_value = null; 056 node.in$Circle(false); 057 node.is$Final(false); 058 return node; 059 } 060 /** 061 * @apilevel internal 062 */ 063 @SuppressWarnings({"unchecked", "cast"}) 064 public InterfaceDecl copy() { 065 066 try { 067 InterfaceDecl node = (InterfaceDecl) clone(); 068 node.parent = null; 069 if(children != null) 070 node.children = (ASTNode[]) children.clone(); 071 072 return node; 073 } catch (CloneNotSupportedException e) { 074 throw new Error("Error: clone not supported for " + getClass().getName()); 075 } 076 077 }/** 078 * Create a deep copy of the AST subtree at this node. 079 * The copy is dangling, i.e. has no parent. 080 * @return dangling copy of the subtree at this node 081 * @apilevel low-level 082 */ 083 @SuppressWarnings({"unchecked", "cast"}) 084 public InterfaceDecl fullCopy() { 085 086 InterfaceDecl tree = (InterfaceDecl) copy(); 087 if (children != null) { 088 for (int i = 0; i < children.length; ++i) { 089 090 ASTNode child = (ASTNode) children[i]; 091 if(child != null) { 092 child = child.fullCopy(); 093 tree.setChild(child, i); 094 } 095 } 096 } 097 return tree; 098 099 } /** 100 * @ast method 101 * @aspect AccessControl 102 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/AccessControl.jrag:167 103 */ 104 public void accessControl() { 105 super.accessControl(); 106 107 if(!isCircular()) { 108 // 9.1.2 109 HashSet set = new HashSet(); 110 for(int i = 0; i < getNumSuperInterfaceId(); i++) { 111 TypeDecl decl = getSuperInterfaceId(i).type(); 112 113 if(!decl.isInterfaceDecl() && !decl.isUnknown()) 114 error("interface " + fullName() + " tries to extend non interface type " + decl.fullName()); 115 if(!decl.isCircular() && !decl.accessibleFrom(this)) 116 error("interface " + fullName() + " can not extend non accessible type " + decl.fullName()); 117 118 if(set.contains(decl)) 119 error("extended interface " + decl.fullName() + " mentionened multiple times in extends clause"); 120 set.add(decl); 121 } 122 } 123 } 124 /** 125 * @ast method 126 * @aspect Modifiers 127 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/Modifiers.jrag:106 128 */ 129 public void checkModifiers() { 130 super.checkModifiers(); 131 } 132 /** 133 * @ast method 134 * @aspect PrettyPrint 135 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:89 136 */ 137 public void toString(StringBuffer s) { 138 s.append(indent()); 139 getModifiers().toString(s); 140 s.append("interface " + name()); 141 if(getNumSuperInterfaceId() > 0) { 142 s.append(" extends "); 143 getSuperInterfaceId(0).toString(s); 144 for(int i = 1; i < getNumSuperInterfaceId(); i++) { 145 s.append(", "); 146 getSuperInterfaceId(i).toString(s); 147 } 148 } 149 ppBodyDecls(s); 150 } 151 /** 152 * @ast method 153 * @aspect SuperClasses 154 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:644 155 */ 156 public Iterator superinterfacesIterator() { 157 return new Iterator() { 158 public boolean hasNext() { 159 computeNextCurrent(); 160 return current != null; 161 } 162 public Object next() { 163 return current; 164 } 165 public void remove() { 166 throw new UnsupportedOperationException(); 167 } 168 private int index = 0; 169 private TypeDecl current = null; 170 private void computeNextCurrent() { 171 current = null; 172 if(isCircular()) return; 173 while(index < getNumSuperInterfaceId()) { 174 TypeDecl typeDecl = getSuperInterfaceId(index++).type(); 175 if(!typeDecl.isCircular() && typeDecl.isInterfaceDecl()) { 176 current = typeDecl; 177 return; 178 } 179 } 180 } 181 }; 182 } 183 /** 184 * @ast method 185 * @aspect TypeHierarchyCheck 186 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeHierarchyCheck.jrag:312 187 */ 188 public void nameCheck() { 189 super.nameCheck(); 190 if(isCircular()) 191 error("circular inheritance dependency in " + typeName()); 192 else { 193 for(int i = 0; i < getNumSuperInterfaceId(); i++) { 194 TypeDecl typeDecl = getSuperInterfaceId(i).type(); 195 if(typeDecl.isCircular()) 196 error("circular inheritance dependency in " + typeName()); 197 } 198 } 199 for(Iterator iter = methodsSignatureMap().values().iterator(); iter.hasNext(); ) { 200 SimpleSet set = (SimpleSet)iter.next(); 201 if(set.size() > 1) { 202 Iterator i2 = set.iterator(); 203 MethodDecl m = (MethodDecl)i2.next(); 204 while(i2.hasNext()) { 205 MethodDecl n = (MethodDecl)i2.next(); 206 if(!n.mayOverrideReturn(m) && !m.mayOverrideReturn(n)) 207 error("multiply inherited methods with the same signature must have the same return type"); 208 } 209 } 210 } 211 } 212 /** 213 * @ast method 214 * @aspect GenerateClassfile 215 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/GenerateClassfile.jrag:142 216 */ 217 public void generateClassfile() { 218 super.generateClassfile(); 219 String fileName = destinationPath() + File.separator + constantPoolName() + ".class"; 220 if(options().verbose()) System.out.println("Writing class file to " + fileName); 221 try { 222 ConstantPool cp = constantPool(); 223 // force building of constant pool 224 cp.addClass(constantPoolName()); 225 cp.addClass("java/lang/Object"); 226 for(int i = 0; i < getNumSuperInterfaceId(); i++) { 227 cp.addClass(getSuperInterfaceId(i).type().constantPoolName()); 228 } 229 for(Iterator iter = bcFields().iterator(); iter.hasNext(); ) { 230 FieldDeclaration field = (FieldDeclaration) iter.next(); 231 cp.addUtf8(field.name()); 232 cp.addUtf8(field.type().typeDescriptor()); 233 field.attributes(); 234 } 235 for(Iterator iter = bcMethods().iterator(); iter.hasNext(); ) { 236 Object obj = iter.next(); 237 if(obj instanceof MethodDecl) { 238 MethodDecl m = (MethodDecl) obj; 239 cp.addUtf8(m.name()); 240 cp.addUtf8(m.descName()); 241 m.attributes(); 242 } 243 } 244 attributes(); 245 246 if(hasClinit()) { 247 cp.addUtf8("<clinit>"); 248 cp.addUtf8("()V"); 249 clinit_attributes(); 250 } 251 252 // actual classfile generation 253 File dest = new File(fileName); 254 File parentFile = dest.getParentFile(); 255 if(parentFile != null) 256 parentFile.mkdirs(); 257 258 FileOutputStream f = new FileOutputStream(fileName); 259 DataOutputStream out = new DataOutputStream(new BufferedOutputStream(f)); 260 out.writeInt(magicHeader()); 261 out.writeChar(minorVersion()); 262 out.writeChar(majorVersion()); 263 cp.emit(out); 264 int flags = flags(); 265 if(isNestedType()) 266 flags = mangledFlags(flags); 267 if(isInterfaceDecl()) 268 flags |= Modifiers.ACC_INTERFACE; 269 out.writeChar(flags); 270 out.writeChar(cp.addClass(constantPoolName())); 271 out.writeChar(cp.addClass("java/lang/Object")); 272 if(getNumSuperInterfaceId() == 1 && getSuperInterfaceId(0).type().isObject()) 273 out.writeChar(0); 274 else 275 out.writeChar(getNumSuperInterfaceId()); 276 for(int i = 0; i < getNumSuperInterfaceId(); i++) { 277 TypeDecl typeDecl = getSuperInterfaceId(i).type(); 278 if(typeDecl.isInterfaceDecl()) 279 out.writeChar(cp.addClass(typeDecl.constantPoolName())); 280 } 281 Collection fields = bcFields(); 282 out.writeChar(fields.size()); 283 for(Iterator iter = fields.iterator(); iter.hasNext(); ) { 284 FieldDeclaration field = (FieldDeclaration) iter.next(); 285 out.writeChar(field.flags()); 286 out.writeChar(cp.addUtf8(field.name())); 287 out.writeChar(cp.addUtf8(field.type().typeDescriptor())); 288 out.writeChar(field.attributes().size()); 289 for(Iterator itera = field.attributes().iterator(); itera.hasNext();) 290 ((Attribute)itera.next()).emit(out); 291 } 292 Collection methods = bcMethods(); 293 out.writeChar(methods.size() + (hasClinit() ? 1 : 0)); 294 for(Iterator iter = methods.iterator(); iter.hasNext(); ) { 295 BodyDecl b = (BodyDecl)iter.next(); 296 b.generateMethod(out, cp); 297 } 298 if(hasClinit()) { 299 out.writeChar(Modifiers.ACC_STATIC); 300 out.writeChar(cp.addUtf8("<clinit>")); 301 out.writeChar(cp.addUtf8("()V")); 302 out.writeChar(clinit_attributes().size()); 303 for(Iterator itera = clinit_attributes().iterator(); itera.hasNext();) 304 ((Attribute)itera.next()).emit(out); 305 } 306 out.writeChar(attributes().size()); 307 for(Iterator itera = attributes().iterator(); itera.hasNext();) 308 ((Attribute)itera.next()).emit(out); 309 310 out.close(); 311 } catch (IOException e) { 312 e.printStackTrace(); 313 } 314 } 315 /** 316 * @ast method 317 * @aspect Java2Rewrites 318 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/Java2Rewrites.jrag:95 319 */ 320 public FieldDeclaration createStaticClassField(String name) { 321 return methodHolder().createStaticClassField(name); 322 } 323 /** 324 * @ast method 325 * @aspect Java2Rewrites 326 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/Java2Rewrites.jrag:98 327 */ 328 public MethodDecl createStaticClassMethod() { 329 return methodHolder().createStaticClassMethod(); 330 } 331 /** 332 * @ast method 333 * @aspect Java2Rewrites 334 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/Java2Rewrites.jrag:102 335 */ 336 337 // create anonymous class to delegate to 338 private TypeDecl methodHolder = null; 339 /** 340 * @ast method 341 * @aspect Java2Rewrites 342 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/Java2Rewrites.jrag:103 343 */ 344 public TypeDecl methodHolder() { 345 if(methodHolder != null) 346 return methodHolder; 347 String name = "$" + nextAnonymousIndex(); 348 ClassDecl c = addMemberClass(new ClassDecl( 349 new Modifiers(new List()), 350 name, 351 new Opt(), 352 new List(), 353 new List() 354 )); 355 methodHolder = c; 356 return c; 357 } 358 /** 359 * @ast method 360 * @aspect Generics 361 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:213 362 */ 363 public TypeDecl makeGeneric(Signatures.ClassSignature s) { 364 if(s.hasFormalTypeParameters()) { 365 ASTNode node = getParent(); 366 int index = node.getIndexOfChild(this); 367 node.setChild( 368 new GenericInterfaceDecl( 369 getModifiersNoTransform(), 370 getID(), 371 s.hasSuperinterfaceSignature() ? s.superinterfaceSignature() : getSuperInterfaceIdListNoTransform(), 372 getBodyDeclListNoTransform(), 373 s.typeParameters() 374 ), 375 index 376 ); 377 return (TypeDecl)node.getChildNoTransform(index); 378 } 379 else { 380 if(s.hasSuperinterfaceSignature()) 381 setSuperInterfaceIdList(s.superinterfaceSignature()); 382 return this; 383 } 384 } 385 /** 386 * @ast method 387 * @aspect LookupParTypeDecl 388 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1336 389 */ 390 public InterfaceDecl substitutedInterfaceDecl(Parameterization parTypeDecl) { 391 InterfaceDecl c = new InterfaceDeclSubstituted( 392 (Modifiers)getModifiers().fullCopy(), 393 getID(), 394 getSuperInterfaceIdList().substitute(parTypeDecl), 395 // ES: new List(), 396 this 397 ); 398 return c; 399 } 400 /** 401 * @ast method 402 * 403 */ 404 public InterfaceDecl() { 405 super(); 406 407 408 } 409 /** 410 * Initializes the child array to the correct size. 411 * Initializes List and Opt nta children. 412 * @apilevel internal 413 * @ast method 414 * @ast method 415 * 416 */ 417 public void init$Children() { 418 children = new ASTNode[3]; 419 setChild(new List(), 1); 420 setChild(new List(), 2); 421 } 422 /** 423 * @ast method 424 * 425 */ 426 public InterfaceDecl(Modifiers p0, String p1, List<Access> p2, List<BodyDecl> p3) { 427 setChild(p0, 0); 428 setID(p1); 429 setChild(p2, 1); 430 setChild(p3, 2); 431 } 432 /** 433 * @ast method 434 * 435 */ 436 public InterfaceDecl(Modifiers p0, beaver.Symbol p1, List<Access> p2, List<BodyDecl> p3) { 437 setChild(p0, 0); 438 setID(p1); 439 setChild(p2, 1); 440 setChild(p3, 2); 441 } 442 /** 443 * @apilevel low-level 444 * @ast method 445 * 446 */ 447 protected int numChildren() { 448 return 3; 449 } 450 /** 451 * @apilevel internal 452 * @ast method 453 * 454 */ 455 public boolean mayHaveRewrite() { 456 return false; 457 } 458 /** 459 * Replaces the Modifiers child. 460 * @param node The new node to replace the Modifiers child. 461 * @apilevel high-level 462 * @ast method 463 * 464 */ 465 public void setModifiers(Modifiers node) { 466 setChild(node, 0); 467 } 468 /** 469 * Retrieves the Modifiers child. 470 * @return The current node used as the Modifiers child. 471 * @apilevel high-level 472 * @ast method 473 * 474 */ 475 public Modifiers getModifiers() { 476 return (Modifiers)getChild(0); 477 } 478 /** 479 * Retrieves the Modifiers child. 480 * <p><em>This method does not invoke AST transformations.</em></p> 481 * @return The current node used as the Modifiers child. 482 * @apilevel low-level 483 * @ast method 484 * 485 */ 486 public Modifiers getModifiersNoTransform() { 487 return (Modifiers)getChildNoTransform(0); 488 } 489 /** 490 * Replaces the lexeme ID. 491 * @param value The new value for the lexeme ID. 492 * @apilevel high-level 493 * @ast method 494 * 495 */ 496 public void setID(String value) { 497 tokenString_ID = value; 498 } 499 /** 500 * JastAdd-internal setter for lexeme ID using the Beaver parser. 501 * @apilevel internal 502 * @ast method 503 * 504 */ 505 public void setID(beaver.Symbol symbol) { 506 if(symbol.value != null && !(symbol.value instanceof String)) 507 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 508 tokenString_ID = (String)symbol.value; 509 IDstart = symbol.getStart(); 510 IDend = symbol.getEnd(); 511 } 512 /** 513 * Retrieves the value for the lexeme ID. 514 * @return The value for the lexeme ID. 515 * @apilevel high-level 516 * @ast method 517 * 518 */ 519 public String getID() { 520 return tokenString_ID != null ? tokenString_ID : ""; 521 } 522 /** 523 * Replaces the SuperInterfaceId list. 524 * @param list The new list node to be used as the SuperInterfaceId list. 525 * @apilevel high-level 526 * @ast method 527 * 528 */ 529 public void setSuperInterfaceIdList(List<Access> list) { 530 setChild(list, 1); 531 } 532 /** 533 * Retrieves the number of children in the SuperInterfaceId list. 534 * @return Number of children in the SuperInterfaceId list. 535 * @apilevel high-level 536 * @ast method 537 * 538 */ 539 public int getNumSuperInterfaceId() { 540 return getSuperInterfaceIdList().getNumChild(); 541 } 542 /** 543 * Retrieves the number of children in the SuperInterfaceId list. 544 * Calling this method will not trigger rewrites.. 545 * @return Number of children in the SuperInterfaceId list. 546 * @apilevel low-level 547 * @ast method 548 * 549 */ 550 public int getNumSuperInterfaceIdNoTransform() { 551 return getSuperInterfaceIdListNoTransform().getNumChildNoTransform(); 552 } 553 /** 554 * Retrieves the element at index {@code i} in the SuperInterfaceId list.. 555 * @param i Index of the element to return. 556 * @return The element at position {@code i} in the SuperInterfaceId list. 557 * @apilevel high-level 558 * @ast method 559 * 560 */ 561 @SuppressWarnings({"unchecked", "cast"}) 562 public Access getSuperInterfaceId(int i) { 563 return (Access)getSuperInterfaceIdList().getChild(i); 564 } 565 /** 566 * Append an element to the SuperInterfaceId list. 567 * @param node The element to append to the SuperInterfaceId list. 568 * @apilevel high-level 569 * @ast method 570 * 571 */ 572 public void addSuperInterfaceId(Access node) { 573 List<Access> list = (parent == null || state == null) ? getSuperInterfaceIdListNoTransform() : getSuperInterfaceIdList(); 574 list.addChild(node); 575 } 576 /** 577 * @apilevel low-level 578 * @ast method 579 * 580 */ 581 public void addSuperInterfaceIdNoTransform(Access node) { 582 List<Access> list = getSuperInterfaceIdListNoTransform(); 583 list.addChild(node); 584 } 585 /** 586 * Replaces the SuperInterfaceId list element at index {@code i} with the new node {@code node}. 587 * @param node The new node to replace the old list element. 588 * @param i The list index of the node to be replaced. 589 * @apilevel high-level 590 * @ast method 591 * 592 */ 593 public void setSuperInterfaceId(Access node, int i) { 594 List<Access> list = getSuperInterfaceIdList(); 595 list.setChild(node, i); 596 } 597 /** 598 * Retrieves the SuperInterfaceId list. 599 * @return The node representing the SuperInterfaceId list. 600 * @apilevel high-level 601 * @ast method 602 * 603 */ 604 public List<Access> getSuperInterfaceIds() { 605 return getSuperInterfaceIdList(); 606 } 607 /** 608 * Retrieves the SuperInterfaceId list. 609 * <p><em>This method does not invoke AST transformations.</em></p> 610 * @return The node representing the SuperInterfaceId list. 611 * @apilevel low-level 612 * @ast method 613 * 614 */ 615 public List<Access> getSuperInterfaceIdsNoTransform() { 616 return getSuperInterfaceIdListNoTransform(); 617 } 618 /** 619 * Retrieves the SuperInterfaceId list. 620 * @return The node representing the SuperInterfaceId list. 621 * @apilevel high-level 622 * @ast method 623 * 624 */ 625 @SuppressWarnings({"unchecked", "cast"}) 626 public List<Access> getSuperInterfaceIdList() { 627 List<Access> list = (List<Access>)getChild(1); 628 list.getNumChild(); 629 return list; 630 } 631 /** 632 * Retrieves the SuperInterfaceId list. 633 * <p><em>This method does not invoke AST transformations.</em></p> 634 * @return The node representing the SuperInterfaceId list. 635 * @apilevel low-level 636 * @ast method 637 * 638 */ 639 @SuppressWarnings({"unchecked", "cast"}) 640 public List<Access> getSuperInterfaceIdListNoTransform() { 641 return (List<Access>)getChildNoTransform(1); 642 } 643 /** 644 * Replaces the BodyDecl list. 645 * @param list The new list node to be used as the BodyDecl list. 646 * @apilevel high-level 647 * @ast method 648 * 649 */ 650 public void setBodyDeclList(List<BodyDecl> list) { 651 setChild(list, 2); 652 } 653 /** 654 * Retrieves the number of children in the BodyDecl list. 655 * @return Number of children in the BodyDecl list. 656 * @apilevel high-level 657 * @ast method 658 * 659 */ 660 public int getNumBodyDecl() { 661 return getBodyDeclList().getNumChild(); 662 } 663 /** 664 * Retrieves the number of children in the BodyDecl list. 665 * Calling this method will not trigger rewrites.. 666 * @return Number of children in the BodyDecl list. 667 * @apilevel low-level 668 * @ast method 669 * 670 */ 671 public int getNumBodyDeclNoTransform() { 672 return getBodyDeclListNoTransform().getNumChildNoTransform(); 673 } 674 /** 675 * Retrieves the element at index {@code i} in the BodyDecl list.. 676 * @param i Index of the element to return. 677 * @return The element at position {@code i} in the BodyDecl list. 678 * @apilevel high-level 679 * @ast method 680 * 681 */ 682 @SuppressWarnings({"unchecked", "cast"}) 683 public BodyDecl getBodyDecl(int i) { 684 return (BodyDecl)getBodyDeclList().getChild(i); 685 } 686 /** 687 * Append an element to the BodyDecl list. 688 * @param node The element to append to the BodyDecl list. 689 * @apilevel high-level 690 * @ast method 691 * 692 */ 693 public void addBodyDecl(BodyDecl node) { 694 List<BodyDecl> list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); 695 list.addChild(node); 696 } 697 /** 698 * @apilevel low-level 699 * @ast method 700 * 701 */ 702 public void addBodyDeclNoTransform(BodyDecl node) { 703 List<BodyDecl> list = getBodyDeclListNoTransform(); 704 list.addChild(node); 705 } 706 /** 707 * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. 708 * @param node The new node to replace the old list element. 709 * @param i The list index of the node to be replaced. 710 * @apilevel high-level 711 * @ast method 712 * 713 */ 714 public void setBodyDecl(BodyDecl node, int i) { 715 List<BodyDecl> list = getBodyDeclList(); 716 list.setChild(node, i); 717 } 718 /** 719 * Retrieves the BodyDecl list. 720 * @return The node representing the BodyDecl list. 721 * @apilevel high-level 722 * @ast method 723 * 724 */ 725 public List<BodyDecl> getBodyDecls() { 726 return getBodyDeclList(); 727 } 728 /** 729 * Retrieves the BodyDecl list. 730 * <p><em>This method does not invoke AST transformations.</em></p> 731 * @return The node representing the BodyDecl list. 732 * @apilevel low-level 733 * @ast method 734 * 735 */ 736 public List<BodyDecl> getBodyDeclsNoTransform() { 737 return getBodyDeclListNoTransform(); 738 } 739 /** 740 * Retrieves the BodyDecl list. 741 * @return The node representing the BodyDecl list. 742 * @apilevel high-level 743 * @ast method 744 * 745 */ 746 @SuppressWarnings({"unchecked", "cast"}) 747 public List<BodyDecl> getBodyDeclList() { 748 List<BodyDecl> list = (List<BodyDecl>)getChild(2); 749 list.getNumChild(); 750 return list; 751 } 752 /** 753 * Retrieves the BodyDecl list. 754 * <p><em>This method does not invoke AST transformations.</em></p> 755 * @return The node representing the BodyDecl list. 756 * @apilevel low-level 757 * @ast method 758 * 759 */ 760 @SuppressWarnings({"unchecked", "cast"}) 761 public List<BodyDecl> getBodyDeclListNoTransform() { 762 return (List<BodyDecl>)getChildNoTransform(2); 763 } 764 /** 765 * @ast method 766 * @aspect Generics 767 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:73 768 */ 769 private boolean refined_Generics_InterfaceDecl_castingConversionTo_TypeDecl(TypeDecl type) 770 { 771 TypeDecl S = this; 772 TypeDecl T = type; 773 if(T.isArrayDecl()) 774 return T.instanceOf(S); 775 else if(T.isReferenceType() && !T.isFinal()) { 776 return true; 777 } 778 else { 779 return T.instanceOf(S); 780 } 781 } 782 /** 783 * @attribute syn 784 * @aspect ConstructScope 785 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupConstructor.jrag:21 786 */ 787 public Collection lookupSuperConstructor() { 788 ASTNode$State state = state(); 789 try { return typeObject().constructors(); } 790 finally { 791 } 792 } 793 /** 794 * @apilevel internal 795 */ 796 protected boolean methodsSignatureMap_computed = false; 797 /** 798 * @apilevel internal 799 */ 800 protected HashMap methodsSignatureMap_value; 801 /** 802 * @attribute syn 803 * @aspect MethodSignature15 804 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/MethodSignature.jrag:387 805 */ 806 @SuppressWarnings({"unchecked", "cast"}) 807 public HashMap methodsSignatureMap() { 808 if(methodsSignatureMap_computed) { 809 return methodsSignatureMap_value; 810 } 811 ASTNode$State state = state(); 812 int num = state.boundariesCrossed; 813 boolean isFinal = this.is$Final(); 814 methodsSignatureMap_value = methodsSignatureMap_compute(); 815 if(isFinal && num == state().boundariesCrossed){ methodsSignatureMap_computed = true; } 816 return methodsSignatureMap_value; 817 } 818 /** 819 * @apilevel internal 820 */ 821 private HashMap methodsSignatureMap_compute() { 822 HashMap map = new HashMap(localMethodsSignatureMap()); 823 for(Iterator outerIter = superinterfacesIterator(); outerIter.hasNext(); ) { 824 TypeDecl typeDecl = (TypeDecl)outerIter.next(); 825 for(Iterator iter = typeDecl.methodsIterator(); iter.hasNext(); ) { 826 MethodDecl m = (MethodDecl)iter.next(); 827 if(!m.isPrivate() && m.accessibleFrom(this) && !localMethodsSignatureMap().containsKey(m.signature())) 828 if(!(m instanceof MethodDeclSubstituted) || !localMethodsSignatureMap().containsKey(m.sourceMethodDecl().signature())) 829 putSimpleSetElement(map, m.signature(), m); 830 } 831 } 832 for(Iterator iter = typeObject().methodsIterator(); iter.hasNext(); ) { 833 MethodDecl m = (MethodDecl)iter.next(); 834 if(m.isPublic() && !map.containsKey(m.signature())) 835 putSimpleSetElement(map, m.signature(), m); 836 } 837 return map; 838 } 839 protected java.util.Map ancestorMethods_String_values; 840 /** 841 * @attribute syn 842 * @aspect AncestorMethods 843 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupMethod.jrag:414 844 */ 845 @SuppressWarnings({"unchecked", "cast"}) 846 public SimpleSet ancestorMethods(String signature) { 847 Object _parameters = signature; 848 if(ancestorMethods_String_values == null) ancestorMethods_String_values = new java.util.HashMap(4); 849 if(ancestorMethods_String_values.containsKey(_parameters)) { 850 return (SimpleSet)ancestorMethods_String_values.get(_parameters); 851 } 852 ASTNode$State state = state(); 853 int num = state.boundariesCrossed; 854 boolean isFinal = this.is$Final(); 855 SimpleSet ancestorMethods_String_value = ancestorMethods_compute(signature); 856 if(isFinal && num == state().boundariesCrossed){ ancestorMethods_String_values.put(_parameters, ancestorMethods_String_value); } 857 return ancestorMethods_String_value; 858 } 859 /** 860 * @apilevel internal 861 */ 862 private SimpleSet ancestorMethods_compute(String signature) { 863 SimpleSet set = SimpleSet.emptySet; 864 for(Iterator outerIter = superinterfacesIterator(); outerIter.hasNext(); ) { 865 TypeDecl typeDecl = (TypeDecl)outerIter.next(); 866 for(Iterator iter = typeDecl.methodsSignature(signature).iterator(); iter.hasNext(); ) { 867 MethodDecl m = (MethodDecl)iter.next(); 868 set = set.add(m); 869 } 870 } 871 if(!superinterfacesIterator().hasNext()) { 872 for(Iterator iter = typeObject().methodsSignature(signature).iterator(); iter.hasNext(); ) { 873 MethodDecl m = (MethodDecl)iter.next(); 874 if(m.isPublic()) 875 set = set.add(m); 876 } 877 } 878 return set; 879 } 880 protected java.util.Map memberTypes_String_values; 881 /** 882 * @attribute syn 883 * @aspect TypeScopePropagation 884 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupType.jrag:520 885 */ 886 @SuppressWarnings({"unchecked", "cast"}) 887 public SimpleSet memberTypes(String name) { 888 Object _parameters = name; 889 if(memberTypes_String_values == null) memberTypes_String_values = new java.util.HashMap(4); 890 if(memberTypes_String_values.containsKey(_parameters)) { 891 return (SimpleSet)memberTypes_String_values.get(_parameters); 892 } 893 ASTNode$State state = state(); 894 int num = state.boundariesCrossed; 895 boolean isFinal = this.is$Final(); 896 SimpleSet memberTypes_String_value = memberTypes_compute(name); 897 if(isFinal && num == state().boundariesCrossed){ memberTypes_String_values.put(_parameters, memberTypes_String_value); } 898 return memberTypes_String_value; 899 } 900 /** 901 * @apilevel internal 902 */ 903 private SimpleSet memberTypes_compute(String name) { 904 SimpleSet set = localTypeDecls(name); 905 if(!set.isEmpty()) return set; 906 for(Iterator outerIter = superinterfacesIterator(); outerIter.hasNext(); ) { 907 TypeDecl typeDecl = (TypeDecl)outerIter.next(); 908 for(Iterator iter = typeDecl.memberTypes(name).iterator(); iter.hasNext(); ) { 909 TypeDecl decl = (TypeDecl)iter.next(); 910 if(!decl.isPrivate()) 911 set = set.add(decl); 912 } 913 } 914 return set; 915 } 916 /** 917 * @apilevel internal 918 */ 919 protected boolean memberFieldsMap_computed = false; 920 /** 921 * @apilevel internal 922 */ 923 protected HashMap memberFieldsMap_value; 924 /** 925 * @attribute syn 926 * @aspect Fields 927 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:302 928 */ 929 @SuppressWarnings({"unchecked", "cast"}) 930 public HashMap memberFieldsMap() { 931 if(memberFieldsMap_computed) { 932 return memberFieldsMap_value; 933 } 934 ASTNode$State state = state(); 935 int num = state.boundariesCrossed; 936 boolean isFinal = this.is$Final(); 937 memberFieldsMap_value = memberFieldsMap_compute(); 938 if(isFinal && num == state().boundariesCrossed){ memberFieldsMap_computed = true; } 939 return memberFieldsMap_value; 940 } 941 /** 942 * @apilevel internal 943 */ 944 private HashMap memberFieldsMap_compute() { 945 HashMap map = new HashMap(localFieldsMap()); 946 for(Iterator outerIter = superinterfacesIterator(); outerIter.hasNext(); ) { 947 TypeDecl typeDecl = (TypeDecl)outerIter.next(); 948 for(Iterator iter = typeDecl.fieldsIterator(); iter.hasNext(); ) { 949 FieldDeclaration f = (FieldDeclaration)iter.next(); 950 if(f.accessibleFrom(this) && !f.isPrivate() && !localFieldsMap().containsKey(f.name())) { 951 putSimpleSetElement(map, f.name(), f); 952 } 953 } 954 } 955 return map; 956 } 957 protected java.util.Map memberFields_String_values; 958 /** 959 * @attribute syn 960 * @aspect Fields 961 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:356 962 */ 963 @SuppressWarnings({"unchecked", "cast"}) 964 public SimpleSet memberFields(String name) { 965 Object _parameters = name; 966 if(memberFields_String_values == null) memberFields_String_values = new java.util.HashMap(4); 967 if(memberFields_String_values.containsKey(_parameters)) { 968 return (SimpleSet)memberFields_String_values.get(_parameters); 969 } 970 ASTNode$State state = state(); 971 int num = state.boundariesCrossed; 972 boolean isFinal = this.is$Final(); 973 SimpleSet memberFields_String_value = memberFields_compute(name); 974 if(isFinal && num == state().boundariesCrossed){ memberFields_String_values.put(_parameters, memberFields_String_value); } 975 return memberFields_String_value; 976 } 977 /** 978 * @apilevel internal 979 */ 980 private SimpleSet memberFields_compute(String name) { 981 SimpleSet fields = localFields(name); 982 if(!fields.isEmpty()) 983 return fields; 984 for(Iterator outerIter = superinterfacesIterator(); outerIter.hasNext(); ) { 985 TypeDecl typeDecl = (TypeDecl)outerIter.next(); 986 for(Iterator iter = typeDecl.memberFields(name).iterator(); iter.hasNext(); ) { 987 FieldDeclaration f = (FieldDeclaration)iter.next(); 988 if(f.accessibleFrom(this) && !f.isPrivate()) { 989 fields = fields.add(f); 990 } 991 } 992 } 993 return fields; 994 } 995 /** 996 * @attribute syn 997 * @aspect Modifiers 998 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/Modifiers.jrag:204 999 */ 1000 public boolean isAbstract() { 1001 ASTNode$State state = state(); 1002 try { return true; } 1003 finally { 1004 } 1005 } 1006 /** 1007 * @apilevel internal 1008 */ 1009 protected boolean isStatic_computed = false; 1010 /** 1011 * @apilevel internal 1012 */ 1013 protected boolean isStatic_value; 1014 /** 1015 * @attribute syn 1016 * @aspect Modifiers 1017 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/Modifiers.jrag:208 1018 */ 1019 @SuppressWarnings({"unchecked", "cast"}) 1020 public boolean isStatic() { 1021 if(isStatic_computed) { 1022 return isStatic_value; 1023 } 1024 ASTNode$State state = state(); 1025 int num = state.boundariesCrossed; 1026 boolean isFinal = this.is$Final(); 1027 isStatic_value = isStatic_compute(); 1028 if(isFinal && num == state().boundariesCrossed){ isStatic_computed = true; } 1029 return isStatic_value; 1030 } 1031 /** 1032 * @apilevel internal 1033 */ 1034 private boolean isStatic_compute() { return getModifiers().isStatic() || isMemberType(); } 1035 protected java.util.Map castingConversionTo_TypeDecl_values; 1036 /** 1037 * @attribute syn 1038 * @aspect AutoBoxing 1039 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/AutoBoxing.jrag:148 1040 */ 1041 @SuppressWarnings({"unchecked", "cast"}) 1042 public boolean castingConversionTo(TypeDecl type) { 1043 Object _parameters = type; 1044 if(castingConversionTo_TypeDecl_values == null) castingConversionTo_TypeDecl_values = new java.util.HashMap(4); 1045 if(castingConversionTo_TypeDecl_values.containsKey(_parameters)) { 1046 return ((Boolean)castingConversionTo_TypeDecl_values.get(_parameters)).booleanValue(); 1047 } 1048 ASTNode$State state = state(); 1049 int num = state.boundariesCrossed; 1050 boolean isFinal = this.is$Final(); 1051 boolean castingConversionTo_TypeDecl_value = castingConversionTo_compute(type); 1052 if(isFinal && num == state().boundariesCrossed){ castingConversionTo_TypeDecl_values.put(_parameters, Boolean.valueOf(castingConversionTo_TypeDecl_value)); } 1053 return castingConversionTo_TypeDecl_value; 1054 } 1055 /** 1056 * @apilevel internal 1057 */ 1058 private boolean castingConversionTo_compute(TypeDecl type) { 1059 if(refined_Generics_InterfaceDecl_castingConversionTo_TypeDecl(type)) 1060 return true; 1061 boolean canUnboxThis = !unboxed().isUnknown(); 1062 boolean canUnboxType = !type.unboxed().isUnknown(); 1063 if(canUnboxThis && !canUnboxType) 1064 return unboxed().wideningConversionTo(type); 1065 return false; 1066 /* 1067 else if(unboxingConversionTo(type)) 1068 return true; 1069 return false; 1070 */ 1071 } 1072 /** 1073 * @attribute syn 1074 * @aspect TypeAnalysis 1075 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:211 1076 */ 1077 public boolean isInterfaceDecl() { 1078 ASTNode$State state = state(); 1079 try { return true; } 1080 finally { 1081 } 1082 } 1083 protected java.util.Map instanceOf_TypeDecl_values; 1084 /** 1085 * @attribute syn 1086 * @aspect GenericsSubtype 1087 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:388 1088 */ 1089 @SuppressWarnings({"unchecked", "cast"}) 1090 public boolean instanceOf(TypeDecl type) { 1091 Object _parameters = type; 1092 if(instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new java.util.HashMap(4); 1093 if(instanceOf_TypeDecl_values.containsKey(_parameters)) { 1094 return ((Boolean)instanceOf_TypeDecl_values.get(_parameters)).booleanValue(); 1095 } 1096 ASTNode$State state = state(); 1097 int num = state.boundariesCrossed; 1098 boolean isFinal = this.is$Final(); 1099 boolean instanceOf_TypeDecl_value = instanceOf_compute(type); 1100 if(isFinal && num == state().boundariesCrossed){ instanceOf_TypeDecl_values.put(_parameters, Boolean.valueOf(instanceOf_TypeDecl_value)); } 1101 return instanceOf_TypeDecl_value; 1102 } 1103 /** 1104 * @apilevel internal 1105 */ 1106 private boolean instanceOf_compute(TypeDecl type) { return subtype(type); } 1107 /** 1108 * @attribute syn 1109 * @aspect TypeWideningAndIdentity 1110 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:423 1111 */ 1112 public boolean isSupertypeOfClassDecl(ClassDecl type) { 1113 ASTNode$State state = state(); 1114 try { 1115 if(super.isSupertypeOfClassDecl(type)) 1116 return true; 1117 for(Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { 1118 TypeDecl typeDecl = (TypeDecl)iter.next(); 1119 if(typeDecl.instanceOf(this)) 1120 return true; 1121 } 1122 return type.hasSuperclass() && type.superclass() != null && type.superclass().instanceOf(this); 1123 } 1124 finally { 1125 } 1126 } 1127 /** 1128 * @attribute syn 1129 * @aspect TypeWideningAndIdentity 1130 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:440 1131 */ 1132 public boolean isSupertypeOfInterfaceDecl(InterfaceDecl type) { 1133 ASTNode$State state = state(); 1134 try { 1135 if(super.isSupertypeOfInterfaceDecl(type)) 1136 return true; 1137 for(Iterator iter = type.superinterfacesIterator(); iter.hasNext(); ) { 1138 TypeDecl superinterface = (TypeDecl)iter.next(); 1139 if(superinterface.instanceOf(this)) 1140 return true; 1141 } 1142 return false; 1143 } 1144 finally { 1145 } 1146 } 1147 /** 1148 * @attribute syn 1149 * @aspect TypeWideningAndIdentity 1150 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:453 1151 */ 1152 public boolean isSupertypeOfArrayDecl(ArrayDecl type) { 1153 ASTNode$State state = state(); 1154 try { 1155 if(super.isSupertypeOfArrayDecl(type)) 1156 return true; 1157 for(Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { 1158 TypeDecl typeDecl = (TypeDecl)iter.next(); 1159 if(typeDecl.instanceOf(this)) 1160 return true; 1161 } 1162 return false; 1163 } 1164 finally { 1165 } 1166 } 1167 /** 1168 * @apilevel internal 1169 */ 1170 protected int isCircular_visited = -1; 1171 /** 1172 * @apilevel internal 1173 */ 1174 protected boolean isCircular_computed = false; 1175 /** 1176 * @apilevel internal 1177 */ 1178 protected boolean isCircular_initialized = false; 1179 /** 1180 * @apilevel internal 1181 */ 1182 protected boolean isCircular_value; 1183 /** 1184 * @attribute syn 1185 * @aspect Circularity 1186 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:696 1187 */ 1188 @SuppressWarnings({"unchecked", "cast"}) 1189 public boolean isCircular() { 1190 if(isCircular_computed) { 1191 return isCircular_value; 1192 } 1193 ASTNode$State state = state(); 1194 if (!isCircular_initialized) { 1195 isCircular_initialized = true; 1196 isCircular_value = true; 1197 } 1198 if (!state.IN_CIRCLE) { 1199 state.IN_CIRCLE = true; 1200 int num = state.boundariesCrossed; 1201 boolean isFinal = this.is$Final(); 1202 do { 1203 isCircular_visited = state.CIRCLE_INDEX; 1204 state.CHANGE = false; 1205 boolean new_isCircular_value = isCircular_compute(); 1206 if (new_isCircular_value!=isCircular_value) 1207 state.CHANGE = true; 1208 isCircular_value = new_isCircular_value; 1209 state.CIRCLE_INDEX++; 1210 } while (state.CHANGE); 1211 if(isFinal && num == state().boundariesCrossed) { 1212 isCircular_computed = true; 1213 } 1214 else { 1215 state.RESET_CYCLE = true; 1216 isCircular_compute(); 1217 state.RESET_CYCLE = false; 1218 isCircular_computed = false; 1219 isCircular_initialized = false; 1220 } 1221 state.IN_CIRCLE = false; 1222 return isCircular_value; 1223 } 1224 if(isCircular_visited != state.CIRCLE_INDEX) { 1225 isCircular_visited = state.CIRCLE_INDEX; 1226 if (state.RESET_CYCLE) { 1227 isCircular_computed = false; 1228 isCircular_initialized = false; 1229 isCircular_visited = -1; 1230 return isCircular_value; 1231 } 1232 boolean new_isCircular_value = isCircular_compute(); 1233 if (new_isCircular_value!=isCircular_value) 1234 state.CHANGE = true; 1235 isCircular_value = new_isCircular_value; 1236 return isCircular_value; 1237 } 1238 return isCircular_value; 1239 } 1240 /** 1241 * @apilevel internal 1242 */ 1243 private boolean isCircular_compute() { 1244 for(int i = 0; i < getNumSuperInterfaceId(); i++) { 1245 Access a = getSuperInterfaceId(i).lastAccess(); 1246 while(a != null) { 1247 if(a.type().isCircular()) 1248 return true; 1249 a = (a.isQualified() && a.qualifier().isTypeAccess()) ? (Access)a.qualifier() : null; 1250 } 1251 } 1252 return false; 1253 } 1254 /** 1255 * @apilevel internal 1256 */ 1257 protected boolean typeDescriptor_computed = false; 1258 /** 1259 * @apilevel internal 1260 */ 1261 protected String typeDescriptor_value; 1262 /** 1263 * @attribute syn 1264 * @aspect ConstantPoolNames 1265 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/ConstantPoolNames.jrag:16 1266 */ 1267 @SuppressWarnings({"unchecked", "cast"}) 1268 public String typeDescriptor() { 1269 if(typeDescriptor_computed) { 1270 return typeDescriptor_value; 1271 } 1272 ASTNode$State state = state(); 1273 int num = state.boundariesCrossed; 1274 boolean isFinal = this.is$Final(); 1275 typeDescriptor_value = typeDescriptor_compute(); 1276 if(isFinal && num == state().boundariesCrossed){ typeDescriptor_computed = true; } 1277 return typeDescriptor_value; 1278 } 1279 /** 1280 * @apilevel internal 1281 */ 1282 private String typeDescriptor_compute() { return "L" + constantPoolName() + ";"; } 1283 /** 1284 * @attribute syn 1285 * @aspect CreateBCode 1286 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:820 1287 */ 1288 public String arrayTypeDescriptor() { 1289 ASTNode$State state = state(); 1290 try { return constantPoolName(); } 1291 finally { 1292 } 1293 } 1294 /** 1295 * @apilevel internal 1296 */ 1297 protected boolean implementedInterfaces_computed = false; 1298 /** 1299 * @apilevel internal 1300 */ 1301 protected HashSet implementedInterfaces_value; 1302 /** 1303 * @attribute syn 1304 * @aspect GenericsTypeCheck 1305 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:411 1306 */ 1307 @SuppressWarnings({"unchecked", "cast"}) 1308 public HashSet implementedInterfaces() { 1309 if(implementedInterfaces_computed) { 1310 return implementedInterfaces_value; 1311 } 1312 ASTNode$State state = state(); 1313 int num = state.boundariesCrossed; 1314 boolean isFinal = this.is$Final(); 1315 implementedInterfaces_value = implementedInterfaces_compute(); 1316 if(isFinal && num == state().boundariesCrossed){ implementedInterfaces_computed = true; } 1317 return implementedInterfaces_value; 1318 } 1319 /** 1320 * @apilevel internal 1321 */ 1322 private HashSet implementedInterfaces_compute() { 1323 HashSet set= new HashSet(); 1324 set.addAll(typeObject().implementedInterfaces()); 1325 for(Iterator iter = superinterfacesIterator(); iter.hasNext(); ) { 1326 InterfaceDecl decl = (InterfaceDecl)iter.next(); 1327 set.add(decl); 1328 set.addAll(decl.implementedInterfaces()); 1329 } 1330 return set; 1331 } 1332 protected java.util.Map subtype_TypeDecl_values; 1333 /** 1334 * @attribute syn 1335 * @aspect GenericsSubtype 1336 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:408 1337 */ 1338 @SuppressWarnings({"unchecked", "cast"}) 1339 public boolean subtype(TypeDecl type) { 1340 Object _parameters = type; 1341 if(subtype_TypeDecl_values == null) subtype_TypeDecl_values = new java.util.HashMap(4); 1342 ASTNode$State.CircularValue _value; 1343 if(subtype_TypeDecl_values.containsKey(_parameters)) { 1344 Object _o = subtype_TypeDecl_values.get(_parameters); 1345 if(!(_o instanceof ASTNode$State.CircularValue)) { 1346 return ((Boolean)_o).booleanValue(); 1347 } 1348 else 1349 _value = (ASTNode$State.CircularValue)_o; 1350 } 1351 else { 1352 _value = new ASTNode$State.CircularValue(); 1353 subtype_TypeDecl_values.put(_parameters, _value); 1354 _value.value = Boolean.valueOf(true); 1355 } 1356 ASTNode$State state = state(); 1357 if (!state.IN_CIRCLE) { 1358 state.IN_CIRCLE = true; 1359 int num = state.boundariesCrossed; 1360 boolean isFinal = this.is$Final(); 1361 boolean new_subtype_TypeDecl_value; 1362 do { 1363 _value.visited = new Integer(state.CIRCLE_INDEX); 1364 state.CHANGE = false; 1365 new_subtype_TypeDecl_value = subtype_compute(type); 1366 if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 1367 state.CHANGE = true; 1368 _value.value = Boolean.valueOf(new_subtype_TypeDecl_value); 1369 } 1370 state.CIRCLE_INDEX++; 1371 } while (state.CHANGE); 1372 if(isFinal && num == state().boundariesCrossed) { 1373 subtype_TypeDecl_values.put(_parameters, new_subtype_TypeDecl_value); 1374 } 1375 else { 1376 subtype_TypeDecl_values.remove(_parameters); 1377 state.RESET_CYCLE = true; 1378 subtype_compute(type); 1379 state.RESET_CYCLE = false; 1380 } 1381 state.IN_CIRCLE = false; 1382 return new_subtype_TypeDecl_value; 1383 } 1384 if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) { 1385 _value.visited = new Integer(state.CIRCLE_INDEX); 1386 boolean new_subtype_TypeDecl_value = subtype_compute(type); 1387 if (state.RESET_CYCLE) { 1388 subtype_TypeDecl_values.remove(_parameters); 1389 } 1390 else if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 1391 state.CHANGE = true; 1392 _value.value = new_subtype_TypeDecl_value; 1393 } 1394 return new_subtype_TypeDecl_value; 1395 } 1396 return ((Boolean)_value.value).booleanValue(); 1397 } 1398 /** 1399 * @apilevel internal 1400 */ 1401 private boolean subtype_compute(TypeDecl type) { return type.supertypeInterfaceDecl(this); } 1402 /** 1403 * @attribute syn 1404 * @aspect GenericsSubtype 1405 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:421 1406 */ 1407 public boolean supertypeClassDecl(ClassDecl type) { 1408 ASTNode$State state = state(); 1409 try { 1410 if(super.supertypeClassDecl(type)) 1411 return true; 1412 for(Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { 1413 TypeDecl typeDecl = (TypeDecl)iter.next(); 1414 if(typeDecl.subtype(this)) 1415 return true; 1416 } 1417 return type.hasSuperclass() && type.superclass() != null && type.superclass().subtype(this); 1418 } 1419 finally { 1420 } 1421 } 1422 /** 1423 * @attribute syn 1424 * @aspect GenericsSubtype 1425 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:437 1426 */ 1427 public boolean supertypeInterfaceDecl(InterfaceDecl type) { 1428 ASTNode$State state = state(); 1429 try { 1430 if(super.supertypeInterfaceDecl(type)) 1431 return true; 1432 for(Iterator iter = type.superinterfacesIterator(); iter.hasNext(); ) { 1433 TypeDecl superinterface = (TypeDecl)iter.next(); 1434 if(superinterface.subtype(this)) 1435 return true; 1436 } 1437 return false; 1438 } 1439 finally { 1440 } 1441 } 1442 /** 1443 * @attribute syn 1444 * @aspect GenericsSubtype 1445 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:450 1446 */ 1447 public boolean supertypeArrayDecl(ArrayDecl type) { 1448 ASTNode$State state = state(); 1449 try { 1450 if(super.supertypeArrayDecl(type)) 1451 return true; 1452 for(Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { 1453 TypeDecl typeDecl = (TypeDecl)iter.next(); 1454 if(typeDecl.subtype(this)) 1455 return true; 1456 } 1457 return false; 1458 } 1459 finally { 1460 } 1461 } 1462 /** 1463 * @attribute syn 1464 * @aspect GenericsCodegen 1465 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:227 1466 */ 1467 public SimpleSet bridgeCandidates(String signature) { 1468 ASTNode$State state = state(); 1469 try { return ancestorMethods(signature); } 1470 finally { 1471 } 1472 } 1473 /** 1474 * @apilevel internal 1475 */ 1476 protected boolean needsSignatureAttribute_computed = false; 1477 /** 1478 * @apilevel internal 1479 */ 1480 protected boolean needsSignatureAttribute_value; 1481 /** 1482 * @attribute syn 1483 * @aspect GenericsCodegen 1484 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:355 1485 */ 1486 @SuppressWarnings({"unchecked", "cast"}) 1487 public boolean needsSignatureAttribute() { 1488 if(needsSignatureAttribute_computed) { 1489 return needsSignatureAttribute_value; 1490 } 1491 ASTNode$State state = state(); 1492 int num = state.boundariesCrossed; 1493 boolean isFinal = this.is$Final(); 1494 needsSignatureAttribute_value = needsSignatureAttribute_compute(); 1495 if(isFinal && num == state().boundariesCrossed){ needsSignatureAttribute_computed = true; } 1496 return needsSignatureAttribute_value; 1497 } 1498 /** 1499 * @apilevel internal 1500 */ 1501 private boolean needsSignatureAttribute_compute() { 1502 for(Iterator iter = superinterfacesIterator(); iter.hasNext(); ) 1503 if(((TypeDecl)iter.next()).needsSignatureAttribute()) 1504 return true; 1505 return false; 1506 } 1507 /** 1508 * @apilevel internal 1509 */ 1510 protected boolean classSignature_computed = false; 1511 /** 1512 * @apilevel internal 1513 */ 1514 protected String classSignature_value; 1515 /** 1516 * @attribute syn 1517 * @aspect GenericsCodegen 1518 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:395 1519 */ 1520 @SuppressWarnings({"unchecked", "cast"}) 1521 public String classSignature() { 1522 if(classSignature_computed) { 1523 return classSignature_value; 1524 } 1525 ASTNode$State state = state(); 1526 int num = state.boundariesCrossed; 1527 boolean isFinal = this.is$Final(); 1528 classSignature_value = classSignature_compute(); 1529 if(isFinal && num == state().boundariesCrossed){ classSignature_computed = true; } 1530 return classSignature_value; 1531 } 1532 /** 1533 * @apilevel internal 1534 */ 1535 private String classSignature_compute() { 1536 StringBuffer buf = new StringBuffer(); 1537 // SuperclassSignature 1538 buf.append(typeObject().classTypeSignature()); 1539 // SuperinterfaceSignature* 1540 for(Iterator iter = superinterfacesIterator(); iter.hasNext(); ) 1541 buf.append(((TypeDecl)iter.next()).classTypeSignature()); 1542 return buf.toString(); 1543 } 1544 /** 1545 * @attribute inh 1546 * @aspect TypeConversion 1547 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:97 1548 */ 1549 @SuppressWarnings({"unchecked", "cast"}) 1550 public MethodDecl unknownMethod() { 1551 ASTNode$State state = state(); 1552 MethodDecl unknownMethod_value = getParent().Define_MethodDecl_unknownMethod(this, null); 1553 return unknownMethod_value; 1554 } 1555 /** 1556 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/SyntacticClassification.jrag:75 1557 * @apilevel internal 1558 */ 1559 public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) { 1560 if(caller == getSuperInterfaceIdListNoTransform()) { 1561 int childIndex = caller.getIndexOfChild(child); 1562 return NameType.TYPE_NAME; 1563 } 1564 else { return super.Define_NameType_nameType(caller, child); 1565 } 1566 } 1567 /** 1568 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:580 1569 * @apilevel internal 1570 */ 1571 public TypeDecl Define_TypeDecl_hostType(ASTNode caller, ASTNode child) { 1572 if(caller == getSuperInterfaceIdListNoTransform()) { 1573 int childIndex = caller.getIndexOfChild(child); 1574 return hostType(); 1575 } 1576 else { return super.Define_TypeDecl_hostType(caller, child); 1577 } 1578 } 1579 /** 1580 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:278 1581 * @apilevel internal 1582 */ 1583 public boolean Define_boolean_withinSuppressWarnings(ASTNode caller, ASTNode child, String s) { 1584 if(caller == getSuperInterfaceIdListNoTransform()) { 1585 int childIndex = caller.getIndexOfChild(child); 1586 return hasAnnotationSuppressWarnings(s) || withinSuppressWarnings(s); 1587 } 1588 else { return super.Define_boolean_withinSuppressWarnings(caller, child, s); 1589 } 1590 } 1591 /** 1592 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:378 1593 * @apilevel internal 1594 */ 1595 public boolean Define_boolean_withinDeprecatedAnnotation(ASTNode caller, ASTNode child) { 1596 if(caller == getSuperInterfaceIdListNoTransform()) { 1597 int childIndex = caller.getIndexOfChild(child); 1598 return isDeprecated() || withinDeprecatedAnnotation(); 1599 } 1600 else { return super.Define_boolean_withinDeprecatedAnnotation(caller, child); 1601 } 1602 } 1603 /** 1604 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:270 1605 * @apilevel internal 1606 */ 1607 public boolean Define_boolean_inExtendsOrImplements(ASTNode caller, ASTNode child) { 1608 if(caller == getSuperInterfaceIdListNoTransform()) { 1609 int childIndex = caller.getIndexOfChild(child); 1610 return true; 1611 } 1612 else { return getParent().Define_boolean_inExtendsOrImplements(this, caller); 1613 } 1614 } 1615 /** 1616 * @apilevel internal 1617 */ 1618 public ASTNode rewriteTo() { 1619 return super.rewriteTo(); 1620 } 1621 }