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 /** 015 * @production ClassDecl : {@link ReferenceType} ::= <span class="component">{@link Modifiers}</span> <span class="component"><ID:String></span> <span class="component">[SuperClassAccess:{@link Access}]</span> <span class="component">Implements:{@link Access}*</span> <span class="component">{@link BodyDecl}*</span>; 016 * @ast node 017 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:66 018 */ 019 public class ClassDecl extends ReferenceType implements Cloneable { 020 /** 021 * @apilevel low-level 022 */ 023 public void flushCache() { 024 } 025 /** 026 * @apilevel internal 027 */ 028 public void flushCollectionCache() { 029 } 030 /** 031 * @apilevel internal 032 */ 033 @SuppressWarnings({"unchecked", "cast"}) 034 public ClassDecl clone() throws CloneNotSupportedException { 035 ClassDecl node = (ClassDecl)super.clone(); 036 node.interfacesMethodsSignatureMap_computed = false; 037 node.interfacesMethodsSignatureMap_value = null; 038 node.methodsSignatureMap_computed = false; 039 node.methodsSignatureMap_value = null; 040 node.ancestorMethods_String_values = null; 041 node.memberTypes_String_values = null; 042 node.memberFieldsMap_computed = false; 043 node.memberFieldsMap_value = null; 044 node.memberFields_String_values = null; 045 node.unimplementedMethods_computed = false; 046 node.unimplementedMethods_value = null; 047 node.hasAbstract_computed = false; 048 node.castingConversionTo_TypeDecl_values = null; 049 node.isString_computed = false; 050 node.isObject_computed = false; 051 node.instanceOf_TypeDecl_values = null; 052 node.isCircular_visited = -1; 053 node.isCircular_computed = false; 054 node.isCircular_initialized = false; 055 node.typeDescriptor_computed = false; 056 node.typeDescriptor_value = null; 057 node.implementedInterfaces_computed = false; 058 node.implementedInterfaces_value = null; 059 node.subtype_TypeDecl_values = null; 060 node.needsSignatureAttribute_computed = false; 061 node.classSignature_computed = false; 062 node.classSignature_value = null; 063 node.in$Circle(false); 064 node.is$Final(false); 065 return node; 066 } 067 /** 068 * @apilevel internal 069 */ 070 @SuppressWarnings({"unchecked", "cast"}) 071 public ClassDecl copy() { 072 073 try { 074 ClassDecl node = (ClassDecl) clone(); 075 node.parent = null; 076 if(children != null) 077 node.children = (ASTNode[]) children.clone(); 078 079 return node; 080 } catch (CloneNotSupportedException e) { 081 throw new Error("Error: clone not supported for " + getClass().getName()); 082 } 083 084 }/** 085 * Create a deep copy of the AST subtree at this node. 086 * The copy is dangling, i.e. has no parent. 087 * @return dangling copy of the subtree at this node 088 * @apilevel low-level 089 */ 090 @SuppressWarnings({"unchecked", "cast"}) 091 public ClassDecl fullCopy() { 092 093 ClassDecl tree = (ClassDecl) copy(); 094 if (children != null) { 095 for (int i = 0; i < children.length; ++i) { 096 097 ASTNode child = (ASTNode) children[i]; 098 if(child != null) { 099 child = child.fullCopy(); 100 tree.setChild(child, i); 101 } 102 } 103 } 104 return tree; 105 106 } /** 107 * @ast method 108 * @aspect AccessControl 109 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/AccessControl.jrag:147 110 */ 111 public void accessControl() { 112 super.accessControl(); 113 114 // 8.1.1.2 final Classes 115 TypeDecl typeDecl = hasSuperclass() ? superclass() : null; 116 if(typeDecl != null && !typeDecl.accessibleFromExtend(this)) 117 //if(typeDecl != null && !isCircular() && !typeDecl.accessibleFrom(this)) 118 error("class " + fullName() + " may not extend non accessible type " + typeDecl.fullName()); 119 120 if(hasSuperclass() && !superclass().accessibleFrom(this)) 121 error("a superclass must be accessible which " + superclass().name() + " is not"); 122 123 // 8.1.4 124 for(int i = 0; i < getNumImplements(); i++) { 125 TypeDecl decl = getImplements(i).type(); 126 if(!decl.isCircular() && !decl.accessibleFrom(this)) 127 error("class " + fullName() + " can not implement non accessible type " + decl.fullName()); 128 } 129 } 130 /** 131 * @ast method 132 * @aspect ExceptionHandling 133 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/ExceptionHandling.jrag:106 134 */ 135 public void exceptionHandling() { 136 constructors(); 137 super.exceptionHandling(); 138 } 139 /** 140 * @ast method 141 * @aspect MemberMethods 142 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupMethod.jrag:265 143 */ 144 public Iterator interfacesMethodsIterator() { 145 return new Iterator() { 146 private Iterator outer = interfacesMethodsSignatureMap().values().iterator(); 147 private Iterator inner = null; 148 public boolean hasNext() { 149 if((inner == null || !inner.hasNext()) && outer.hasNext()) 150 inner = ((SimpleSet)outer.next()).iterator(); 151 return inner == null ? false : inner.hasNext(); 152 } 153 public Object next() { 154 return inner.next(); 155 } 156 public void remove() { throw new UnsupportedOperationException(); } 157 }; 158 } 159 /** 160 * @ast method 161 * @aspect Modifiers 162 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/Modifiers.jrag:96 163 */ 164 public void checkModifiers() { 165 super.checkModifiers(); 166 // 8.1.1.2 final Classes 167 TypeDecl typeDecl = hasSuperclass() ? superclass() : null; 168 if(typeDecl != null && typeDecl.isFinal()) { 169 error("class " + fullName() + " may not extend final class " + typeDecl.fullName()); 170 } 171 172 } 173 /** 174 * @ast method 175 * @aspect PrettyPrint 176 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:70 177 */ 178 public void toString(StringBuffer s) { 179 s.append(indent()); 180 getModifiers().toString(s); 181 s.append("class " + name()); 182 if(hasSuperClassAccess()) { 183 s.append(" extends "); 184 getSuperClassAccess().toString(s); 185 } 186 if(getNumImplements() > 0) { 187 s.append(" implements "); 188 getImplements(0).toString(s); 189 for(int i = 1; i < getNumImplements(); i++) { 190 s.append(", "); 191 getImplements(i).toString(s); 192 } 193 } 194 ppBodyDecls(s); 195 } 196 /** 197 * @ast method 198 * @aspect SuperClasses 199 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:596 200 */ 201 public boolean hasSuperclass() { 202 return !isObject(); 203 } 204 /** 205 * @ast method 206 * @aspect SuperClasses 207 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:600 208 */ 209 public ClassDecl superclass() { 210 if(isObject()) 211 return null; 212 if(hasSuperClassAccess() && !isCircular() && getSuperClassAccess().type().isClassDecl()) 213 return (ClassDecl)getSuperClassAccess().type(); 214 return (ClassDecl)typeObject(); 215 } 216 /** 217 * @ast method 218 * @aspect SuperClasses 219 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:615 220 */ 221 public Iterator interfacesIterator() { 222 return new Iterator() { 223 public boolean hasNext() { 224 computeNextCurrent(); 225 return current != null; 226 } 227 public Object next() { 228 return current; 229 } 230 public void remove() { 231 throw new UnsupportedOperationException(); 232 } 233 private int index = 0; 234 private TypeDecl current = null; 235 private void computeNextCurrent() { 236 current = null; 237 if(isObject() || isCircular()) 238 return; 239 while(index < getNumImplements()) { 240 TypeDecl typeDecl = getImplements(index++).type(); 241 if(!typeDecl.isCircular() && typeDecl.isInterfaceDecl()) { 242 current = typeDecl; 243 return; 244 } 245 } 246 } 247 }; 248 } 249 /** 250 * @ast method 251 * @aspect TypeHierarchyCheck 252 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeHierarchyCheck.jrag:239 253 */ 254 public void nameCheck() { 255 super.nameCheck(); 256 if(hasSuperClassAccess() && !getSuperClassAccess().type().isClassDecl()) 257 error("class may only inherit a class and not " + getSuperClassAccess().type().typeName()); 258 if(isObject() && hasSuperClassAccess()) 259 error("class Object may not have superclass"); 260 if(isObject() && getNumImplements() != 0) 261 error("class Object may not implement interfaces"); 262 263 // 8.1.3 264 if(isCircular()) 265 error("circular inheritance dependency in " + typeName()); 266 267 // 8.1.4 268 HashSet set = new HashSet(); 269 for(int i = 0; i < getNumImplements(); i++) { 270 TypeDecl decl = getImplements(i).type(); 271 if(!decl.isInterfaceDecl() && !decl.isUnknown()) 272 error("type " + fullName() + " tries to implement non interface type " + decl.fullName()); 273 if(set.contains(decl)) 274 error("type " + decl.fullName() + " mentionened multiple times in implements clause"); 275 set.add(decl); 276 } 277 278 for(Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) { 279 MethodDecl m = (MethodDecl)iter.next(); 280 if(localMethodsSignature(m.signature()).isEmpty()) { 281 SimpleSet s = superclass().methodsSignature(m.signature()); 282 for(Iterator i2 = s.iterator(); i2.hasNext(); ) { 283 MethodDecl n = (MethodDecl)i2.next(); 284 if(n.accessibleFrom(this)) { 285 interfaceMethodCompatibleWithInherited(m, n); 286 } 287 } 288 if(s.isEmpty()) { 289 for(Iterator i2 = interfacesMethodsSignature(m.signature()).iterator(); i2.hasNext(); ) { 290 MethodDecl n = (MethodDecl)i2.next(); 291 if(!n.mayOverrideReturn(m) && !m.mayOverrideReturn(n)) 292 error("Xthe return type of method " + m.signature() + " in " + m.hostType().typeName() + 293 " does not match the return type of method " + n.signature() + " in " + 294 n.hostType().typeName() + " and may thus not be overriden"); 295 } 296 } 297 } 298 } 299 } 300 /** 301 * @ast method 302 * @aspect TypeHierarchyCheck 303 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeHierarchyCheck.jrag:286 304 */ 305 private void interfaceMethodCompatibleWithInherited(MethodDecl m, MethodDecl n) { 306 if(n.isStatic()) 307 error("Xa static method may not hide an instance method"); 308 if(!n.isAbstract() && !n.isPublic()) 309 error("Xoverriding access modifier error for " + m.signature() + " in " + m.hostType().typeName() + " and " + n.hostType().typeName()); 310 if(!n.mayOverrideReturn(m) && !m.mayOverrideReturn(m)) 311 error("Xthe return type of method " + m.signature() + " in " + m.hostType().typeName() + 312 " does not match the return type of method " + n.signature() + " in " + 313 n.hostType().typeName() + " and may thus not be overriden"); 314 if(!n.isAbstract()) { 315 // n implements and overrides method m in the interface 316 // may not throw more checked exceptions 317 for(int i = 0; i < n.getNumException(); i++) { 318 Access e = n.getException(i); 319 boolean found = false; 320 for(int j = 0; !found && j < m.getNumException(); j++) { 321 if(e.type().instanceOf(m.getException(j).type())) 322 found = true; 323 } 324 if(!found && e.type().isUncheckedException()) 325 error("X" + n.signature() + " in " + n.hostType().typeName() + " may not throw more checked exceptions than overridden method " + 326 m.signature() + " in " + m.hostType().typeName()); 327 } 328 } 329 } 330 /** 331 * @ast method 332 * @aspect GenerateClassfile 333 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/GenerateClassfile.jrag:38 334 */ 335 public void generateClassfile() { 336 super.generateClassfile(); 337 String fileName = destinationPath() + File.separator + constantPoolName() + ".class"; 338 if(options().verbose()) System.out.println("Writing class file to " + fileName); 339 try { 340 ConstantPool cp = constantPool(); 341 342 // force building of constant pool 343 cp.addClass(constantPoolName()); 344 if(hasSuperclass()) { 345 cp.addClass(superclass().constantPoolName()); 346 } 347 int numInterfaces = 0; 348 for(Iterator iter = interfacesIterator(); iter.hasNext(); numInterfaces++) 349 cp.addClass(((TypeDecl)iter.next()).constantPoolName()); 350 for(Iterator iter = bcFields().iterator(); iter.hasNext(); ) { 351 FieldDeclaration field = (FieldDeclaration) iter.next(); 352 cp.addUtf8(field.name()); 353 cp.addUtf8(field.type().typeDescriptor()); 354 field.attributes(); 355 } 356 if(needsEnclosing()) { 357 cp.addUtf8("this$0"); 358 cp.addUtf8(enclosing().typeDescriptor()); 359 cp.addUtf8("Synthetic"); 360 } 361 362 for(Iterator iter = bcMethods().iterator(); iter.hasNext(); ) { 363 BodyDecl decl = (BodyDecl)iter.next(); 364 decl.touchMethod(cp); 365 } 366 if(hasClinit()) { 367 cp.addUtf8("<clinit>"); 368 cp.addUtf8("()V"); 369 clinit_attributes(); 370 } 371 attributes(); 372 373 374 // Actual ClassFile generation 375 File dest = new File(fileName); 376 File parentFile = dest.getParentFile(); 377 if(parentFile != null) 378 parentFile.mkdirs(); 379 FileOutputStream f = new FileOutputStream(fileName); 380 DataOutputStream out = new DataOutputStream(new BufferedOutputStream(f)); 381 out.writeInt(magicHeader()); 382 out.writeChar(minorVersion()); 383 out.writeChar(majorVersion()); 384 cp.emit(out); 385 int flags = flags(); 386 if(isNestedType()) 387 flags = mangledFlags(flags); 388 flags |= Modifiers.ACC_SUPER; 389 out.writeChar(flags); 390 out.writeChar(cp.addClass(constantPoolName())); 391 out.writeChar(hasSuperclass() ? cp.addClass(superclass().constantPoolName()) : 0); 392 out.writeChar(numInterfaces); 393 for(Iterator iter = interfacesIterator(); iter.hasNext(); ) 394 out.writeChar(cp.addClass(((TypeDecl)iter.next()).constantPoolName())); 395 Collection fields = bcFields(); 396 out.writeChar(fields.size() + (needsEnclosing() ? 1 : 0)); 397 for(Iterator iter = fields.iterator(); iter.hasNext(); ) { 398 FieldDeclaration field = (FieldDeclaration) iter.next(); 399 out.writeChar(field.flags()); 400 out.writeChar(cp.addUtf8(field.name())); 401 out.writeChar(cp.addUtf8(field.type().typeDescriptor())); 402 out.writeChar(field.attributes().size()); 403 for(Iterator itera = field.attributes().iterator(); itera.hasNext();) 404 ((Attribute)itera.next()).emit(out); 405 } 406 if(needsEnclosing()) { 407 out.writeChar(0 /*Modifiers.ACC_PRIVATE*/); 408 out.writeChar(cp.addUtf8("this$0")); 409 out.writeChar(cp.addUtf8(enclosing().typeDescriptor())); 410 out.writeChar(1); 411 new SyntheticAttribute(cp).emit(out); 412 413 } 414 415 Collection methods = bcMethods(); 416 out.writeChar(methods.size() + (hasClinit() ? 1 : 0)); 417 for(Iterator iter = methods.iterator(); iter.hasNext(); ) { 418 BodyDecl b = (BodyDecl)iter.next(); 419 b.generateMethod(out, cp); 420 } 421 if(hasClinit()) { 422 out.writeChar(Modifiers.ACC_STATIC); 423 out.writeChar(cp.addUtf8("<clinit>")); 424 out.writeChar(cp.addUtf8("()V")); 425 out.writeChar(clinit_attributes().size()); 426 for(Iterator itera = clinit_attributes().iterator(); itera.hasNext();) 427 ((Attribute)itera.next()).emit(out); 428 } 429 out.writeChar(attributes().size()); 430 for(Iterator itera = attributes().iterator(); itera.hasNext();) 431 ((Attribute)itera.next()).emit(out); 432 433 out.close(); 434 } catch (IOException e) { 435 e.printStackTrace(); 436 } 437 } 438 /** 439 * @ast method 440 * @aspect Generics 441 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:187 442 */ 443 public TypeDecl makeGeneric(Signatures.ClassSignature s) { 444 if(s.hasFormalTypeParameters()) { 445 ASTNode node = getParent(); 446 int index = node.getIndexOfChild(this); 447 node.setChild( 448 new GenericClassDecl( 449 getModifiersNoTransform(), 450 getID(), 451 s.hasSuperclassSignature() ? new Opt(s.superclassSignature()) : getSuperClassAccessOptNoTransform(), 452 s.hasSuperinterfaceSignature() ? s.superinterfaceSignature() : getImplementsListNoTransform(), 453 getBodyDeclListNoTransform(), 454 s.typeParameters() 455 ), 456 index 457 ); 458 return (TypeDecl)node.getChildNoTransform(index); 459 } 460 else { 461 if(s.hasSuperclassSignature()) 462 setSuperClassAccessOpt(new Opt(s.superclassSignature())); 463 if(s.hasSuperinterfaceSignature()) 464 setImplementsList(s.superinterfaceSignature()); 465 return this; 466 } 467 } 468 /** 469 * @ast method 470 * @aspect LookupParTypeDecl 471 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1313 472 */ 473 public ClassDecl substitutedClassDecl(Parameterization parTypeDecl) { 474 ClassDecl c = new ClassDeclSubstituted( 475 (Modifiers)getModifiers().fullCopy(), 476 getID(), 477 hasSuperClassAccess() ? new Opt(getSuperClassAccess().type().substitute(parTypeDecl)) : new Opt(), 478 getImplementsList().substitute(parTypeDecl), 479 // ES: new List(), 480 this 481 ); 482 return c; 483 } 484 /** 485 * @ast method 486 * 487 */ 488 public ClassDecl() { 489 super(); 490 491 492 } 493 /** 494 * Initializes the child array to the correct size. 495 * Initializes List and Opt nta children. 496 * @apilevel internal 497 * @ast method 498 * @ast method 499 * 500 */ 501 public void init$Children() { 502 children = new ASTNode[4]; 503 setChild(new Opt(), 1); 504 setChild(new List(), 2); 505 setChild(new List(), 3); 506 } 507 /** 508 * @ast method 509 * 510 */ 511 public ClassDecl(Modifiers p0, String p1, Opt<Access> p2, List<Access> p3, List<BodyDecl> p4) { 512 setChild(p0, 0); 513 setID(p1); 514 setChild(p2, 1); 515 setChild(p3, 2); 516 setChild(p4, 3); 517 } 518 /** 519 * @ast method 520 * 521 */ 522 public ClassDecl(Modifiers p0, beaver.Symbol p1, Opt<Access> p2, List<Access> p3, List<BodyDecl> p4) { 523 setChild(p0, 0); 524 setID(p1); 525 setChild(p2, 1); 526 setChild(p3, 2); 527 setChild(p4, 3); 528 } 529 /** 530 * @apilevel low-level 531 * @ast method 532 * 533 */ 534 protected int numChildren() { 535 return 4; 536 } 537 /** 538 * @apilevel internal 539 * @ast method 540 * 541 */ 542 public boolean mayHaveRewrite() { 543 return false; 544 } 545 /** 546 * Replaces the Modifiers child. 547 * @param node The new node to replace the Modifiers child. 548 * @apilevel high-level 549 * @ast method 550 * 551 */ 552 public void setModifiers(Modifiers node) { 553 setChild(node, 0); 554 } 555 /** 556 * Retrieves the Modifiers child. 557 * @return The current node used as the Modifiers child. 558 * @apilevel high-level 559 * @ast method 560 * 561 */ 562 public Modifiers getModifiers() { 563 return (Modifiers)getChild(0); 564 } 565 /** 566 * Retrieves the Modifiers child. 567 * <p><em>This method does not invoke AST transformations.</em></p> 568 * @return The current node used as the Modifiers child. 569 * @apilevel low-level 570 * @ast method 571 * 572 */ 573 public Modifiers getModifiersNoTransform() { 574 return (Modifiers)getChildNoTransform(0); 575 } 576 /** 577 * Replaces the lexeme ID. 578 * @param value The new value for the lexeme ID. 579 * @apilevel high-level 580 * @ast method 581 * 582 */ 583 public void setID(String value) { 584 tokenString_ID = value; 585 } 586 /** 587 * JastAdd-internal setter for lexeme ID using the Beaver parser. 588 * @apilevel internal 589 * @ast method 590 * 591 */ 592 public void setID(beaver.Symbol symbol) { 593 if(symbol.value != null && !(symbol.value instanceof String)) 594 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 595 tokenString_ID = (String)symbol.value; 596 IDstart = symbol.getStart(); 597 IDend = symbol.getEnd(); 598 } 599 /** 600 * Retrieves the value for the lexeme ID. 601 * @return The value for the lexeme ID. 602 * @apilevel high-level 603 * @ast method 604 * 605 */ 606 public String getID() { 607 return tokenString_ID != null ? tokenString_ID : ""; 608 } 609 /** 610 * Replaces the optional node for the SuperClassAccess child. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 611 * @param opt The new node to be used as the optional node for the SuperClassAccess child. 612 * @apilevel low-level 613 * @ast method 614 * 615 */ 616 public void setSuperClassAccessOpt(Opt<Access> opt) { 617 setChild(opt, 1); 618 } 619 /** 620 * Check whether the optional SuperClassAccess child exists. 621 * @return {@code true} if the optional SuperClassAccess child exists, {@code false} if it does not. 622 * @apilevel high-level 623 * @ast method 624 * 625 */ 626 public boolean hasSuperClassAccess() { 627 return getSuperClassAccessOpt().getNumChild() != 0; 628 } 629 /** 630 * Retrieves the (optional) SuperClassAccess child. 631 * @return The SuperClassAccess child, if it exists. Returns {@code null} otherwise. 632 * @apilevel low-level 633 * @ast method 634 * 635 */ 636 @SuppressWarnings({"unchecked", "cast"}) 637 public Access getSuperClassAccess() { 638 return (Access)getSuperClassAccessOpt().getChild(0); 639 } 640 /** 641 * Replaces the (optional) SuperClassAccess child. 642 * @param node The new node to be used as the SuperClassAccess child. 643 * @apilevel high-level 644 * @ast method 645 * 646 */ 647 public void setSuperClassAccess(Access node) { 648 getSuperClassAccessOpt().setChild(node, 0); 649 } 650 /** 651 * @apilevel low-level 652 * @ast method 653 * 654 */ 655 @SuppressWarnings({"unchecked", "cast"}) 656 public Opt<Access> getSuperClassAccessOpt() { 657 return (Opt<Access>)getChild(1); 658 } 659 /** 660 * Retrieves the optional node for child SuperClassAccess. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 661 * <p><em>This method does not invoke AST transformations.</em></p> 662 * @return The optional node for child SuperClassAccess. 663 * @apilevel low-level 664 * @ast method 665 * 666 */ 667 @SuppressWarnings({"unchecked", "cast"}) 668 public Opt<Access> getSuperClassAccessOptNoTransform() { 669 return (Opt<Access>)getChildNoTransform(1); 670 } 671 /** 672 * Replaces the Implements list. 673 * @param list The new list node to be used as the Implements list. 674 * @apilevel high-level 675 * @ast method 676 * 677 */ 678 public void setImplementsList(List<Access> list) { 679 setChild(list, 2); 680 } 681 /** 682 * Retrieves the number of children in the Implements list. 683 * @return Number of children in the Implements list. 684 * @apilevel high-level 685 * @ast method 686 * 687 */ 688 public int getNumImplements() { 689 return getImplementsList().getNumChild(); 690 } 691 /** 692 * Retrieves the number of children in the Implements list. 693 * Calling this method will not trigger rewrites.. 694 * @return Number of children in the Implements list. 695 * @apilevel low-level 696 * @ast method 697 * 698 */ 699 public int getNumImplementsNoTransform() { 700 return getImplementsListNoTransform().getNumChildNoTransform(); 701 } 702 /** 703 * Retrieves the element at index {@code i} in the Implements list.. 704 * @param i Index of the element to return. 705 * @return The element at position {@code i} in the Implements list. 706 * @apilevel high-level 707 * @ast method 708 * 709 */ 710 @SuppressWarnings({"unchecked", "cast"}) 711 public Access getImplements(int i) { 712 return (Access)getImplementsList().getChild(i); 713 } 714 /** 715 * Append an element to the Implements list. 716 * @param node The element to append to the Implements list. 717 * @apilevel high-level 718 * @ast method 719 * 720 */ 721 public void addImplements(Access node) { 722 List<Access> list = (parent == null || state == null) ? getImplementsListNoTransform() : getImplementsList(); 723 list.addChild(node); 724 } 725 /** 726 * @apilevel low-level 727 * @ast method 728 * 729 */ 730 public void addImplementsNoTransform(Access node) { 731 List<Access> list = getImplementsListNoTransform(); 732 list.addChild(node); 733 } 734 /** 735 * Replaces the Implements list element at index {@code i} with the new node {@code node}. 736 * @param node The new node to replace the old list element. 737 * @param i The list index of the node to be replaced. 738 * @apilevel high-level 739 * @ast method 740 * 741 */ 742 public void setImplements(Access node, int i) { 743 List<Access> list = getImplementsList(); 744 list.setChild(node, i); 745 } 746 /** 747 * Retrieves the Implements list. 748 * @return The node representing the Implements list. 749 * @apilevel high-level 750 * @ast method 751 * 752 */ 753 public List<Access> getImplementss() { 754 return getImplementsList(); 755 } 756 /** 757 * Retrieves the Implements list. 758 * <p><em>This method does not invoke AST transformations.</em></p> 759 * @return The node representing the Implements list. 760 * @apilevel low-level 761 * @ast method 762 * 763 */ 764 public List<Access> getImplementssNoTransform() { 765 return getImplementsListNoTransform(); 766 } 767 /** 768 * Retrieves the Implements list. 769 * @return The node representing the Implements list. 770 * @apilevel high-level 771 * @ast method 772 * 773 */ 774 @SuppressWarnings({"unchecked", "cast"}) 775 public List<Access> getImplementsList() { 776 List<Access> list = (List<Access>)getChild(2); 777 list.getNumChild(); 778 return list; 779 } 780 /** 781 * Retrieves the Implements list. 782 * <p><em>This method does not invoke AST transformations.</em></p> 783 * @return The node representing the Implements list. 784 * @apilevel low-level 785 * @ast method 786 * 787 */ 788 @SuppressWarnings({"unchecked", "cast"}) 789 public List<Access> getImplementsListNoTransform() { 790 return (List<Access>)getChildNoTransform(2); 791 } 792 /** 793 * Replaces the BodyDecl list. 794 * @param list The new list node to be used as the BodyDecl list. 795 * @apilevel high-level 796 * @ast method 797 * 798 */ 799 public void setBodyDeclList(List<BodyDecl> list) { 800 setChild(list, 3); 801 } 802 /** 803 * Retrieves the number of children in the BodyDecl list. 804 * @return Number of children in the BodyDecl list. 805 * @apilevel high-level 806 * @ast method 807 * 808 */ 809 public int getNumBodyDecl() { 810 return getBodyDeclList().getNumChild(); 811 } 812 /** 813 * Retrieves the number of children in the BodyDecl list. 814 * Calling this method will not trigger rewrites.. 815 * @return Number of children in the BodyDecl list. 816 * @apilevel low-level 817 * @ast method 818 * 819 */ 820 public int getNumBodyDeclNoTransform() { 821 return getBodyDeclListNoTransform().getNumChildNoTransform(); 822 } 823 /** 824 * Retrieves the element at index {@code i} in the BodyDecl list.. 825 * @param i Index of the element to return. 826 * @return The element at position {@code i} in the BodyDecl list. 827 * @apilevel high-level 828 * @ast method 829 * 830 */ 831 @SuppressWarnings({"unchecked", "cast"}) 832 public BodyDecl getBodyDecl(int i) { 833 return (BodyDecl)getBodyDeclList().getChild(i); 834 } 835 /** 836 * Append an element to the BodyDecl list. 837 * @param node The element to append to the BodyDecl list. 838 * @apilevel high-level 839 * @ast method 840 * 841 */ 842 public void addBodyDecl(BodyDecl node) { 843 List<BodyDecl> list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); 844 list.addChild(node); 845 } 846 /** 847 * @apilevel low-level 848 * @ast method 849 * 850 */ 851 public void addBodyDeclNoTransform(BodyDecl node) { 852 List<BodyDecl> list = getBodyDeclListNoTransform(); 853 list.addChild(node); 854 } 855 /** 856 * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. 857 * @param node The new node to replace the old list element. 858 * @param i The list index of the node to be replaced. 859 * @apilevel high-level 860 * @ast method 861 * 862 */ 863 public void setBodyDecl(BodyDecl node, int i) { 864 List<BodyDecl> list = getBodyDeclList(); 865 list.setChild(node, i); 866 } 867 /** 868 * Retrieves the BodyDecl list. 869 * @return The node representing the BodyDecl list. 870 * @apilevel high-level 871 * @ast method 872 * 873 */ 874 public List<BodyDecl> getBodyDecls() { 875 return getBodyDeclList(); 876 } 877 /** 878 * Retrieves the BodyDecl list. 879 * <p><em>This method does not invoke AST transformations.</em></p> 880 * @return The node representing the BodyDecl list. 881 * @apilevel low-level 882 * @ast method 883 * 884 */ 885 public List<BodyDecl> getBodyDeclsNoTransform() { 886 return getBodyDeclListNoTransform(); 887 } 888 /** 889 * Retrieves the BodyDecl list. 890 * @return The node representing the BodyDecl list. 891 * @apilevel high-level 892 * @ast method 893 * 894 */ 895 @SuppressWarnings({"unchecked", "cast"}) 896 public List<BodyDecl> getBodyDeclList() { 897 List<BodyDecl> list = (List<BodyDecl>)getChild(3); 898 list.getNumChild(); 899 return list; 900 } 901 /** 902 * Retrieves the BodyDecl list. 903 * <p><em>This method does not invoke AST transformations.</em></p> 904 * @return The node representing the BodyDecl list. 905 * @apilevel low-level 906 * @ast method 907 * 908 */ 909 @SuppressWarnings({"unchecked", "cast"}) 910 public List<BodyDecl> getBodyDeclListNoTransform() { 911 return (List<BodyDecl>)getChildNoTransform(3); 912 } 913 /** 914 * @ast method 915 * @aspect TypeConversion 916 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:84 917 */ 918 private boolean refined_TypeConversion_ClassDecl_castingConversionTo_TypeDecl(TypeDecl type) 919 { 920 if(type.isArrayDecl()) { 921 return isObject(); 922 } 923 else if(type.isClassDecl()) { 924 return this == type || instanceOf(type) || type.instanceOf(this); 925 } 926 else if(type.isInterfaceDecl()) { 927 return !isFinal() || instanceOf(type); 928 } 929 else return super.castingConversionTo(type); 930 } 931 /** 932 * @ast method 933 * @aspect Generics 934 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:57 935 */ 936 private boolean refined_Generics_ClassDecl_castingConversionTo_TypeDecl(TypeDecl type) 937 { 938 TypeDecl S = this; 939 TypeDecl T = type; 940 if(T instanceof TypeVariable) { 941 TypeVariable t = (TypeVariable)T; 942 if(t.getNumTypeBound() == 0) return true; 943 for(int i = 0; i < t.getNumTypeBound(); i++) 944 if(castingConversionTo(t.getTypeBound(i).type())) 945 return true; 946 return false; 947 } 948 if(T.isClassDecl() && (S.erasure() != S || T.erasure() != T)) 949 return S.erasure().castingConversionTo(T.erasure()); 950 return refined_TypeConversion_ClassDecl_castingConversionTo_TypeDecl(type); 951 } 952 /** 953 * @attribute syn 954 * @aspect ConstantExpression 955 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:160 956 */ 957 public Constant cast(Constant c) { 958 ASTNode$State state = state(); 959 try { return Constant.create(c.stringValue()); } 960 finally { 961 } 962 } 963 /** 964 * @attribute syn 965 * @aspect ConstantExpression 966 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:226 967 */ 968 public Constant add(Constant c1, Constant c2) { 969 ASTNode$State state = state(); 970 try { return Constant.create(c1.stringValue() + c2.stringValue()); } 971 finally { 972 } 973 } 974 /** 975 * @attribute syn 976 * @aspect ConstantExpression 977 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:290 978 */ 979 public Constant questionColon(Constant cond, Constant c1, Constant c2) { 980 ASTNode$State state = state(); 981 try { return Constant.create(cond.booleanValue() ? c1.stringValue() : c2.stringValue()); } 982 finally { 983 } 984 } 985 /** 986 * @attribute syn 987 * @aspect ConstantExpression 988 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:394 989 */ 990 public boolean eqIsTrue(Expr left, Expr right) { 991 ASTNode$State state = state(); 992 try { return isString() && left.constant().stringValue().equals(right.constant().stringValue()); } 993 finally { 994 } 995 } 996 /** 997 * @attribute syn 998 * @aspect ErrorCheck 999 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/ErrorCheck.jrag:22 1000 */ 1001 public int lineNumber() { 1002 ASTNode$State state = state(); 1003 try { return getLine(IDstart); } 1004 finally { 1005 } 1006 } 1007 /** 1008 * @attribute syn 1009 * @aspect ConstructScope 1010 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupConstructor.jrag:21 1011 */ 1012 public Collection lookupSuperConstructor() { 1013 ASTNode$State state = state(); 1014 try { return hasSuperclass() ? superclass().constructors() : Collections.EMPTY_LIST; } 1015 finally { 1016 } 1017 } 1018 /** 1019 * @attribute syn 1020 * @aspect ImplicitConstructor 1021 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupConstructor.jrag:207 1022 */ 1023 public boolean noConstructor() { 1024 ASTNode$State state = state(); 1025 try { 1026 if(!compilationUnit().fromSource()) 1027 return false; 1028 for(int i = 0; i < getNumBodyDecl(); i++) 1029 if(getBodyDecl(i) instanceof ConstructorDecl) 1030 return false; 1031 return true; 1032 } 1033 finally { 1034 } 1035 } 1036 /** 1037 * @attribute syn 1038 * @aspect MemberMethods 1039 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupMethod.jrag:280 1040 */ 1041 public SimpleSet interfacesMethodsSignature(String signature) { 1042 ASTNode$State state = state(); 1043 try { 1044 SimpleSet set = (SimpleSet)interfacesMethodsSignatureMap().get(signature); 1045 if(set != null) return set; 1046 return SimpleSet.emptySet; 1047 } 1048 finally { 1049 } 1050 } 1051 /** 1052 * @apilevel internal 1053 */ 1054 protected boolean interfacesMethodsSignatureMap_computed = false; 1055 /** 1056 * @apilevel internal 1057 */ 1058 protected HashMap interfacesMethodsSignatureMap_value; 1059 /** 1060 * @attribute syn 1061 * @aspect MemberMethods 1062 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupMethod.jrag:286 1063 */ 1064 @SuppressWarnings({"unchecked", "cast"}) 1065 public HashMap interfacesMethodsSignatureMap() { 1066 if(interfacesMethodsSignatureMap_computed) { 1067 return interfacesMethodsSignatureMap_value; 1068 } 1069 ASTNode$State state = state(); 1070 int num = state.boundariesCrossed; 1071 boolean isFinal = this.is$Final(); 1072 interfacesMethodsSignatureMap_value = interfacesMethodsSignatureMap_compute(); 1073 if(isFinal && num == state().boundariesCrossed){ interfacesMethodsSignatureMap_computed = true; } 1074 return interfacesMethodsSignatureMap_value; 1075 } 1076 /** 1077 * @apilevel internal 1078 */ 1079 private HashMap interfacesMethodsSignatureMap_compute() { 1080 HashMap map = new HashMap(); 1081 for(Iterator iter = interfacesIterator(); iter.hasNext(); ) { 1082 TypeDecl typeDecl = (InterfaceDecl)iter.next(); 1083 for(Iterator i2 = typeDecl.methodsIterator(); i2.hasNext(); ) { 1084 MethodDecl m = (MethodDecl)i2.next(); 1085 putSimpleSetElement(map, m.signature(), m); 1086 } 1087 } 1088 return map; 1089 } 1090 /** 1091 * @apilevel internal 1092 */ 1093 protected boolean methodsSignatureMap_computed = false; 1094 /** 1095 * @apilevel internal 1096 */ 1097 protected HashMap methodsSignatureMap_value; 1098 /** 1099 * @attribute syn 1100 * @aspect MethodSignature15 1101 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/MethodSignature.jrag:359 1102 */ 1103 @SuppressWarnings({"unchecked", "cast"}) 1104 public HashMap methodsSignatureMap() { 1105 if(methodsSignatureMap_computed) { 1106 return methodsSignatureMap_value; 1107 } 1108 ASTNode$State state = state(); 1109 int num = state.boundariesCrossed; 1110 boolean isFinal = this.is$Final(); 1111 methodsSignatureMap_value = methodsSignatureMap_compute(); 1112 if(isFinal && num == state().boundariesCrossed){ methodsSignatureMap_computed = true; } 1113 return methodsSignatureMap_value; 1114 } 1115 /** 1116 * @apilevel internal 1117 */ 1118 private HashMap methodsSignatureMap_compute() { 1119 HashMap map = new HashMap(localMethodsSignatureMap()); 1120 if(hasSuperclass()) { 1121 for(Iterator iter = superclass().methodsIterator(); iter.hasNext(); ) { 1122 MethodDecl m = (MethodDecl)iter.next(); 1123 if(!m.isPrivate() && m.accessibleFrom(this) && !localMethodsSignatureMap().containsKey(m.signature())) { 1124 if(!(m instanceof MethodDeclSubstituted) || !localMethodsSignatureMap().containsKey(m.sourceMethodDecl().signature())) 1125 putSimpleSetElement(map, m.signature(), m); 1126 } 1127 } 1128 } 1129 for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) { 1130 TypeDecl typeDecl = (TypeDecl)outerIter.next(); 1131 for(Iterator iter = typeDecl.methodsIterator(); iter.hasNext(); ) { 1132 MethodDecl m = (MethodDecl)iter.next(); 1133 if(!m.isPrivate() && m.accessibleFrom(this) && !localMethodsSignatureMap().containsKey(m.signature())) { 1134 if(!(m instanceof MethodDeclSubstituted) || !localMethodsSignatureMap().containsKey(m.sourceMethodDecl().signature())) { 1135 if(allMethodsAbstract((SimpleSet)map.get(m.signature())) && 1136 (!(m instanceof MethodDeclSubstituted) || 1137 allMethodsAbstract((SimpleSet)map.get(m.sourceMethodDecl().signature())) ) 1138 ) 1139 putSimpleSetElement(map, m.signature(), m); 1140 } 1141 } 1142 } 1143 } 1144 return map; 1145 } 1146 protected java.util.Map ancestorMethods_String_values; 1147 /** 1148 * @attribute syn 1149 * @aspect AncestorMethods 1150 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupMethod.jrag:380 1151 */ 1152 @SuppressWarnings({"unchecked", "cast"}) 1153 public SimpleSet ancestorMethods(String signature) { 1154 Object _parameters = signature; 1155 if(ancestorMethods_String_values == null) ancestorMethods_String_values = new java.util.HashMap(4); 1156 if(ancestorMethods_String_values.containsKey(_parameters)) { 1157 return (SimpleSet)ancestorMethods_String_values.get(_parameters); 1158 } 1159 ASTNode$State state = state(); 1160 int num = state.boundariesCrossed; 1161 boolean isFinal = this.is$Final(); 1162 SimpleSet ancestorMethods_String_value = ancestorMethods_compute(signature); 1163 if(isFinal && num == state().boundariesCrossed){ ancestorMethods_String_values.put(_parameters, ancestorMethods_String_value); } 1164 return ancestorMethods_String_value; 1165 } 1166 /** 1167 * @apilevel internal 1168 */ 1169 private SimpleSet ancestorMethods_compute(String signature) { 1170 SimpleSet set = SimpleSet.emptySet; 1171 if(hasSuperclass()) { 1172 for(Iterator iter = superclass().localMethodsSignature(signature).iterator(); iter.hasNext(); ) { 1173 MethodDecl m = (MethodDecl)iter.next(); 1174 if(!m.isPrivate()) 1175 set = set.add(m); 1176 } 1177 } 1178 if(set.size() != 1 || ((MethodDecl)set.iterator().next()).isAbstract()) { 1179 for(Iterator iter = interfacesMethodsSignature(signature).iterator(); iter.hasNext(); ) { 1180 MethodDecl m = (MethodDecl)iter.next(); 1181 set = set.add(m); 1182 } 1183 } 1184 if(!hasSuperclass()) return set; 1185 if(set.size() == 1) { 1186 MethodDecl m = (MethodDecl)set.iterator().next(); 1187 if(!m.isAbstract()) { 1188 boolean done = true; 1189 for(Iterator iter = superclass().ancestorMethods(signature).iterator(); iter.hasNext(); ) { 1190 MethodDecl n = (MethodDecl)iter.next(); 1191 if(n.isPrivate() || !n.accessibleFrom(m.hostType())) 1192 done = false; 1193 } 1194 if(done) return set; 1195 } 1196 } 1197 for(Iterator iter = superclass().ancestorMethods(signature).iterator(); iter.hasNext(); ) { 1198 MethodDecl m = (MethodDecl)iter.next(); 1199 set = set.add(m); 1200 } 1201 return set; 1202 } 1203 protected java.util.Map memberTypes_String_values; 1204 /** 1205 * @attribute syn 1206 * @aspect TypeScopePropagation 1207 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupType.jrag:498 1208 */ 1209 @SuppressWarnings({"unchecked", "cast"}) 1210 public SimpleSet memberTypes(String name) { 1211 Object _parameters = name; 1212 if(memberTypes_String_values == null) memberTypes_String_values = new java.util.HashMap(4); 1213 if(memberTypes_String_values.containsKey(_parameters)) { 1214 return (SimpleSet)memberTypes_String_values.get(_parameters); 1215 } 1216 ASTNode$State state = state(); 1217 int num = state.boundariesCrossed; 1218 boolean isFinal = this.is$Final(); 1219 SimpleSet memberTypes_String_value = memberTypes_compute(name); 1220 if(isFinal && num == state().boundariesCrossed){ memberTypes_String_values.put(_parameters, memberTypes_String_value); } 1221 return memberTypes_String_value; 1222 } 1223 /** 1224 * @apilevel internal 1225 */ 1226 private SimpleSet memberTypes_compute(String name) { 1227 SimpleSet set = localTypeDecls(name); 1228 if(!set.isEmpty()) return set; 1229 for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) { 1230 TypeDecl type = (TypeDecl)outerIter.next(); 1231 for(Iterator iter = type.memberTypes(name).iterator(); iter.hasNext(); ) { 1232 TypeDecl decl = (TypeDecl)iter.next(); 1233 if(!decl.isPrivate() && decl.accessibleFrom(this)) 1234 set = set.add(decl); 1235 } 1236 } 1237 if(hasSuperclass()) { 1238 for(Iterator iter = superclass().memberTypes(name).iterator(); iter.hasNext(); ) { 1239 TypeDecl decl = (TypeDecl)iter.next(); 1240 if(!decl.isPrivate() && decl.accessibleFrom(this)) { 1241 set = set.add(decl); 1242 } 1243 } 1244 } 1245 return set; 1246 } 1247 /** 1248 * @apilevel internal 1249 */ 1250 protected boolean memberFieldsMap_computed = false; 1251 /** 1252 * @apilevel internal 1253 */ 1254 protected HashMap memberFieldsMap_value; 1255 /** 1256 * @attribute syn 1257 * @aspect Fields 1258 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:283 1259 */ 1260 @SuppressWarnings({"unchecked", "cast"}) 1261 public HashMap memberFieldsMap() { 1262 if(memberFieldsMap_computed) { 1263 return memberFieldsMap_value; 1264 } 1265 ASTNode$State state = state(); 1266 int num = state.boundariesCrossed; 1267 boolean isFinal = this.is$Final(); 1268 memberFieldsMap_value = memberFieldsMap_compute(); 1269 if(isFinal && num == state().boundariesCrossed){ memberFieldsMap_computed = true; } 1270 return memberFieldsMap_value; 1271 } 1272 /** 1273 * @apilevel internal 1274 */ 1275 private HashMap memberFieldsMap_compute() { 1276 HashMap map = new HashMap(localFieldsMap()); 1277 if(hasSuperclass()) { 1278 for(Iterator iter = superclass().fieldsIterator(); iter.hasNext(); ) { 1279 FieldDeclaration decl = (FieldDeclaration)iter.next(); 1280 if(!decl.isPrivate() && decl.accessibleFrom(this) && !localFieldsMap().containsKey(decl.name())) 1281 putSimpleSetElement(map, decl.name(), decl); 1282 } 1283 } 1284 for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) { 1285 TypeDecl type = (TypeDecl)outerIter.next(); 1286 for(Iterator iter = type.fieldsIterator(); iter.hasNext(); ) { 1287 FieldDeclaration decl = (FieldDeclaration)iter.next(); 1288 if(!decl.isPrivate() && decl.accessibleFrom(this) && !localFieldsMap().containsKey(decl.name())) 1289 putSimpleSetElement(map, decl.name(), decl); 1290 } 1291 } 1292 return map; 1293 } 1294 protected java.util.Map memberFields_String_values; 1295 /** 1296 * @attribute syn 1297 * @aspect Fields 1298 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:334 1299 */ 1300 @SuppressWarnings({"unchecked", "cast"}) 1301 public SimpleSet memberFields(String name) { 1302 Object _parameters = name; 1303 if(memberFields_String_values == null) memberFields_String_values = new java.util.HashMap(4); 1304 if(memberFields_String_values.containsKey(_parameters)) { 1305 return (SimpleSet)memberFields_String_values.get(_parameters); 1306 } 1307 ASTNode$State state = state(); 1308 int num = state.boundariesCrossed; 1309 boolean isFinal = this.is$Final(); 1310 SimpleSet memberFields_String_value = memberFields_compute(name); 1311 if(isFinal && num == state().boundariesCrossed){ memberFields_String_values.put(_parameters, memberFields_String_value); } 1312 return memberFields_String_value; 1313 } 1314 /** 1315 * @apilevel internal 1316 */ 1317 private SimpleSet memberFields_compute(String name) { 1318 SimpleSet fields = localFields(name); 1319 if(!fields.isEmpty()) 1320 return fields; // this causes hiding of fields in superclass and interfaces 1321 if(hasSuperclass()) { 1322 for(Iterator iter = superclass().memberFields(name).iterator(); iter.hasNext(); ) { 1323 FieldDeclaration decl = (FieldDeclaration)iter.next(); 1324 if(!decl.isPrivate() && decl.accessibleFrom(this)) 1325 fields = fields.add(decl); 1326 } 1327 } 1328 for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) { 1329 TypeDecl type = (TypeDecl)outerIter.next(); 1330 for(Iterator iter = type.memberFields(name).iterator(); iter.hasNext(); ) { 1331 FieldDeclaration decl = (FieldDeclaration)iter.next(); 1332 if(!decl.isPrivate() && decl.accessibleFrom(this)) 1333 fields = fields.add(decl); 1334 } 1335 } 1336 return fields; 1337 } 1338 /** 1339 * @apilevel internal 1340 */ 1341 protected boolean unimplementedMethods_computed = false; 1342 /** 1343 * @apilevel internal 1344 */ 1345 protected Collection unimplementedMethods_value; 1346 /** 1347 * @attribute syn 1348 * @aspect Modifiers 1349 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/Modifiers.jrag:17 1350 */ 1351 @SuppressWarnings({"unchecked", "cast"}) 1352 public Collection unimplementedMethods() { 1353 if(unimplementedMethods_computed) { 1354 return unimplementedMethods_value; 1355 } 1356 ASTNode$State state = state(); 1357 int num = state.boundariesCrossed; 1358 boolean isFinal = this.is$Final(); 1359 unimplementedMethods_value = unimplementedMethods_compute(); 1360 if(isFinal && num == state().boundariesCrossed){ unimplementedMethods_computed = true; } 1361 return unimplementedMethods_value; 1362 } 1363 /** 1364 * @apilevel internal 1365 */ 1366 private Collection unimplementedMethods_compute() { 1367 Collection c = new ArrayList(); 1368 for(Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) { 1369 MethodDecl m = (MethodDecl)iter.next(); 1370 boolean implemented = false; 1371 SimpleSet set = (SimpleSet)localMethodsSignature(m.signature()); 1372 if(set.size() == 1) { 1373 MethodDecl n = (MethodDecl)set.iterator().next(); 1374 if(!n.isAbstract()) 1375 implemented = true; 1376 } 1377 if(!implemented) { 1378 set = (SimpleSet)ancestorMethods(m.signature()); 1379 for(Iterator i2 = set.iterator(); i2.hasNext(); ) { 1380 MethodDecl n = (MethodDecl)i2.next(); 1381 if(!n.isAbstract()) { 1382 implemented = true; 1383 break; 1384 } 1385 } 1386 } 1387 if(!implemented) { 1388 c.add(m); 1389 } 1390 } 1391 1392 if(hasSuperclass()) { 1393 for(Iterator iter = superclass().unimplementedMethods().iterator(); iter.hasNext(); ) { 1394 MethodDecl m = (MethodDecl)iter.next(); 1395 SimpleSet set = (SimpleSet)localMethodsSignature(m.signature()); 1396 if(set.size() == 1) { 1397 MethodDecl n = (MethodDecl)set.iterator().next(); 1398 if(n.isAbstract() || !n.overrides(m)) 1399 c.add(m); 1400 } 1401 else 1402 c.add(m); 1403 } 1404 } 1405 1406 for(Iterator iter = localMethodsIterator(); iter.hasNext(); ) { 1407 MethodDecl m = (MethodDecl)iter.next(); 1408 if(m.isAbstract()) { 1409 c.add(m); 1410 } 1411 } 1412 return c; 1413 } 1414 /** 1415 * @apilevel internal 1416 */ 1417 protected boolean hasAbstract_computed = false; 1418 /** 1419 * @apilevel internal 1420 */ 1421 protected boolean hasAbstract_value; 1422 /** 1423 * @attribute syn 1424 * @aspect Modifiers 1425 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/Modifiers.jrag:66 1426 */ 1427 @SuppressWarnings({"unchecked", "cast"}) 1428 public boolean hasAbstract() { 1429 if(hasAbstract_computed) { 1430 return hasAbstract_value; 1431 } 1432 ASTNode$State state = state(); 1433 int num = state.boundariesCrossed; 1434 boolean isFinal = this.is$Final(); 1435 hasAbstract_value = hasAbstract_compute(); 1436 if(isFinal && num == state().boundariesCrossed){ hasAbstract_computed = true; } 1437 return hasAbstract_value; 1438 } 1439 /** 1440 * @apilevel internal 1441 */ 1442 private boolean hasAbstract_compute() { return !unimplementedMethods().isEmpty(); } 1443 protected java.util.Map castingConversionTo_TypeDecl_values; 1444 /** 1445 * @attribute syn 1446 * @aspect AutoBoxing 1447 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/AutoBoxing.jrag:134 1448 */ 1449 @SuppressWarnings({"unchecked", "cast"}) 1450 public boolean castingConversionTo(TypeDecl type) { 1451 Object _parameters = type; 1452 if(castingConversionTo_TypeDecl_values == null) castingConversionTo_TypeDecl_values = new java.util.HashMap(4); 1453 if(castingConversionTo_TypeDecl_values.containsKey(_parameters)) { 1454 return ((Boolean)castingConversionTo_TypeDecl_values.get(_parameters)).booleanValue(); 1455 } 1456 ASTNode$State state = state(); 1457 int num = state.boundariesCrossed; 1458 boolean isFinal = this.is$Final(); 1459 boolean castingConversionTo_TypeDecl_value = castingConversionTo_compute(type); 1460 if(isFinal && num == state().boundariesCrossed){ castingConversionTo_TypeDecl_values.put(_parameters, Boolean.valueOf(castingConversionTo_TypeDecl_value)); } 1461 return castingConversionTo_TypeDecl_value; 1462 } 1463 /** 1464 * @apilevel internal 1465 */ 1466 private boolean castingConversionTo_compute(TypeDecl type) { 1467 if(refined_Generics_ClassDecl_castingConversionTo_TypeDecl(type)) 1468 return true; 1469 boolean canUnboxThis = !unboxed().isUnknown(); 1470 boolean canUnboxType = !type.unboxed().isUnknown(); 1471 if(canUnboxThis && !canUnboxType) 1472 return unboxed().wideningConversionTo(type); 1473 return false; 1474 /* 1475 else if(unboxingConversionTo(type)) 1476 return true; 1477 return false; 1478 */ 1479 } 1480 /** 1481 * @attribute syn 1482 * @aspect TypeAnalysis 1483 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:209 1484 */ 1485 public boolean isClassDecl() { 1486 ASTNode$State state = state(); 1487 try { return true; } 1488 finally { 1489 } 1490 } 1491 /** 1492 * @apilevel internal 1493 */ 1494 protected boolean isString_computed = false; 1495 /** 1496 * @apilevel internal 1497 */ 1498 protected boolean isString_value; 1499 /** 1500 * @attribute syn 1501 * @aspect TypeAnalysis 1502 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:225 1503 */ 1504 @SuppressWarnings({"unchecked", "cast"}) 1505 public boolean isString() { 1506 if(isString_computed) { 1507 return isString_value; 1508 } 1509 ASTNode$State state = state(); 1510 int num = state.boundariesCrossed; 1511 boolean isFinal = this.is$Final(); 1512 isString_value = isString_compute(); 1513 if(isFinal && num == state().boundariesCrossed){ isString_computed = true; } 1514 return isString_value; 1515 } 1516 /** 1517 * @apilevel internal 1518 */ 1519 private boolean isString_compute() { return fullName().equals("java.lang.String"); } 1520 /** 1521 * @apilevel internal 1522 */ 1523 protected boolean isObject_computed = false; 1524 /** 1525 * @apilevel internal 1526 */ 1527 protected boolean isObject_value; 1528 /** 1529 * @attribute syn 1530 * @aspect TypeAnalysis 1531 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:228 1532 */ 1533 @SuppressWarnings({"unchecked", "cast"}) 1534 public boolean isObject() { 1535 if(isObject_computed) { 1536 return isObject_value; 1537 } 1538 ASTNode$State state = state(); 1539 int num = state.boundariesCrossed; 1540 boolean isFinal = this.is$Final(); 1541 isObject_value = isObject_compute(); 1542 if(isFinal && num == state().boundariesCrossed){ isObject_computed = true; } 1543 return isObject_value; 1544 } 1545 /** 1546 * @apilevel internal 1547 */ 1548 private boolean isObject_compute() { return name().equals("Object") && packageName().equals("java.lang"); } 1549 protected java.util.Map instanceOf_TypeDecl_values; 1550 /** 1551 * @attribute syn 1552 * @aspect GenericsSubtype 1553 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:387 1554 */ 1555 @SuppressWarnings({"unchecked", "cast"}) 1556 public boolean instanceOf(TypeDecl type) { 1557 Object _parameters = type; 1558 if(instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new java.util.HashMap(4); 1559 if(instanceOf_TypeDecl_values.containsKey(_parameters)) { 1560 return ((Boolean)instanceOf_TypeDecl_values.get(_parameters)).booleanValue(); 1561 } 1562 ASTNode$State state = state(); 1563 int num = state.boundariesCrossed; 1564 boolean isFinal = this.is$Final(); 1565 boolean instanceOf_TypeDecl_value = instanceOf_compute(type); 1566 if(isFinal && num == state().boundariesCrossed){ instanceOf_TypeDecl_values.put(_parameters, Boolean.valueOf(instanceOf_TypeDecl_value)); } 1567 return instanceOf_TypeDecl_value; 1568 } 1569 /** 1570 * @apilevel internal 1571 */ 1572 private boolean instanceOf_compute(TypeDecl type) { return subtype(type); } 1573 /** 1574 * @attribute syn 1575 * @aspect TypeWideningAndIdentity 1576 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:423 1577 */ 1578 public boolean isSupertypeOfClassDecl(ClassDecl type) { 1579 ASTNode$State state = state(); 1580 try { 1581 if(super.isSupertypeOfClassDecl(type)) 1582 return true; 1583 return type.hasSuperclass() && type.superclass() != null && type.superclass().instanceOf(this); 1584 } 1585 finally { 1586 } 1587 } 1588 /** 1589 * @attribute syn 1590 * @aspect TypeWideningAndIdentity 1591 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:440 1592 */ 1593 public boolean isSupertypeOfInterfaceDecl(InterfaceDecl type) { 1594 ASTNode$State state = state(); 1595 try { return isObject(); } 1596 finally { 1597 } 1598 } 1599 /** 1600 * @attribute syn 1601 * @aspect TypeWideningAndIdentity 1602 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:453 1603 */ 1604 public boolean isSupertypeOfArrayDecl(ArrayDecl type) { 1605 ASTNode$State state = state(); 1606 try { 1607 if(super.isSupertypeOfArrayDecl(type)) 1608 return true; 1609 return type.hasSuperclass() && type.superclass() != null && type.superclass().instanceOf(this); 1610 } 1611 finally { 1612 } 1613 } 1614 /** 1615 * @attribute syn 1616 * @aspect NestedTypes 1617 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:534 1618 */ 1619 public boolean isInnerClass() { 1620 ASTNode$State state = state(); 1621 try { return isNestedType() && !isStatic() && enclosingType().isClassDecl(); } 1622 finally { 1623 } 1624 } 1625 /** 1626 * @apilevel internal 1627 */ 1628 protected int isCircular_visited = -1; 1629 /** 1630 * @apilevel internal 1631 */ 1632 protected boolean isCircular_computed = false; 1633 /** 1634 * @apilevel internal 1635 */ 1636 protected boolean isCircular_initialized = false; 1637 /** 1638 * @apilevel internal 1639 */ 1640 protected boolean isCircular_value; 1641 /** 1642 * @attribute syn 1643 * @aspect Circularity 1644 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:677 1645 */ 1646 @SuppressWarnings({"unchecked", "cast"}) 1647 public boolean isCircular() { 1648 if(isCircular_computed) { 1649 return isCircular_value; 1650 } 1651 ASTNode$State state = state(); 1652 if (!isCircular_initialized) { 1653 isCircular_initialized = true; 1654 isCircular_value = true; 1655 } 1656 if (!state.IN_CIRCLE) { 1657 state.IN_CIRCLE = true; 1658 int num = state.boundariesCrossed; 1659 boolean isFinal = this.is$Final(); 1660 do { 1661 isCircular_visited = state.CIRCLE_INDEX; 1662 state.CHANGE = false; 1663 boolean new_isCircular_value = isCircular_compute(); 1664 if (new_isCircular_value!=isCircular_value) 1665 state.CHANGE = true; 1666 isCircular_value = new_isCircular_value; 1667 state.CIRCLE_INDEX++; 1668 } while (state.CHANGE); 1669 if(isFinal && num == state().boundariesCrossed) { 1670 isCircular_computed = true; 1671 } 1672 else { 1673 state.RESET_CYCLE = true; 1674 isCircular_compute(); 1675 state.RESET_CYCLE = false; 1676 isCircular_computed = false; 1677 isCircular_initialized = false; 1678 } 1679 state.IN_CIRCLE = false; 1680 return isCircular_value; 1681 } 1682 if(isCircular_visited != state.CIRCLE_INDEX) { 1683 isCircular_visited = state.CIRCLE_INDEX; 1684 if (state.RESET_CYCLE) { 1685 isCircular_computed = false; 1686 isCircular_initialized = false; 1687 isCircular_visited = -1; 1688 return isCircular_value; 1689 } 1690 boolean new_isCircular_value = isCircular_compute(); 1691 if (new_isCircular_value!=isCircular_value) 1692 state.CHANGE = true; 1693 isCircular_value = new_isCircular_value; 1694 return isCircular_value; 1695 } 1696 return isCircular_value; 1697 } 1698 /** 1699 * @apilevel internal 1700 */ 1701 private boolean isCircular_compute() { 1702 if(hasSuperClassAccess()) { 1703 Access a = getSuperClassAccess().lastAccess(); 1704 while(a != null) { 1705 if(a.type().isCircular()) 1706 return true; 1707 a = (a.isQualified() && a.qualifier().isTypeAccess()) ? (Access)a.qualifier() : null; 1708 } 1709 } 1710 for(int i = 0; i < getNumImplements(); i++) { 1711 Access a = getImplements(i).lastAccess(); 1712 while(a != null) { 1713 if(a.type().isCircular()) 1714 return true; 1715 a = (a.isQualified() && a.qualifier().isTypeAccess()) ? (Access)a.qualifier() : null; 1716 } 1717 } 1718 return false; 1719 } 1720 /** 1721 * @apilevel internal 1722 */ 1723 protected boolean typeDescriptor_computed = false; 1724 /** 1725 * @apilevel internal 1726 */ 1727 protected String typeDescriptor_value; 1728 /** 1729 * @attribute syn 1730 * @aspect ConstantPoolNames 1731 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/ConstantPoolNames.jrag:15 1732 */ 1733 @SuppressWarnings({"unchecked", "cast"}) 1734 public String typeDescriptor() { 1735 if(typeDescriptor_computed) { 1736 return typeDescriptor_value; 1737 } 1738 ASTNode$State state = state(); 1739 int num = state.boundariesCrossed; 1740 boolean isFinal = this.is$Final(); 1741 typeDescriptor_value = typeDescriptor_compute(); 1742 if(isFinal && num == state().boundariesCrossed){ typeDescriptor_computed = true; } 1743 return typeDescriptor_value; 1744 } 1745 /** 1746 * @apilevel internal 1747 */ 1748 private String typeDescriptor_compute() { return "L" + constantPoolName() + ";"; } 1749 /** 1750 * @attribute syn 1751 * @aspect CreateBCode 1752 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:820 1753 */ 1754 public String arrayTypeDescriptor() { 1755 ASTNode$State state = state(); 1756 try { return constantPoolName(); } 1757 finally { 1758 } 1759 } 1760 /** 1761 * @attribute syn 1762 * @aspect InnerClasses 1763 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/InnerClasses.jrag:430 1764 */ 1765 public TypeDecl superEnclosing() { 1766 ASTNode$State state = state(); 1767 try { 1768 return superclass().erasure().enclosing(); 1769 } 1770 finally { 1771 } 1772 } 1773 /** 1774 * @attribute syn 1775 * @aspect Annotations 1776 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:225 1777 */ 1778 public Annotation annotation(TypeDecl typeDecl) { 1779 ASTNode$State state = state(); 1780 try { 1781 Annotation a = super.annotation(typeDecl); 1782 if(a != null) return a; 1783 if(hasSuperclass()) { 1784 // If the queried annotation is itself annotation with @Inherited then 1785 // delegate the query to the superclass 1786 if(typeDecl.annotation(lookupType("java.lang.annotation", "Inherited")) != null) 1787 return superclass().annotation(typeDecl); 1788 } 1789 return null; 1790 } 1791 finally { 1792 } 1793 } 1794 /** 1795 * @apilevel internal 1796 */ 1797 protected boolean implementedInterfaces_computed = false; 1798 /** 1799 * @apilevel internal 1800 */ 1801 protected HashSet implementedInterfaces_value; 1802 /** 1803 * @attribute syn 1804 * @aspect GenericsTypeCheck 1805 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:400 1806 */ 1807 @SuppressWarnings({"unchecked", "cast"}) 1808 public HashSet implementedInterfaces() { 1809 if(implementedInterfaces_computed) { 1810 return implementedInterfaces_value; 1811 } 1812 ASTNode$State state = state(); 1813 int num = state.boundariesCrossed; 1814 boolean isFinal = this.is$Final(); 1815 implementedInterfaces_value = implementedInterfaces_compute(); 1816 if(isFinal && num == state().boundariesCrossed){ implementedInterfaces_computed = true; } 1817 return implementedInterfaces_value; 1818 } 1819 /** 1820 * @apilevel internal 1821 */ 1822 private HashSet implementedInterfaces_compute() { 1823 HashSet set = new HashSet(); 1824 if(hasSuperclass()) 1825 set.addAll(superclass().implementedInterfaces()); 1826 for(Iterator iter = interfacesIterator(); iter.hasNext(); ) { 1827 InterfaceDecl decl = (InterfaceDecl)iter.next(); 1828 set.add(decl); 1829 set.addAll(decl.implementedInterfaces()); 1830 } 1831 return set; 1832 } 1833 protected java.util.Map subtype_TypeDecl_values; 1834 /** 1835 * @attribute syn 1836 * @aspect GenericsSubtype 1837 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:407 1838 */ 1839 @SuppressWarnings({"unchecked", "cast"}) 1840 public boolean subtype(TypeDecl type) { 1841 Object _parameters = type; 1842 if(subtype_TypeDecl_values == null) subtype_TypeDecl_values = new java.util.HashMap(4); 1843 ASTNode$State.CircularValue _value; 1844 if(subtype_TypeDecl_values.containsKey(_parameters)) { 1845 Object _o = subtype_TypeDecl_values.get(_parameters); 1846 if(!(_o instanceof ASTNode$State.CircularValue)) { 1847 return ((Boolean)_o).booleanValue(); 1848 } 1849 else 1850 _value = (ASTNode$State.CircularValue)_o; 1851 } 1852 else { 1853 _value = new ASTNode$State.CircularValue(); 1854 subtype_TypeDecl_values.put(_parameters, _value); 1855 _value.value = Boolean.valueOf(true); 1856 } 1857 ASTNode$State state = state(); 1858 if (!state.IN_CIRCLE) { 1859 state.IN_CIRCLE = true; 1860 int num = state.boundariesCrossed; 1861 boolean isFinal = this.is$Final(); 1862 boolean new_subtype_TypeDecl_value; 1863 do { 1864 _value.visited = new Integer(state.CIRCLE_INDEX); 1865 state.CHANGE = false; 1866 new_subtype_TypeDecl_value = subtype_compute(type); 1867 if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 1868 state.CHANGE = true; 1869 _value.value = Boolean.valueOf(new_subtype_TypeDecl_value); 1870 } 1871 state.CIRCLE_INDEX++; 1872 } while (state.CHANGE); 1873 if(isFinal && num == state().boundariesCrossed) { 1874 subtype_TypeDecl_values.put(_parameters, new_subtype_TypeDecl_value); 1875 } 1876 else { 1877 subtype_TypeDecl_values.remove(_parameters); 1878 state.RESET_CYCLE = true; 1879 subtype_compute(type); 1880 state.RESET_CYCLE = false; 1881 } 1882 state.IN_CIRCLE = false; 1883 return new_subtype_TypeDecl_value; 1884 } 1885 if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) { 1886 _value.visited = new Integer(state.CIRCLE_INDEX); 1887 boolean new_subtype_TypeDecl_value = subtype_compute(type); 1888 if (state.RESET_CYCLE) { 1889 subtype_TypeDecl_values.remove(_parameters); 1890 } 1891 else if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) { 1892 state.CHANGE = true; 1893 _value.value = new_subtype_TypeDecl_value; 1894 } 1895 return new_subtype_TypeDecl_value; 1896 } 1897 return ((Boolean)_value.value).booleanValue(); 1898 } 1899 /** 1900 * @apilevel internal 1901 */ 1902 private boolean subtype_compute(TypeDecl type) { return type.supertypeClassDecl(this); } 1903 /** 1904 * @attribute syn 1905 * @aspect GenericsSubtype 1906 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:421 1907 */ 1908 public boolean supertypeClassDecl(ClassDecl type) { 1909 ASTNode$State state = state(); 1910 try { return super.supertypeClassDecl(type) || 1911 type.hasSuperclass() && type.superclass() != null && type.superclass().subtype(this); } 1912 finally { 1913 } 1914 } 1915 /** 1916 * @attribute syn 1917 * @aspect GenericsSubtype 1918 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:437 1919 */ 1920 public boolean supertypeInterfaceDecl(InterfaceDecl type) { 1921 ASTNode$State state = state(); 1922 try { return isObject(); } 1923 finally { 1924 } 1925 } 1926 /** 1927 * @attribute syn 1928 * @aspect GenericsSubtype 1929 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:450 1930 */ 1931 public boolean supertypeArrayDecl(ArrayDecl type) { 1932 ASTNode$State state = state(); 1933 try { 1934 if(super.supertypeArrayDecl(type)) 1935 return true; 1936 return type.hasSuperclass() && type.superclass() != null && type.superclass().subtype(this); 1937 } 1938 finally { 1939 } 1940 } 1941 /** 1942 * @attribute syn 1943 * @aspect GenericsCodegen 1944 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:227 1945 */ 1946 public SimpleSet bridgeCandidates(String signature) { 1947 ASTNode$State state = state(); 1948 try { 1949 SimpleSet set = ancestorMethods(signature); 1950 for(Iterator iter = interfacesMethodsSignature(signature).iterator(); iter.hasNext(); ) 1951 set = set.add(iter.next()); 1952 return set; 1953 } 1954 finally { 1955 } 1956 } 1957 /** 1958 * @apilevel internal 1959 */ 1960 protected boolean needsSignatureAttribute_computed = false; 1961 /** 1962 * @apilevel internal 1963 */ 1964 protected boolean needsSignatureAttribute_value; 1965 /** 1966 * @attribute syn 1967 * @aspect GenericsCodegen 1968 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:347 1969 */ 1970 @SuppressWarnings({"unchecked", "cast"}) 1971 public boolean needsSignatureAttribute() { 1972 if(needsSignatureAttribute_computed) { 1973 return needsSignatureAttribute_value; 1974 } 1975 ASTNode$State state = state(); 1976 int num = state.boundariesCrossed; 1977 boolean isFinal = this.is$Final(); 1978 needsSignatureAttribute_value = needsSignatureAttribute_compute(); 1979 if(isFinal && num == state().boundariesCrossed){ needsSignatureAttribute_computed = true; } 1980 return needsSignatureAttribute_value; 1981 } 1982 /** 1983 * @apilevel internal 1984 */ 1985 private boolean needsSignatureAttribute_compute() { 1986 if(hasSuperclass() && superclass().needsSignatureAttribute()) 1987 return true; 1988 for(Iterator iter = interfacesIterator(); iter.hasNext(); ) 1989 if(((TypeDecl)iter.next()).needsSignatureAttribute()) 1990 return true; 1991 return false; 1992 } 1993 /** 1994 * @apilevel internal 1995 */ 1996 protected boolean classSignature_computed = false; 1997 /** 1998 * @apilevel internal 1999 */ 2000 protected String classSignature_value; 2001 /** 2002 * @attribute syn 2003 * @aspect GenericsCodegen 2004 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:385 2005 */ 2006 @SuppressWarnings({"unchecked", "cast"}) 2007 public String classSignature() { 2008 if(classSignature_computed) { 2009 return classSignature_value; 2010 } 2011 ASTNode$State state = state(); 2012 int num = state.boundariesCrossed; 2013 boolean isFinal = this.is$Final(); 2014 classSignature_value = classSignature_compute(); 2015 if(isFinal && num == state().boundariesCrossed){ classSignature_computed = true; } 2016 return classSignature_value; 2017 } 2018 /** 2019 * @apilevel internal 2020 */ 2021 private String classSignature_compute() { 2022 StringBuffer buf = new StringBuffer(); 2023 // SuperclassSignature 2024 if(hasSuperclass()) 2025 buf.append(superclass().classTypeSignature()); 2026 // SuperinterfaceSignature* 2027 for(Iterator iter = interfacesIterator(); iter.hasNext(); ) 2028 buf.append(((TypeDecl)iter.next()).classTypeSignature()); 2029 return buf.toString(); 2030 } 2031 /** 2032 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/Modifiers.jrag:259 2033 * @apilevel internal 2034 */ 2035 public boolean Define_boolean_mayBeFinal(ASTNode caller, ASTNode child) { 2036 if(caller == getModifiersNoTransform()) { 2037 return true; 2038 } 2039 else { return super.Define_boolean_mayBeFinal(caller, child); 2040 } 2041 } 2042 /** 2043 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/SyntacticClassification.jrag:74 2044 * @apilevel internal 2045 */ 2046 public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) { 2047 if(caller == getImplementsListNoTransform()) { 2048 int childIndex = caller.getIndexOfChild(child); 2049 return NameType.TYPE_NAME; 2050 } 2051 else if(caller == getSuperClassAccessOptNoTransform()) { 2052 return NameType.TYPE_NAME; 2053 } 2054 else { return super.Define_NameType_nameType(caller, child); 2055 } 2056 } 2057 /** 2058 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:579 2059 * @apilevel internal 2060 */ 2061 public TypeDecl Define_TypeDecl_hostType(ASTNode caller, ASTNode child) { 2062 if(caller == getImplementsListNoTransform()) { 2063 int childIndex = caller.getIndexOfChild(child); 2064 return hostType(); 2065 } 2066 else if(caller == getSuperClassAccessOptNoTransform()) { 2067 return hostType(); 2068 } 2069 else { return super.Define_TypeDecl_hostType(caller, child); 2070 } 2071 } 2072 /** 2073 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:276 2074 * @apilevel internal 2075 */ 2076 public boolean Define_boolean_withinSuppressWarnings(ASTNode caller, ASTNode child, String s) { 2077 if(caller == getImplementsListNoTransform()) { 2078 int childIndex = caller.getIndexOfChild(child); 2079 return hasAnnotationSuppressWarnings(s) || withinSuppressWarnings(s); 2080 } 2081 else if(caller == getSuperClassAccessOptNoTransform()) { 2082 return hasAnnotationSuppressWarnings(s) || withinSuppressWarnings(s); 2083 } 2084 else { return super.Define_boolean_withinSuppressWarnings(caller, child, s); 2085 } 2086 } 2087 /** 2088 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:377 2089 * @apilevel internal 2090 */ 2091 public boolean Define_boolean_withinDeprecatedAnnotation(ASTNode caller, ASTNode child) { 2092 if(caller == getImplementsListNoTransform()) { 2093 int childIndex = caller.getIndexOfChild(child); 2094 return isDeprecated() || withinDeprecatedAnnotation(); 2095 } 2096 else if(caller == getSuperClassAccessOptNoTransform()) { 2097 return isDeprecated() || withinDeprecatedAnnotation(); 2098 } 2099 else { return super.Define_boolean_withinDeprecatedAnnotation(caller, child); 2100 } 2101 } 2102 /** 2103 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:269 2104 * @apilevel internal 2105 */ 2106 public boolean Define_boolean_inExtendsOrImplements(ASTNode caller, ASTNode child) { 2107 if(caller == getImplementsListNoTransform()) { 2108 int i = caller.getIndexOfChild(child); 2109 return true; 2110 } 2111 else if(caller == getSuperClassAccessOptNoTransform()) { 2112 return true; 2113 } 2114 else { return getParent().Define_boolean_inExtendsOrImplements(this, caller); 2115 } 2116 } 2117 /** 2118 * @apilevel internal 2119 */ 2120 public ASTNode rewriteTo() { 2121 return super.rewriteTo(); 2122 } 2123 }