001 /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.13-12-g880e696 */ 002 package org.extendj.ast; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.Set; 007 import java.util.Collections; 008 import java.util.Collection; 009 import java.util.ArrayList; 010 import beaver.*; 011 import java.util.*; 012 import java.io.ByteArrayOutputStream; 013 import java.io.PrintStream; 014 import java.lang.reflect.InvocationTargetException; 015 import java.lang.reflect.Method; 016 import org.jastadd.util.*; 017 import java.util.zip.*; 018 import java.io.*; 019 import org.jastadd.util.PrettyPrintable; 020 import org.jastadd.util.PrettyPrinter; 021 import java.io.FileNotFoundException; 022 import java.io.BufferedInputStream; 023 import java.io.DataInputStream; 024 /** 025 * @ast node 026 * @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:41 027 * @production ReferenceType : {@link TypeDecl}; 028 029 */ 030 public abstract class ReferenceType extends TypeDecl implements Cloneable { 031 /** 032 * @aspect CodeGeneration 033 * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:246 034 */ 035 public void emitReturn(CodeGeneration gen) { gen.emit(Bytecode.ARETURN);} 036 /** 037 * @aspect CodeGeneration 038 * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:327 039 */ 040 public void emitLoadLocal(CodeGeneration gen, int pos) { 041 gen.emitLoadReference(pos); 042 } 043 /** 044 * @aspect CodeGeneration 045 * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:470 046 */ 047 public void emitStoreLocal(CodeGeneration gen, int pos) { 048 gen.emitStoreReference(pos); 049 } 050 /** 051 * @aspect CodeGenerationConversions 052 * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:580 053 */ 054 void refined_CodeGenerationConversions_ReferenceType_emitCastTo(CodeGeneration gen, TypeDecl type) { if (!instanceOf(type) && !type.isNull()) gen.emitCheckCast(type); } 055 /** 056 * @aspect CodeGenerationBranch 057 * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:793 058 */ 059 public void branchEQ(CodeGeneration gen, int label) { gen.emitCompare(Bytecode.IF_ACMPEQ, label); } 060 /** 061 * @aspect CodeGenerationBranch 062 * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:802 063 */ 064 public void branchNE(CodeGeneration gen, int label) { gen.emitCompare(Bytecode.IF_ACMPNE, label); } 065 /** 066 * @aspect AutoBoxingCodegen 067 * @declaredat /home/jesper/git/extendj/java5/backend/AutoBoxingCodegen.jrag:38 068 */ 069 void byteToThis(CodeGeneration gen) { 070 if (isUnknown()) { 071 throw new Error("Trying to cast to Unknown"); 072 } 073 if (!isNumericType()) { 074 typeByte().boxed().byteToThis(gen); 075 } else { 076 unboxed().byteToThis(gen); 077 emitBoxingOperation(gen); 078 } 079 } 080 /** 081 * @aspect AutoBoxingCodegen 082 * @declaredat /home/jesper/git/extendj/java5/backend/AutoBoxingCodegen.jrag:49 083 */ 084 void charToThis(CodeGeneration gen) { 085 if (isUnknown()) { 086 throw new Error("Trying to cast to Unknown"); 087 } 088 if (!isNumericType()) { 089 typeChar().boxed().charToThis(gen); 090 } else { 091 unboxed().charToThis(gen); 092 emitBoxingOperation(gen); 093 } 094 } 095 /** 096 * @aspect AutoBoxingCodegen 097 * @declaredat /home/jesper/git/extendj/java5/backend/AutoBoxingCodegen.jrag:60 098 */ 099 void shortToThis(CodeGeneration gen) { 100 if (isUnknown()) { 101 throw new Error("Trying to cast to Unknown"); 102 } 103 if (!isNumericType()) { 104 typeShort().boxed().shortToThis(gen); 105 } else { 106 unboxed().shortToThis(gen); 107 emitBoxingOperation(gen); 108 } 109 } 110 /** 111 * @aspect AutoBoxingCodegen 112 * @declaredat /home/jesper/git/extendj/java5/backend/AutoBoxingCodegen.jrag:71 113 */ 114 void intToThis(CodeGeneration gen) { 115 if (isUnknown()) { 116 throw new Error("Trying to cast to Unknown"); 117 } 118 if (!isNumericType()) { 119 typeInt().boxed().intToThis(gen); 120 } else { 121 unboxed().intToThis(gen); 122 emitBoxingOperation(gen); 123 } 124 } 125 /** 126 * @aspect AutoBoxingCodegen 127 * @declaredat /home/jesper/git/extendj/java5/backend/AutoBoxingCodegen.jrag:82 128 */ 129 void longToThis(CodeGeneration gen) { 130 if (isUnknown()) { 131 throw new Error("Trying to cast to Unknown"); 132 } 133 if (!isNumericType()) { 134 typeLong().boxed().longToThis(gen); 135 } else { 136 unboxed().longToThis(gen); 137 emitBoxingOperation(gen); 138 } 139 } 140 /** 141 * @aspect AutoBoxingCodegen 142 * @declaredat /home/jesper/git/extendj/java5/backend/AutoBoxingCodegen.jrag:93 143 */ 144 void floatToThis(CodeGeneration gen) { 145 if (isUnknown()) { 146 throw new Error("Trying to cast to Unknown"); 147 } 148 if (!isNumericType()) { 149 typeFloat().boxed().floatToThis(gen); 150 } else { 151 unboxed().floatToThis(gen); 152 emitBoxingOperation(gen); 153 } 154 } 155 /** 156 * @aspect AutoBoxingCodegen 157 * @declaredat /home/jesper/git/extendj/java5/backend/AutoBoxingCodegen.jrag:104 158 */ 159 void doubleToThis(CodeGeneration gen) { 160 if (isUnknown()) { 161 throw new Error("Trying to cast to Unknown"); 162 } 163 if (!isNumericType()) { 164 typeDouble().boxed().doubleToThis(gen); 165 } else { 166 unboxed().doubleToThis(gen); 167 emitBoxingOperation(gen); 168 } 169 } 170 /** 171 * @declaredat ASTNode:1 172 */ 173 public ReferenceType() { 174 super(); 175 } 176 /** 177 * Initializes the child array to the correct size. 178 * Initializes List and Opt nta children. 179 * @apilevel internal 180 * @ast method 181 * @declaredat ASTNode:10 182 */ 183 public void init$Children() { 184 children = new ASTNode[2]; 185 setChild(new List(), 1); 186 } 187 /** 188 * @declaredat ASTNode:14 189 */ 190 public ReferenceType(Modifiers p0, String p1, List<BodyDecl> p2) { 191 setChild(p0, 0); 192 setID(p1); 193 setChild(p2, 1); 194 } 195 /** 196 * @declaredat ASTNode:19 197 */ 198 public ReferenceType(Modifiers p0, beaver.Symbol p1, List<BodyDecl> p2) { 199 setChild(p0, 0); 200 setID(p1); 201 setChild(p2, 1); 202 } 203 /** 204 * @apilevel low-level 205 * @declaredat ASTNode:27 206 */ 207 protected int numChildren() { 208 return 2; 209 } 210 /** 211 * @apilevel internal 212 * @declaredat ASTNode:33 213 */ 214 public boolean mayHaveRewrite() { 215 return false; 216 } 217 /** 218 * @apilevel internal 219 * @declaredat ASTNode:39 220 */ 221 public void flushAttrCache() { 222 super.flushAttrCache(); 223 narrowingConversionTo_TypeDecl_reset(); 224 bcFields_reset(); 225 jvmName_reset(); 226 unboxed_reset(); 227 } 228 /** 229 * @apilevel internal 230 * @declaredat ASTNode:49 231 */ 232 public void flushCollectionCache() { 233 super.flushCollectionCache(); 234 } 235 /** 236 * @apilevel internal 237 * @declaredat ASTNode:55 238 */ 239 public void flushRewriteCache() { 240 super.flushRewriteCache(); 241 } 242 /** 243 * @apilevel internal 244 * @declaredat ASTNode:61 245 */ 246 public ReferenceType clone() throws CloneNotSupportedException { 247 ReferenceType node = (ReferenceType) super.clone(); 248 return node; 249 } 250 /** 251 * Create a deep copy of the AST subtree at this node. 252 * The copy is dangling, i.e. has no parent. 253 * @return dangling copy of the subtree at this node 254 * @apilevel low-level 255 * @deprecated Please use treeCopy or treeCopyNoTransform instead 256 * @declaredat ASTNode:72 257 */ 258 @Deprecated 259 public abstract ReferenceType fullCopy(); 260 /** 261 * Create a deep copy of the AST subtree at this node. 262 * The copy is dangling, i.e. has no parent. 263 * @return dangling copy of the subtree at this node 264 * @apilevel low-level 265 * @declaredat ASTNode:80 266 */ 267 public abstract ReferenceType treeCopyNoTransform(); 268 /** 269 * Create a deep copy of the AST subtree at this node. 270 * The subtree of this node is traversed to trigger rewrites before copy. 271 * The copy is dangling, i.e. has no parent. 272 * @return dangling copy of the subtree at this node 273 * @apilevel low-level 274 * @declaredat ASTNode:88 275 */ 276 public abstract ReferenceType treeCopy(); 277 /** 278 * Replaces the Modifiers child. 279 * @param node The new node to replace the Modifiers child. 280 * @apilevel high-level 281 */ 282 public void setModifiers(Modifiers node) { 283 setChild(node, 0); 284 } 285 /** 286 * Retrieves the Modifiers child. 287 * @return The current node used as the Modifiers child. 288 * @apilevel high-level 289 */ 290 @ASTNodeAnnotation.Child(name="Modifiers") 291 public Modifiers getModifiers() { 292 return (Modifiers) getChild(0); 293 } 294 /** 295 * Retrieves the Modifiers child. 296 * <p><em>This method does not invoke AST transformations.</em></p> 297 * @return The current node used as the Modifiers child. 298 * @apilevel low-level 299 */ 300 public Modifiers getModifiersNoTransform() { 301 return (Modifiers) getChildNoTransform(0); 302 } 303 /** 304 * Replaces the lexeme ID. 305 * @param value The new value for the lexeme ID. 306 * @apilevel high-level 307 */ 308 public void setID(String value) { 309 tokenString_ID = value; 310 } 311 /** 312 * JastAdd-internal setter for lexeme ID using the Beaver parser. 313 * @param symbol Symbol containing the new value for the lexeme ID 314 * @apilevel internal 315 */ 316 public void setID(beaver.Symbol symbol) { 317 if (symbol.value != null && !(symbol.value instanceof String)) 318 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 319 tokenString_ID = (String)symbol.value; 320 IDstart = symbol.getStart(); 321 IDend = symbol.getEnd(); 322 } 323 /** 324 * Retrieves the value for the lexeme ID. 325 * @return The value for the lexeme ID. 326 * @apilevel high-level 327 */ 328 @ASTNodeAnnotation.Token(name="ID") 329 public String getID() { 330 return tokenString_ID != null ? tokenString_ID : ""; 331 } 332 /** 333 * Replaces the BodyDecl list. 334 * @param list The new list node to be used as the BodyDecl list. 335 * @apilevel high-level 336 */ 337 public void setBodyDeclList(List<BodyDecl> list) { 338 setChild(list, 1); 339 } 340 /** 341 * Retrieves the number of children in the BodyDecl list. 342 * @return Number of children in the BodyDecl list. 343 * @apilevel high-level 344 */ 345 public int getNumBodyDecl() { 346 return getBodyDeclList().getNumChild(); 347 } 348 /** 349 * Retrieves the number of children in the BodyDecl list. 350 * Calling this method will not trigger rewrites. 351 * @return Number of children in the BodyDecl list. 352 * @apilevel low-level 353 */ 354 public int getNumBodyDeclNoTransform() { 355 return getBodyDeclListNoTransform().getNumChildNoTransform(); 356 } 357 /** 358 * Retrieves the element at index {@code i} in the BodyDecl list. 359 * @param i Index of the element to return. 360 * @return The element at position {@code i} in the BodyDecl list. 361 * @apilevel high-level 362 */ 363 public BodyDecl getBodyDecl(int i) { 364 return (BodyDecl) getBodyDeclList().getChild(i); 365 } 366 /** 367 * Check whether the BodyDecl list has any children. 368 * @return {@code true} if it has at least one child, {@code false} otherwise. 369 * @apilevel high-level 370 */ 371 public boolean hasBodyDecl() { 372 return getBodyDeclList().getNumChild() != 0; 373 } 374 /** 375 * Append an element to the BodyDecl list. 376 * @param node The element to append to the BodyDecl list. 377 * @apilevel high-level 378 */ 379 public void addBodyDecl(BodyDecl node) { 380 List<BodyDecl> list = (parent == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); 381 list.addChild(node); 382 } 383 /** 384 * @apilevel low-level 385 */ 386 public void addBodyDeclNoTransform(BodyDecl node) { 387 List<BodyDecl> list = getBodyDeclListNoTransform(); 388 list.addChild(node); 389 } 390 /** 391 * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. 392 * @param node The new node to replace the old list element. 393 * @param i The list index of the node to be replaced. 394 * @apilevel high-level 395 */ 396 public void setBodyDecl(BodyDecl node, int i) { 397 List<BodyDecl> list = getBodyDeclList(); 398 list.setChild(node, i); 399 } 400 /** 401 * Retrieves the BodyDecl list. 402 * @return The node representing the BodyDecl list. 403 * @apilevel high-level 404 */ 405 @ASTNodeAnnotation.ListChild(name="BodyDecl") 406 public List<BodyDecl> getBodyDeclList() { 407 List<BodyDecl> list = (List<BodyDecl>) getChild(1); 408 return list; 409 } 410 /** 411 * Retrieves the BodyDecl list. 412 * <p><em>This method does not invoke AST transformations.</em></p> 413 * @return The node representing the BodyDecl list. 414 * @apilevel low-level 415 */ 416 public List<BodyDecl> getBodyDeclListNoTransform() { 417 return (List<BodyDecl>) getChildNoTransform(1); 418 } 419 /** 420 * Retrieves the BodyDecl list. 421 * @return The node representing the BodyDecl list. 422 * @apilevel high-level 423 */ 424 public List<BodyDecl> getBodyDecls() { 425 return getBodyDeclList(); 426 } 427 /** 428 * Retrieves the BodyDecl list. 429 * <p><em>This method does not invoke AST transformations.</em></p> 430 * @return The node representing the BodyDecl list. 431 * @apilevel low-level 432 */ 433 public List<BodyDecl> getBodyDeclsNoTransform() { 434 return getBodyDeclListNoTransform(); 435 } 436 /** 437 * @aspect AutoBoxingCodegen 438 * @declaredat /home/jesper/git/extendj/java5/backend/AutoBoxingCodegen.jrag:125 439 */ 440 public void emitCastTo(CodeGeneration gen, TypeDecl type) { 441 if (type instanceof PrimitiveType) { 442 emitUnboxingOperation(gen); 443 unboxed().emitCastTo(gen, type); 444 } else { 445 refined_CodeGenerationConversions_ReferenceType_emitCastTo(gen, type); 446 } 447 } 448 /** 449 * @attribute syn 450 * @aspect TypeConversion 451 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:38 452 */ 453 @ASTNodeAnnotation.Attribute 454 public boolean wideningConversionTo(TypeDecl type) { 455 boolean wideningConversionTo_TypeDecl_value = instanceOf(type); 456 457 return wideningConversionTo_TypeDecl_value; 458 } 459 /** 460 * @apilevel internal 461 */ 462 protected java.util.Map narrowingConversionTo_TypeDecl_values; 463 /** 464 * @apilevel internal 465 */ 466 private void narrowingConversionTo_TypeDecl_reset() { 467 narrowingConversionTo_TypeDecl_values = null; 468 } 469 /** 470 * @attribute syn 471 * @aspect TypeConversion 472 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:39 473 */ 474 @ASTNodeAnnotation.Attribute 475 public boolean narrowingConversionTo(TypeDecl type) { 476 Object _parameters = type; 477 if (narrowingConversionTo_TypeDecl_values == null) narrowingConversionTo_TypeDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap()); 478 ASTNode$State state = state(); 479 if (narrowingConversionTo_TypeDecl_values.containsKey(_parameters)) { 480 return (Boolean) narrowingConversionTo_TypeDecl_values.get(_parameters); 481 } 482 boolean intermediate = state.INTERMEDIATE_VALUE; 483 state.INTERMEDIATE_VALUE = false; 484 int num = state.boundariesCrossed; 485 boolean isFinal = this.is$Final(); 486 boolean narrowingConversionTo_TypeDecl_value = narrowingConversionTo_compute(type); 487 if (isFinal && num == state().boundariesCrossed) { 488 narrowingConversionTo_TypeDecl_values.put(_parameters, narrowingConversionTo_TypeDecl_value); 489 } else { 490 } 491 state.INTERMEDIATE_VALUE |= intermediate; 492 493 return narrowingConversionTo_TypeDecl_value; 494 } 495 /** 496 * @apilevel internal 497 */ 498 private boolean narrowingConversionTo_compute(TypeDecl type) { 499 if (type.instanceOf(this)) { 500 return true; 501 } 502 if (isClassDecl() && !getModifiers().isFinal() && type.isInterfaceDecl()) { 503 return true; 504 } 505 if (isInterfaceDecl() && type.isClassDecl() && !type.getModifiers().isFinal()) { 506 return true; 507 } 508 if (isInterfaceDecl() && type.instanceOf(this)) { 509 return true; 510 } 511 if (fullName().equals("java.lang.Object") && type.isInterfaceDecl()) { 512 return true; 513 } 514 // Dragons 515 // TODO: Check if both are interfaces with compatible methods 516 if (isArrayDecl() && type.isArrayDecl() && elementType().instanceOf(type.elementType())) { 517 return true; 518 } 519 return false; 520 } 521 /** 522 * @attribute syn 523 * @aspect TypeAnalysis 524 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:187 525 */ 526 @ASTNodeAnnotation.Attribute 527 public boolean isReferenceType() { 528 boolean isReferenceType_value = true; 529 530 return isReferenceType_value; 531 } 532 /** 533 * @attribute syn 534 * @aspect TypeWideningAndIdentity 535 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:527 536 */ 537 @ASTNodeAnnotation.Attribute 538 public boolean isSupertypeOfNullType(NullType type) { 539 boolean isSupertypeOfNullType_NullType_value = true; 540 541 return isSupertypeOfNullType_NullType_value; 542 } 543 /** 544 * @attribute syn 545 * @aspect CodeGeneration 546 * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:249 547 */ 548 @ASTNodeAnnotation.Attribute 549 public byte arrayLoad() { 550 byte arrayLoad_value = Bytecode.AALOAD; 551 552 return arrayLoad_value; 553 } 554 /** 555 * @attribute syn 556 * @aspect CodeGeneration 557 * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:380 558 */ 559 @ASTNodeAnnotation.Attribute 560 public byte arrayStore() { 561 byte arrayStore_value = Bytecode.AASTORE; 562 563 return arrayStore_value; 564 } 565 /** 566 * @apilevel internal 567 */ 568 protected boolean bcFields_computed = false; 569 /** 570 * @apilevel internal 571 */ 572 protected Collection bcFields_value; 573 /** 574 * @apilevel internal 575 */ 576 private void bcFields_reset() { 577 bcFields_computed = false; 578 bcFields_value = null; 579 } 580 /** 581 * @attribute syn 582 * @aspect GenerateClassfile 583 * @declaredat /home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag:317 584 */ 585 @ASTNodeAnnotation.Attribute 586 public Collection bcFields() { 587 ASTNode$State state = state(); 588 if (bcFields_computed) { 589 return bcFields_value; 590 } 591 boolean intermediate = state.INTERMEDIATE_VALUE; 592 state.INTERMEDIATE_VALUE = false; 593 int num = state.boundariesCrossed; 594 boolean isFinal = this.is$Final(); 595 bcFields_value = bcFields_compute(); 596 if (isFinal && num == state().boundariesCrossed) { 597 bcFields_computed = true; 598 } else { 599 } 600 state.INTERMEDIATE_VALUE |= intermediate; 601 602 return bcFields_value; 603 } 604 /** 605 * @apilevel internal 606 */ 607 private Collection bcFields_compute() { 608 ArrayList l = new ArrayList(); 609 for (int i = 0; i < getNumBodyDecl(); i++) { 610 if (getBodyDecl(i).isBytecodeField()) { 611 l.add(getBodyDecl(i)); 612 } 613 } 614 return l; 615 } 616 /** 617 * @attribute syn 618 * @aspect GenerateClassfile 619 * @declaredat /home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag:328 620 */ 621 @ASTNodeAnnotation.Attribute 622 public Collection bcMethods() { 623 { 624 ArrayList l = new ArrayList(); 625 for (int i = 0; i < getNumBodyDecl(); i++) { 626 if (getBodyDecl(i).isBytecodeMethod()) { 627 l.add(getBodyDecl(i)); 628 } 629 } 630 return l; 631 } 632 } 633 /** 634 * @attribute syn 635 * @aspect InnerClasses 636 * @declaredat /home/jesper/git/extendj/java4/backend/InnerClasses.jrag:113 637 */ 638 @ASTNodeAnnotation.Attribute 639 public TypeDecl stringPromotion() { 640 TypeDecl stringPromotion_value = typeObject(); 641 642 return stringPromotion_value; 643 } 644 /** 645 * @apilevel internal 646 */ 647 protected boolean jvmName_computed = false; 648 /** 649 * @apilevel internal 650 */ 651 protected String jvmName_value; 652 /** 653 * @apilevel internal 654 */ 655 private void jvmName_reset() { 656 jvmName_computed = false; 657 jvmName_value = null; 658 } 659 /** 660 * @attribute syn 661 * @aspect Java2Rewrites 662 * @declaredat /home/jesper/git/extendj/java4/backend/Java2Rewrites.jrag:36 663 */ 664 @ASTNodeAnnotation.Attribute 665 public String jvmName() { 666 ASTNode$State state = state(); 667 if (jvmName_computed) { 668 return jvmName_value; 669 } 670 boolean intermediate = state.INTERMEDIATE_VALUE; 671 state.INTERMEDIATE_VALUE = false; 672 int num = state.boundariesCrossed; 673 boolean isFinal = this.is$Final(); 674 jvmName_value = jvmName_compute(); 675 if (isFinal && num == state().boundariesCrossed) { 676 jvmName_computed = true; 677 } else { 678 } 679 state.INTERMEDIATE_VALUE |= intermediate; 680 681 return jvmName_value; 682 } 683 /** 684 * @apilevel internal 685 */ 686 private String jvmName_compute() { 687 if (!isNestedType()) { 688 return fullName(); 689 } else if (isAnonymous() || isLocalClass()) { 690 return enclosingType().jvmName() + "$" + uniqueIndex() + name(); 691 } else { 692 return enclosingType().jvmName() + "$" + name(); 693 } 694 } 695 /** 696 * @attribute syn 697 * @aspect Java2Rewrites 698 * @declaredat /home/jesper/git/extendj/java4/backend/Java2Rewrites.jrag:81 699 */ 700 @ASTNodeAnnotation.Attribute 701 public String referenceClassFieldName() { 702 String referenceClassFieldName_value = "class$" + jvmName().replace('[', '$').replace('.', '$').replace(';', ' ').trim(); 703 704 return referenceClassFieldName_value; 705 } 706 /** 707 * @attribute syn 708 * @aspect LocalNum 709 * @declaredat /home/jesper/git/extendj/java4/backend/LocalNum.jrag:199 710 */ 711 @ASTNodeAnnotation.Attribute 712 public int variableSize() { 713 int variableSize_value = 1; 714 715 return variableSize_value; 716 } 717 /** 718 * @attribute syn 719 * @aspect Annotations 720 * @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:151 721 */ 722 @ASTNodeAnnotation.Attribute 723 public boolean isValidAnnotationMethodReturnType() { 724 { 725 if (isString()) { 726 return true; 727 } 728 if (fullName().equals("java.lang.Class")) { 729 return true; 730 } 731 // include generic versions of Class 732 if (erasure().fullName().equals("java.lang.Class")) { 733 return true; 734 } 735 return false; 736 } 737 } 738 /** 739 * @attribute syn 740 * @aspect AutoBoxing 741 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:68 742 */ 743 @ASTNodeAnnotation.Attribute 744 public boolean unboxingConversionTo(TypeDecl typeDecl) { 745 boolean unboxingConversionTo_TypeDecl_value = unboxed() == typeDecl; 746 747 return unboxingConversionTo_TypeDecl_value; 748 } 749 /** 750 * @apilevel internal 751 */ 752 protected boolean unboxed_computed = false; 753 /** 754 * @apilevel internal 755 */ 756 protected TypeDecl unboxed_value; 757 /** 758 * @apilevel internal 759 */ 760 private void unboxed_reset() { 761 unboxed_computed = false; 762 unboxed_value = null; 763 } 764 /** 765 * @attribute syn 766 * @aspect AutoBoxing 767 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:72 768 */ 769 @ASTNodeAnnotation.Attribute 770 public TypeDecl unboxed() { 771 ASTNode$State state = state(); 772 if (unboxed_computed) { 773 return unboxed_value; 774 } 775 boolean intermediate = state.INTERMEDIATE_VALUE; 776 state.INTERMEDIATE_VALUE = false; 777 int num = state.boundariesCrossed; 778 boolean isFinal = this.is$Final(); 779 unboxed_value = unboxed_compute(); 780 if (isFinal && num == state().boundariesCrossed) { 781 unboxed_computed = true; 782 } else { 783 } 784 state.INTERMEDIATE_VALUE |= intermediate; 785 786 return unboxed_value; 787 } 788 /** 789 * @apilevel internal 790 */ 791 private TypeDecl unboxed_compute() { 792 if (packageName().equals("java.lang") && isTopLevelType()) { 793 String n = name(); 794 if (n.equals("Boolean")) { 795 return typeBoolean(); 796 } 797 if (n.equals("Byte")) { 798 return typeByte(); 799 } 800 if (n.equals("Character")) { 801 return typeChar(); 802 } 803 if (n.equals("Short")) { 804 return typeShort(); 805 } 806 if (n.equals("Integer")) { 807 return typeInt(); 808 } 809 if (n.equals("Long")) { 810 return typeLong(); 811 } 812 if (n.equals("Float")) { 813 return typeFloat(); 814 } 815 if (n.equals("Double")) { 816 return typeDouble(); 817 } 818 } 819 return unknownType(); 820 } 821 /** 822 * @attribute syn 823 * @aspect NumericPromotion 824 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:167 825 */ 826 @ASTNodeAnnotation.Attribute 827 public TypeDecl unaryNumericPromotion() { 828 TypeDecl unaryNumericPromotion_value = isNumericType() && !isUnknown() ? unboxed().unaryNumericPromotion() : this; 829 830 return unaryNumericPromotion_value; 831 } 832 /** 833 * @attribute syn 834 * @aspect NumericPromotion 835 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:175 836 */ 837 @ASTNodeAnnotation.Attribute 838 public TypeDecl binaryNumericPromotion(TypeDecl type) { 839 TypeDecl binaryNumericPromotion_TypeDecl_value = unboxed().binaryNumericPromotion(type); 840 841 return binaryNumericPromotion_TypeDecl_value; 842 } 843 /** 844 * @attribute syn 845 * @aspect TypeAnalysis 846 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:195 847 */ 848 @ASTNodeAnnotation.Attribute 849 public boolean isNumericType() { 850 boolean isNumericType_value = !unboxed().isUnknown() && unboxed().isNumericType(); 851 852 return isNumericType_value; 853 } 854 /** 855 * @attribute syn 856 * @aspect TypeAnalysis 857 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:199 858 */ 859 @ASTNodeAnnotation.Attribute 860 public boolean isIntegralType() { 861 boolean isIntegralType_value = !unboxed().isUnknown() && unboxed().isIntegralType(); 862 863 return isIntegralType_value; 864 } 865 /** 866 * @attribute syn 867 * @aspect TypeAnalysis 868 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:245 869 */ 870 @ASTNodeAnnotation.Attribute 871 public boolean isPrimitive() { 872 boolean isPrimitive_value = !unboxed().isUnknown() && unboxed().isPrimitive(); 873 874 return isPrimitive_value; 875 } 876 /** 877 * @attribute syn 878 * @aspect TypeAnalysis 879 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:203 880 */ 881 @ASTNodeAnnotation.Attribute 882 public boolean isBoolean() { 883 boolean isBoolean_value = fullName().equals("java.lang.Boolean") && unboxed().isBoolean(); 884 885 return isBoolean_value; 886 } 887 /** 888 * @attribute syn 889 * @aspect GenericsSubtype 890 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:514 891 */ 892 @ASTNodeAnnotation.Attribute 893 public boolean supertypeNullType(NullType type) { 894 boolean supertypeNullType_NullType_value = true; 895 896 return supertypeNullType_NullType_value; 897 } 898 /** 899 * @attribute syn 900 * @aspect StrictSubtype 901 * @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:446 902 */ 903 @ASTNodeAnnotation.Attribute 904 public boolean strictSupertypeNullType(NullType type) { 905 boolean strictSupertypeNullType_NullType_value = true; 906 907 return strictSupertypeNullType_NullType_value; 908 } 909 /** 910 * @attribute inh 911 * @aspect AutoBoxing 912 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:103 913 */ 914 /** 915 * @attribute inh 916 * @aspect AutoBoxing 917 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:103 918 */ 919 @ASTNodeAnnotation.Attribute 920 public TypeDecl typeBoolean() { 921 TypeDecl typeBoolean_value = getParent().Define_typeBoolean(this, null); 922 923 return typeBoolean_value; 924 } 925 /** 926 * @attribute inh 927 * @aspect AutoBoxing 928 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:104 929 */ 930 /** 931 * @attribute inh 932 * @aspect AutoBoxing 933 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:104 934 */ 935 @ASTNodeAnnotation.Attribute 936 public TypeDecl typeByte() { 937 TypeDecl typeByte_value = getParent().Define_typeByte(this, null); 938 939 return typeByte_value; 940 } 941 /** 942 * @attribute inh 943 * @aspect AutoBoxing 944 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:105 945 */ 946 /** 947 * @attribute inh 948 * @aspect AutoBoxing 949 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:105 950 */ 951 @ASTNodeAnnotation.Attribute 952 public TypeDecl typeChar() { 953 TypeDecl typeChar_value = getParent().Define_typeChar(this, null); 954 955 return typeChar_value; 956 } 957 /** 958 * @attribute inh 959 * @aspect AutoBoxing 960 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:106 961 */ 962 /** 963 * @attribute inh 964 * @aspect AutoBoxing 965 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:106 966 */ 967 @ASTNodeAnnotation.Attribute 968 public TypeDecl typeShort() { 969 TypeDecl typeShort_value = getParent().Define_typeShort(this, null); 970 971 return typeShort_value; 972 } 973 /** 974 * @attribute inh 975 * @aspect AutoBoxing 976 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:107 977 */ 978 /** 979 * @attribute inh 980 * @aspect AutoBoxing 981 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:107 982 */ 983 @ASTNodeAnnotation.Attribute 984 public TypeDecl typeInt() { 985 TypeDecl typeInt_value = getParent().Define_typeInt(this, null); 986 987 return typeInt_value; 988 } 989 /** 990 * @attribute inh 991 * @aspect AutoBoxing 992 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:108 993 */ 994 /** 995 * @attribute inh 996 * @aspect AutoBoxing 997 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:108 998 */ 999 @ASTNodeAnnotation.Attribute 1000 public TypeDecl typeLong() { 1001 TypeDecl typeLong_value = getParent().Define_typeLong(this, null); 1002 1003 return typeLong_value; 1004 } 1005 /** 1006 * @attribute inh 1007 * @aspect AutoBoxing 1008 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:109 1009 */ 1010 /** 1011 * @attribute inh 1012 * @aspect AutoBoxing 1013 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:109 1014 */ 1015 @ASTNodeAnnotation.Attribute 1016 public TypeDecl typeFloat() { 1017 TypeDecl typeFloat_value = getParent().Define_typeFloat(this, null); 1018 1019 return typeFloat_value; 1020 } 1021 /** 1022 * @attribute inh 1023 * @aspect AutoBoxing 1024 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:110 1025 */ 1026 /** 1027 * @attribute inh 1028 * @aspect AutoBoxing 1029 * @declaredat /home/jesper/git/extendj/java5/frontend/AutoBoxing.jrag:110 1030 */ 1031 @ASTNodeAnnotation.Attribute 1032 public TypeDecl typeDouble() { 1033 TypeDecl typeDouble_value = getParent().Define_typeDouble(this, null); 1034 1035 return typeDouble_value; 1036 } 1037 /** 1038 * @apilevel internal 1039 */ 1040 public ASTNode rewriteTo() { 1041 return super.rewriteTo(); 1042 } 1043 }