All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.extendj.ast.InterfaceDecl Maven / Gradle / Ivy

There is a newer version: 8.1.2
Show newest version
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.3.0 */
package org.extendj.ast;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.ArrayList;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.zip.*;
import java.io.*;
import org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import org.jastadd.util.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.util.Set;
import beaver.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
/**
 * @ast node
 * @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:155
 * @astdecl InterfaceDecl : ReferenceType ::= Modifiers  SuperInterface:Access* BodyDecl*;
 * @production InterfaceDecl : {@link ReferenceType} ::= {@link Modifiers} <ID:String> SuperInterface:{@link Access}* {@link BodyDecl}*;

 */
public class InterfaceDecl extends ReferenceType implements Cloneable {
  /**
   * @aspect Java4PrettyPrint
   * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:402
   */
  public void prettyPrint(PrettyPrinter out) {
    if (hasDocComment()) {
      out.print(docComment());
    }
    if (!out.isNewLine()) {
      out.println();
    }
    out.print(getModifiers());
    out.print("interface ");
    out.print(getID());
    if (hasSuperInterface()) {
      out.print(" extends ");
      out.join(getSuperInterfaceList(), new PrettyPrinter.Joiner() {
        @Override
        public void printSeparator(PrettyPrinter out) {
          out.print(", ");
        }
      });
    }
    out.print(" {");
    out.println();
    out.indent(1);
    out.join(getBodyDecls(), new PrettyPrinter.Joiner() {
      @Override
      public void printSeparator(PrettyPrinter out) {
        out.println();
        out.println();
      }
    });
    if (!out.isNewLine()) {
      out.println();
    }
    out.print("}");
  }
  /**
   * @aspect Generics
   * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:310
   */
  public TypeDecl makeGeneric(Signatures.ClassSignature s) {
    if (s.hasFormalTypeParameters()) {
      ASTNode node = getParent();
      int index = node.getIndexOfChild(this);
      node.setChild(
          new GenericInterfaceDecl(
              getModifiersNoTransform(),
              getID(),
              s.hasSuperinterfaceSignature()
                  ? s.superinterfaceSignature()
                  : getSuperInterfaceListNoTransform(),
              getBodyDeclListNoTransform(),
              s.typeParameters()),
          index);
      return (TypeDecl) node.getChildNoTransform(index);
    } else {
      if (s.hasSuperinterfaceSignature()) {
        setSuperInterfaceList(s.superinterfaceSignature());
      }
      return this;
    }
  }
  /**
   * @aspect GenerateClassfile
   * @declaredat /home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag:181
   */
  public void generateClassfile() {
    super.generateClassfile();
    String fileName = destinationPath();
    if (program().options().verbose()) {
      System.out.println("Writing class file to " + fileName);
    }
    try {
      ConstantPool cp = constantPool();
      // Force building of constant pool.
      cp.addClass(constantPoolName());
      cp.addClass("java/lang/Object");
      for (int i = 0; i < getNumSuperInterface(); i++) {
        cp.addClass(getSuperInterface(i).type().constantPoolName());
      }
      for (FieldDeclarator field : fieldDeclarations()) {
        cp.addUtf8(field.name());
        cp.addUtf8(field.type().typeDescriptor());
        field.attributes();
      }
      for (BodyDecl obj : methodsAndConstructors()) {
        if (obj instanceof MethodDecl) {
          MethodDecl method = (MethodDecl) obj;
          cp.addUtf8(method.name());
          cp.addUtf8(method.descName());
          method.attributes();
        }
      }
      attributes();

      if (hasClinit()) {
        cp.addUtf8("");
        cp.addUtf8("()V");
        clinit_attributes();
      }

      // Actual classfile generation.
      File dest = new File(fileName);
      File parentFile = dest.getParentFile();
      if (parentFile != null) {
        parentFile.mkdirs();
      }

      FileOutputStream f = new FileOutputStream(fileName);
      DataOutputStream out = new DataOutputStream(new BufferedOutputStream(f));
      out.writeInt(magicHeader());
      out.writeChar(minorVersion());
      out.writeChar(majorVersion());
      cp.emit(out);
      int flags = flags();
      if (isNestedType()) {
        flags = mangledFlags(flags);
      }
      if (isInterfaceDecl()) {
        flags |= Modifiers.ACC_INTERFACE;
      }
      out.writeChar(flags);
      out.writeChar(cp.addClass(constantPoolName()));
      out.writeChar(cp.addClass("java/lang/Object"));
      if (getNumSuperInterface() == 1 && getSuperInterface(0).type().isObject()) {
        out.writeChar(0);
      } else {
        out.writeChar(getNumSuperInterface());
      }
      for (int i = 0; i < getNumSuperInterface(); i++) {
        TypeDecl typeDecl = getSuperInterface(i).type();
        if (typeDecl.isInterfaceDecl()) {
          out.writeChar(cp.addClass(typeDecl.constantPoolName()));
        }
      }
      Collection fields = fieldDeclarations();
      out.writeChar(fields.size());
      for (FieldDeclarator field : fields) {
        out.writeChar(field.flags());
        out.writeChar(cp.addUtf8(field.name()));
        out.writeChar(cp.addUtf8(field.type().typeDescriptor()));
        out.writeChar(field.attributes().size());
        for (Attribute attribute : field.attributes()) {
          attribute.emit(out);
        }
      }
      Collection methods = methodsAndConstructors();
      out.writeChar(methods.size() + (hasClinit() ? 1 : 0));
      for (BodyDecl b : methods) {
        b.generateMethod(out, cp);
      }
      if (hasClinit()) {
        out.writeChar(Modifiers.ACC_STATIC);
        out.writeChar(cp.addUtf8(""));
        out.writeChar(cp.addUtf8("()V"));
        out.writeChar(clinit_attributes().size());
        for (Attribute attribute : clinit_attributes()) {
          attribute.emit(out);
        }
      }
      out.writeChar(attributes().size());
      for (Attribute attribute : attributes()) {
        attribute.emit(out);
      }
      out.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  /**
   * @declaredat ASTNode:1
   */
  public InterfaceDecl() {
    super();
  }
  /**
   * Initializes the child array to the correct size.
   * Initializes List and Opt nta children.
   * @apilevel internal
   * @ast method
   * @declaredat ASTNode:10
   */
  public void init$Children() {
    children = new ASTNode[3];
    setChild(new List(), 1);
    setChild(new List(), 2);
  }
  /**
   * @declaredat ASTNode:15
   */
  @ASTNodeAnnotation.Constructor(
    name = {"Modifiers", "ID", "SuperInterface", "BodyDecl"},
    type = {"Modifiers", "String", "List", "List"},
    kind = {"Child", "Token", "List", "List"}
  )
  public InterfaceDecl(Modifiers p0, String p1, List p2, List p3) {
    setChild(p0, 0);
    setID(p1);
    setChild(p2, 1);
    setChild(p3, 2);
  }
  /**
   * @declaredat ASTNode:26
   */
  public InterfaceDecl(Modifiers p0, beaver.Symbol p1, List p2, List p3) {
    setChild(p0, 0);
    setID(p1);
    setChild(p2, 1);
    setChild(p3, 2);
  }
  /** @apilevel low-level 
   * @declaredat ASTNode:33
   */
  protected int numChildren() {
    return 3;
  }
  /**
   * @apilevel internal
   * @declaredat ASTNode:39
   */
  public boolean mayHaveRewrite() {
    return false;
  }
  /** @apilevel internal 
   * @declaredat ASTNode:43
   */
  public void flushAttrCache() {
    super.flushAttrCache();
    castingConversionTo_TypeDecl_reset();
    instanceOf_TypeDecl_reset();
    superInterfaces_reset();
    isCircular_reset();
    methodsSignatureMap_reset();
    ancestorMethods_String_reset();
    memberFieldsMap_reset();
    memberFields_String_reset();
    isStatic_reset();
    erasedAncestorMethodsMap_reset();
    implementedInterfaces_reset();
    subtype_TypeDecl_reset();
    iterableElementType_reset();
    typeDescriptor_reset();
    bridgeCandidates_String_reset();
    needsSignatureAttribute_reset();
    classSignature_reset();
  }
  /** @apilevel internal 
   * @declaredat ASTNode:64
   */
  public void flushCollectionCache() {
    super.flushCollectionCache();
  }
  /** @apilevel internal 
   * @declaredat ASTNode:68
   */
  public InterfaceDecl clone() throws CloneNotSupportedException {
    InterfaceDecl node = (InterfaceDecl) super.clone();
    return node;
  }
  /** @apilevel internal 
   * @declaredat ASTNode:73
   */
  public InterfaceDecl copy() {
    try {
      InterfaceDecl node = (InterfaceDecl) clone();
      node.parent = null;
      if (children != null) {
        node.children = (ASTNode[]) children.clone();
      }
      return node;
    } catch (CloneNotSupportedException e) {
      throw new Error("Error: clone not supported for " + getClass().getName());
    }
  }
  /**
   * Create a deep copy of the AST subtree at this node.
   * The copy is dangling, i.e. has no parent.
   * @return dangling copy of the subtree at this node
   * @apilevel low-level
   * @deprecated Please use treeCopy or treeCopyNoTransform instead
   * @declaredat ASTNode:92
   */
  @Deprecated
  public InterfaceDecl fullCopy() {
    return treeCopyNoTransform();
  }
  /**
   * Create a deep copy of the AST subtree at this node.
   * The copy is dangling, i.e. has no parent.
   * @return dangling copy of the subtree at this node
   * @apilevel low-level
   * @declaredat ASTNode:102
   */
  public InterfaceDecl treeCopyNoTransform() {
    InterfaceDecl tree = (InterfaceDecl) copy();
    if (children != null) {
      for (int i = 0; i < children.length; ++i) {
        ASTNode child = (ASTNode) children[i];
        if (child != null) {
          child = child.treeCopyNoTransform();
          tree.setChild(child, i);
        }
      }
    }
    return tree;
  }
  /**
   * Create a deep copy of the AST subtree at this node.
   * The subtree of this node is traversed to trigger rewrites before copy.
   * The copy is dangling, i.e. has no parent.
   * @return dangling copy of the subtree at this node
   * @apilevel low-level
   * @declaredat ASTNode:122
   */
  public InterfaceDecl treeCopy() {
    InterfaceDecl tree = (InterfaceDecl) copy();
    if (children != null) {
      for (int i = 0; i < children.length; ++i) {
        ASTNode child = (ASTNode) getChild(i);
        if (child != null) {
          child = child.treeCopy();
          tree.setChild(child, i);
        }
      }
    }
    return tree;
  }
  /** @apilevel internal 
   * @declaredat ASTNode:136
   */
  protected boolean is$Equal(ASTNode node) {
    return super.is$Equal(node) && (tokenString_ID == ((InterfaceDecl) node).tokenString_ID);    
  }
  /**
   * Replaces the Modifiers child.
   * @param node The new node to replace the Modifiers child.
   * @apilevel high-level
   */
  public void setModifiers(Modifiers node) {
    setChild(node, 0);
  }
  /**
   * Retrieves the Modifiers child.
   * @return The current node used as the Modifiers child.
   * @apilevel high-level
   */
  @ASTNodeAnnotation.Child(name="Modifiers")
  public Modifiers getModifiers() {
    return (Modifiers) getChild(0);
  }
  /**
   * Retrieves the Modifiers child.
   * 

This method does not invoke AST transformations.

* @return The current node used as the Modifiers child. * @apilevel low-level */ public Modifiers getModifiersNoTransform() { return (Modifiers) getChildNoTransform(0); } /** * Replaces the lexeme ID. * @param value The new value for the lexeme ID. * @apilevel high-level */ public void setID(String value) { tokenString_ID = value; } /** * JastAdd-internal setter for lexeme ID using the Beaver parser. * @param symbol Symbol containing the new value for the lexeme ID * @apilevel internal */ public void setID(beaver.Symbol symbol) { if (symbol.value != null && !(symbol.value instanceof String)) throw new UnsupportedOperationException("setID is only valid for String lexemes"); tokenString_ID = (String)symbol.value; IDstart = symbol.getStart(); IDend = symbol.getEnd(); } /** * Retrieves the value for the lexeme ID. * @return The value for the lexeme ID. * @apilevel high-level */ @ASTNodeAnnotation.Token(name="ID") public String getID() { return tokenString_ID != null ? tokenString_ID : ""; } /** * Replaces the SuperInterface list. * @param list The new list node to be used as the SuperInterface list. * @apilevel high-level */ public void setSuperInterfaceList(List list) { setChild(list, 1); } /** * Retrieves the number of children in the SuperInterface list. * @return Number of children in the SuperInterface list. * @apilevel high-level */ public int getNumSuperInterface() { return getSuperInterfaceList().getNumChild(); } /** * Retrieves the number of children in the SuperInterface list. * Calling this method will not trigger rewrites. * @return Number of children in the SuperInterface list. * @apilevel low-level */ public int getNumSuperInterfaceNoTransform() { return getSuperInterfaceListNoTransform().getNumChildNoTransform(); } /** * Retrieves the element at index {@code i} in the SuperInterface list. * @param i Index of the element to return. * @return The element at position {@code i} in the SuperInterface list. * @apilevel high-level */ public Access getSuperInterface(int i) { return (Access) getSuperInterfaceList().getChild(i); } /** * Check whether the SuperInterface list has any children. * @return {@code true} if it has at least one child, {@code false} otherwise. * @apilevel high-level */ public boolean hasSuperInterface() { return getSuperInterfaceList().getNumChild() != 0; } /** * Append an element to the SuperInterface list. * @param node The element to append to the SuperInterface list. * @apilevel high-level */ public void addSuperInterface(Access node) { List list = (parent == null) ? getSuperInterfaceListNoTransform() : getSuperInterfaceList(); list.addChild(node); } /** @apilevel low-level */ public void addSuperInterfaceNoTransform(Access node) { List list = getSuperInterfaceListNoTransform(); list.addChild(node); } /** * Replaces the SuperInterface list element at index {@code i} with the new node {@code node}. * @param node The new node to replace the old list element. * @param i The list index of the node to be replaced. * @apilevel high-level */ public void setSuperInterface(Access node, int i) { List list = getSuperInterfaceList(); list.setChild(node, i); } /** * Retrieves the SuperInterface list. * @return The node representing the SuperInterface list. * @apilevel high-level */ @ASTNodeAnnotation.ListChild(name="SuperInterface") public List getSuperInterfaceList() { List list = (List) getChild(1); return list; } /** * Retrieves the SuperInterface list. *

This method does not invoke AST transformations.

* @return The node representing the SuperInterface list. * @apilevel low-level */ public List getSuperInterfaceListNoTransform() { return (List) getChildNoTransform(1); } /** * @return the element at index {@code i} in the SuperInterface list without * triggering rewrites. */ public Access getSuperInterfaceNoTransform(int i) { return (Access) getSuperInterfaceListNoTransform().getChildNoTransform(i); } /** * Retrieves the SuperInterface list. * @return The node representing the SuperInterface list. * @apilevel high-level */ public List getSuperInterfaces() { return getSuperInterfaceList(); } /** * Retrieves the SuperInterface list. *

This method does not invoke AST transformations.

* @return The node representing the SuperInterface list. * @apilevel low-level */ public List getSuperInterfacesNoTransform() { return getSuperInterfaceListNoTransform(); } /** * Replaces the BodyDecl list. * @param list The new list node to be used as the BodyDecl list. * @apilevel high-level */ public void setBodyDeclList(List list) { setChild(list, 2); } /** * Retrieves the number of children in the BodyDecl list. * @return Number of children in the BodyDecl list. * @apilevel high-level */ public int getNumBodyDecl() { return getBodyDeclList().getNumChild(); } /** * Retrieves the number of children in the BodyDecl list. * Calling this method will not trigger rewrites. * @return Number of children in the BodyDecl list. * @apilevel low-level */ public int getNumBodyDeclNoTransform() { return getBodyDeclListNoTransform().getNumChildNoTransform(); } /** * Retrieves the element at index {@code i} in the BodyDecl list. * @param i Index of the element to return. * @return The element at position {@code i} in the BodyDecl list. * @apilevel high-level */ public BodyDecl getBodyDecl(int i) { return (BodyDecl) getBodyDeclList().getChild(i); } /** * Check whether the BodyDecl list has any children. * @return {@code true} if it has at least one child, {@code false} otherwise. * @apilevel high-level */ public boolean hasBodyDecl() { return getBodyDeclList().getNumChild() != 0; } /** * Append an element to the BodyDecl list. * @param node The element to append to the BodyDecl list. * @apilevel high-level */ public void addBodyDecl(BodyDecl node) { List list = (parent == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); list.addChild(node); } /** @apilevel low-level */ public void addBodyDeclNoTransform(BodyDecl node) { List list = getBodyDeclListNoTransform(); list.addChild(node); } /** * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. * @param node The new node to replace the old list element. * @param i The list index of the node to be replaced. * @apilevel high-level */ public void setBodyDecl(BodyDecl node, int i) { List list = getBodyDeclList(); list.setChild(node, i); } /** * Retrieves the BodyDecl list. * @return The node representing the BodyDecl list. * @apilevel high-level */ @ASTNodeAnnotation.ListChild(name="BodyDecl") public List getBodyDeclList() { List list = (List) getChild(2); return list; } /** * Retrieves the BodyDecl list. *

This method does not invoke AST transformations.

* @return The node representing the BodyDecl list. * @apilevel low-level */ public List getBodyDeclListNoTransform() { return (List) getChildNoTransform(2); } /** * @return the element at index {@code i} in the BodyDecl list without * triggering rewrites. */ public BodyDecl getBodyDeclNoTransform(int i) { return (BodyDecl) getBodyDeclListNoTransform().getChildNoTransform(i); } /** * Retrieves the BodyDecl list. * @return The node representing the BodyDecl list. * @apilevel high-level */ public List getBodyDecls() { return getBodyDeclList(); } /** * Retrieves the BodyDecl list. *

This method does not invoke AST transformations.

* @return The node representing the BodyDecl list. * @apilevel low-level */ public List getBodyDeclsNoTransform() { return getBodyDeclListNoTransform(); } /** * @aspect Generics * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:141 */ private boolean refined_Generics_InterfaceDecl_castingConversionTo_TypeDecl(TypeDecl type) { TypeDecl S = this; TypeDecl T = type; if (T.isArrayDecl()) { return T.instanceOf(S); } else if (T.isReferenceType() && !T.isFinal()) { return true; } else { return T.instanceOf(S); } } /** * @attribute syn * @aspect TypeScopePropagation * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:674 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeScopePropagation", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupType.jrag:674") public SimpleSet memberTypes(String name) { { SimpleSet result = localTypeDecls(name); if (!result.isEmpty()) { return result; } for (Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) { TypeDecl typeDecl = outerIter.next(); for (TypeDecl decl : typeDecl.memberTypes(name)) { if (!decl.isPrivate()) { result = result.add(decl); } } } return result; } } /** * @attribute syn * @aspect ConstructScope * @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:47 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="ConstructScope", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:47") public Collection lookupSuperConstructor() { Collection lookupSuperConstructor_value = typeObject().constructors(); return lookupSuperConstructor_value; } /** @apilevel internal */ private void castingConversionTo_TypeDecl_reset() { castingConversionTo_TypeDecl_computed = null; castingConversionTo_TypeDecl_values = null; } /** @apilevel internal */ protected java.util.Map castingConversionTo_TypeDecl_values; /** @apilevel internal */ protected java.util.Map castingConversionTo_TypeDecl_computed; /** * @attribute syn * @aspect TypeConversion * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:100 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeConversion", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:100") public boolean castingConversionTo(TypeDecl type) { Object _parameters = type; if (castingConversionTo_TypeDecl_computed == null) castingConversionTo_TypeDecl_computed = new java.util.HashMap(4); if (castingConversionTo_TypeDecl_values == null) castingConversionTo_TypeDecl_values = new java.util.HashMap(4); ASTState state = state(); if (castingConversionTo_TypeDecl_values.containsKey(_parameters) && castingConversionTo_TypeDecl_computed.containsKey(_parameters) && (castingConversionTo_TypeDecl_computed.get(_parameters) == ASTState.NON_CYCLE || castingConversionTo_TypeDecl_computed.get(_parameters) == state().cycle())) { return (Boolean) castingConversionTo_TypeDecl_values.get(_parameters); } boolean castingConversionTo_TypeDecl_value = castingConversionTo_compute(type); if (state().inCircle()) { castingConversionTo_TypeDecl_values.put(_parameters, castingConversionTo_TypeDecl_value); castingConversionTo_TypeDecl_computed.put(_parameters, state().cycle()); } else { castingConversionTo_TypeDecl_values.put(_parameters, castingConversionTo_TypeDecl_value); castingConversionTo_TypeDecl_computed.put(_parameters, ASTState.NON_CYCLE); } return castingConversionTo_TypeDecl_value; } /** @apilevel internal */ private boolean castingConversionTo_compute(TypeDecl type) { if (refined_Generics_InterfaceDecl_castingConversionTo_TypeDecl(type)) { return true; } boolean canUnboxThis = !unboxed().isUnknown(); boolean canUnboxType = !type.unboxed().isUnknown(); if (canUnboxThis && !canUnboxType) { return unboxed().wideningConversionTo(type); } return false; } /** * @attribute syn * @aspect TypeAnalysis * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:227 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeAnalysis", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:227") public boolean isInterfaceDecl() { boolean isInterfaceDecl_value = true; return isInterfaceDecl_value; } /** @apilevel internal */ private void instanceOf_TypeDecl_reset() { instanceOf_TypeDecl_computed = null; instanceOf_TypeDecl_values = null; } /** @apilevel internal */ protected java.util.Map instanceOf_TypeDecl_values; /** @apilevel internal */ protected java.util.Map instanceOf_TypeDecl_computed; /** * @attribute syn * @aspect TypeWideningAndIdentity * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:443 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeWideningAndIdentity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:443") public boolean instanceOf(TypeDecl type) { Object _parameters = type; if (instanceOf_TypeDecl_computed == null) instanceOf_TypeDecl_computed = new java.util.HashMap(4); if (instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new java.util.HashMap(4); ASTState state = state(); if (instanceOf_TypeDecl_values.containsKey(_parameters) && instanceOf_TypeDecl_computed.containsKey(_parameters) && (instanceOf_TypeDecl_computed.get(_parameters) == ASTState.NON_CYCLE || instanceOf_TypeDecl_computed.get(_parameters) == state().cycle())) { return (Boolean) instanceOf_TypeDecl_values.get(_parameters); } boolean instanceOf_TypeDecl_value = instanceOf_compute(type); if (state().inCircle()) { instanceOf_TypeDecl_values.put(_parameters, instanceOf_TypeDecl_value); instanceOf_TypeDecl_computed.put(_parameters, state().cycle()); } else { instanceOf_TypeDecl_values.put(_parameters, instanceOf_TypeDecl_value); instanceOf_TypeDecl_computed.put(_parameters, ASTState.NON_CYCLE); } return instanceOf_TypeDecl_value; } /** @apilevel internal */ private boolean instanceOf_compute(TypeDecl type) { return subtype(type); } /** * @attribute syn * @aspect TypeWideningAndIdentity * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:459 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeWideningAndIdentity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:459") public boolean isSupertypeOfClassDecl(ClassDecl type) { { if (super.isSupertypeOfClassDecl(type)) { return true; } for (Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { TypeDecl typeDecl = (TypeDecl) iter.next(); if (typeDecl.instanceOf(this)) { return true; } } return type.hasSuperclass() && type.superclass().instanceOf(this); } } /** * @attribute syn * @aspect TypeWideningAndIdentity * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:479 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeWideningAndIdentity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:479") public boolean isSupertypeOfInterfaceDecl(InterfaceDecl type) { { if (super.isSupertypeOfInterfaceDecl(type)) { return true; } for (Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { TypeDecl superinterface = (TypeDecl) iter.next(); if (superinterface.instanceOf(this)) { return true; } } return false; } } /** * @attribute syn * @aspect TypeWideningAndIdentity * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:494 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeWideningAndIdentity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:494") public boolean isSupertypeOfArrayDecl(ArrayDecl type) { { if (super.isSupertypeOfArrayDecl(type)) { return true; } for (Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { TypeDecl typeDecl = (TypeDecl) iter.next(); if (typeDecl.instanceOf(this)) { return true; } } return false; } } /** @apilevel internal */ private void superInterfaces_reset() { superInterfaces_computed = null; superInterfaces_value = null; } /** @apilevel internal */ protected ASTState.Cycle superInterfaces_computed = null; /** @apilevel internal */ protected Collection superInterfaces_value; /** * @return the interfaces directly implemented by this type. * @attribute syn * @aspect SuperClasses * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:696 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="SuperClasses", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:696") public Collection superInterfaces() { ASTState state = state(); if (superInterfaces_computed == ASTState.NON_CYCLE || superInterfaces_computed == state().cycle()) { return superInterfaces_value; } superInterfaces_value = superInterfaces_compute(); if (state().inCircle()) { superInterfaces_computed = state().cycle(); } else { superInterfaces_computed = ASTState.NON_CYCLE; } return superInterfaces_value; } /** @apilevel internal */ private Collection superInterfaces_compute() { Collection interfaces = new ArrayList(); for (Access access : getSuperInterfaceList()) { TypeDecl implemented = access.type(); if (implemented.isInterfaceDecl()) { // TODO(joqvist): unclear why this is needed. interfaces.add(implemented); } } return interfaces; } /** @apilevel internal */ protected ASTState.Cycle isCircular_cycle = null; /** @apilevel internal */ private void isCircular_reset() { isCircular_computed = false; isCircular_initialized = false; isCircular_cycle = null; } /** @apilevel internal */ protected boolean isCircular_computed = false; /** @apilevel internal */ protected boolean isCircular_value; /** @apilevel internal */ protected boolean isCircular_initialized = false; @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true) @ASTNodeAnnotation.Source(aspect="Circularity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:728") public boolean isCircular() { if (isCircular_computed) { return isCircular_value; } ASTState state = state(); if (!isCircular_initialized) { isCircular_initialized = true; isCircular_value = true; } if (!state.inCircle() || state.calledByLazyAttribute()) { state.enterCircle(); do { isCircular_cycle = state.nextCycle(); boolean new_isCircular_value = isCircular_compute(); if (isCircular_value != new_isCircular_value) { state.setChangeInCycle(); } isCircular_value = new_isCircular_value; } while (state.testAndClearChangeInCycle()); isCircular_computed = true; state.leaveCircle(); } else if (isCircular_cycle != state.cycle()) { isCircular_cycle = state.cycle(); boolean new_isCircular_value = isCircular_compute(); if (isCircular_value != new_isCircular_value) { state.setChangeInCycle(); } isCircular_value = new_isCircular_value; } else { } return isCircular_value; } /** @apilevel internal */ private boolean isCircular_compute() { for (int i = 0; i < getNumSuperInterface(); i++) { Access a = getSuperInterface(i).lastAccess(); while (a != null) { if (a.type().isCircular()) { return true; } a = (a.isQualified() && a.qualifier().isTypeAccess()) ? (Access) a.qualifier() : null; } } return false; } /** * @attribute syn * @aspect PrettyPrintUtil * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag:246 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="PrettyPrintUtil", declaredAt="/home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag:246") public boolean hasModifiers() { boolean hasModifiers_value = getModifiers().getNumModifier() > 0; return hasModifiers_value; } /** * @attribute syn * @aspect AccessControl * @declaredat /home/jesper/git/extendj/java4/frontend/AccessControl.jrag:214 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="AccessControl", declaredAt="/home/jesper/git/extendj/java4/frontend/AccessControl.jrag:214") public Collection accessControlProblems() { { Collection problems = new LinkedList(); if (!isCircular()) { // 9.1.2 Collection interfaces = new HashSet(); for (Access access : getSuperInterfaceList()) { TypeDecl decl = access.type(); if (!decl.isInterfaceDecl() && !decl.isUnknown()) { problems.add(errorf("interface %s can not extend non interface type %s", fullName(), decl.fullName())); } if (!decl.isCircular() && !decl.accessibleFrom(this)) { problems.add(errorf("interface %s can not extend non accessible type %s", fullName(), decl.fullName())); } if (interfaces.contains(decl)) { problems.add(errorf( "extended interface %s is mentionened multiple times in extends clause", decl.fullName())); } interfaces.add(decl); } } return problems; } } /** @apilevel internal */ private void methodsSignatureMap_reset() { methodsSignatureMap_computed = null; methodsSignatureMap_value = null; } /** @apilevel internal */ protected ASTState.Cycle methodsSignatureMap_computed = null; /** @apilevel internal */ protected Map> methodsSignatureMap_value; /** * Map method signatures to sets of method declarations * for this type. * *

Includes all supertype method declarations. * @attribute syn * @aspect MemberMethods * @declaredat /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:706 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="MemberMethods", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:706") public Map> methodsSignatureMap() { ASTState state = state(); if (methodsSignatureMap_computed == ASTState.NON_CYCLE || methodsSignatureMap_computed == state().cycle()) { return methodsSignatureMap_value; } methodsSignatureMap_value = methodsSignatureMap_compute(); if (state().inCircle()) { methodsSignatureMap_computed = state().cycle(); } else { methodsSignatureMap_computed = ASTState.NON_CYCLE; } return methodsSignatureMap_value; } /** @apilevel internal */ private Map> methodsSignatureMap_compute() { Map> localMap = localMethodsSignatureMap(); Map> map = new HashMap>(localMap); for (Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) { MethodDecl m = iter.next(); if (m.accessibleFrom(this) && !localMap.containsKey(m.signature())) { if (!(m instanceof MethodDeclSubstituted) || !localMap.containsKey(m.sourceMethodDecl().signature())) { putSimpleSetElement(map, m.signature(), m); } } } for (Iterator iter = typeObject().methodsIterator(); iter.hasNext(); ) { MethodDecl m = (MethodDecl) iter.next(); if (m.isPublic() && !map.containsKey(m.signature())) { putSimpleSetElement(map, m.signature(), m); } } return map; } /** @apilevel internal */ private void ancestorMethods_String_reset() { ancestorMethods_String_computed = null; ancestorMethods_String_values = null; } /** @apilevel internal */ protected java.util.Map ancestorMethods_String_values; /** @apilevel internal */ protected java.util.Map ancestorMethods_String_computed; /** * Finds methods with the same signature declared in ancestors types. This * is used when checking correct overriding, hiding, and implementation of * abstract methods. * @attribute syn * @aspect AncestorMethods * @declaredat /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:788 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="AncestorMethods", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:788") public SimpleSet ancestorMethods(String signature) { Object _parameters = signature; if (ancestorMethods_String_computed == null) ancestorMethods_String_computed = new java.util.HashMap(4); if (ancestorMethods_String_values == null) ancestorMethods_String_values = new java.util.HashMap(4); ASTState state = state(); if (ancestorMethods_String_values.containsKey(_parameters) && ancestorMethods_String_computed.containsKey(_parameters) && (ancestorMethods_String_computed.get(_parameters) == ASTState.NON_CYCLE || ancestorMethods_String_computed.get(_parameters) == state().cycle())) { return (SimpleSet) ancestorMethods_String_values.get(_parameters); } SimpleSet ancestorMethods_String_value = ancestorMethods_compute(signature); if (state().inCircle()) { ancestorMethods_String_values.put(_parameters, ancestorMethods_String_value); ancestorMethods_String_computed.put(_parameters, state().cycle()); } else { ancestorMethods_String_values.put(_parameters, ancestorMethods_String_value); ancestorMethods_String_computed.put(_parameters, ASTState.NON_CYCLE); } return ancestorMethods_String_value; } /** @apilevel internal */ private SimpleSet ancestorMethods_compute(String signature) { SimpleSet result = emptySet(); for (Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) { TypeDecl typeDecl = outerIter.next(); for (MethodDecl m : typeDecl.methodsSignature(signature)) { result = result.add(m); } } if (!interfacesIterator().hasNext()) { for (MethodDecl m : typeObject().methodsSignature(signature)) { if (m.isPublic()) { result = result.add(m); } } } return result; } /** @apilevel internal */ private void memberFieldsMap_reset() { memberFieldsMap_computed = null; memberFieldsMap_value = null; } /** @apilevel internal */ protected ASTState.Cycle memberFieldsMap_computed = null; /** @apilevel internal */ protected Map> memberFieldsMap_value; /** * @attribute syn * @aspect Fields * @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:402 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Fields", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:402") public Map> memberFieldsMap() { ASTState state = state(); if (memberFieldsMap_computed == ASTState.NON_CYCLE || memberFieldsMap_computed == state().cycle()) { return memberFieldsMap_value; } memberFieldsMap_value = memberFieldsMap_compute(); if (state().inCircle()) { memberFieldsMap_computed = state().cycle(); } else { memberFieldsMap_computed = ASTState.NON_CYCLE; } return memberFieldsMap_value; } /** @apilevel internal */ private Map> memberFieldsMap_compute() { Map> map = new HashMap>(localFieldsMap()); Iterator outerIter = interfacesIterator(); while (outerIter.hasNext()) { TypeDecl typeDecl = outerIter.next(); Iterator iter = typeDecl.fieldsIterator(); while (iter.hasNext()) { Variable f = iter.next(); if (f.accessibleFrom(this) && !f.isPrivate() && !localFieldsMap().containsKey(f.name())) { putSimpleSetElement(map, f.name(), f); } } } return map; } /** @apilevel internal */ private void memberFields_String_reset() { memberFields_String_computed = null; memberFields_String_values = null; } /** @apilevel internal */ protected java.util.Map memberFields_String_values; /** @apilevel internal */ protected java.util.Map memberFields_String_computed; /** * @attribute syn * @aspect Fields * @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:475 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Fields", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:475") public SimpleSet memberFields(String name) { Object _parameters = name; if (memberFields_String_computed == null) memberFields_String_computed = new java.util.HashMap(4); if (memberFields_String_values == null) memberFields_String_values = new java.util.HashMap(4); ASTState state = state(); if (memberFields_String_values.containsKey(_parameters) && memberFields_String_computed.containsKey(_parameters) && (memberFields_String_computed.get(_parameters) == ASTState.NON_CYCLE || memberFields_String_computed.get(_parameters) == state().cycle())) { return (SimpleSet) memberFields_String_values.get(_parameters); } SimpleSet memberFields_String_value = memberFields_compute(name); if (state().inCircle()) { memberFields_String_values.put(_parameters, memberFields_String_value); memberFields_String_computed.put(_parameters, state().cycle()); } else { memberFields_String_values.put(_parameters, memberFields_String_value); memberFields_String_computed.put(_parameters, ASTState.NON_CYCLE); } return memberFields_String_value; } /** @apilevel internal */ private SimpleSet memberFields_compute(String name) { SimpleSet fields = localFields(name); if (!fields.isEmpty()) { return fields; } for (Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) { TypeDecl typeDecl = outerIter.next(); Iterator iter = typeDecl.memberFields(name).iterator(); while (iter.hasNext()) { Variable f = iter.next(); if (f.accessibleFrom(this) && !f.isPrivate()) { fields = fields.add(f); } } } return fields; } /** * @attribute syn * @aspect TypeHierarchyCheck * @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:511 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeHierarchyCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:511") public Collection typeHierarchyProblems() { { Collection problems = new LinkedList(); if (isCircular()) { problems.add(errorf("circular inheritance dependency in %s", typeName())); } else { for (int i = 0; i < getNumSuperInterface(); i++) { TypeDecl typeDecl = getSuperInterface(i).type(); if (typeDecl.isCircular()) { problems.add(errorf("circular inheritance dependency in %s", typeName())); } } } for (SimpleSet set : methodsSignatureMap().values()) { if (set.size() > 1) { Iterator iter = set.iterator(); MethodDecl m = iter.next(); while (iter.hasNext()) { MethodDecl n = iter.next(); checkAbstractMethodDecls(problems, m, n); } } } return problems; } } /** * @attribute syn * @aspect Modifiers * @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:237 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Modifiers", declaredAt="/home/jesper/git/extendj/java4/frontend/Modifiers.jrag:237") public boolean isAbstract() { boolean isAbstract_value = true; return isAbstract_value; } /** @apilevel internal */ private void isStatic_reset() { isStatic_computed = null; } /** @apilevel internal */ protected ASTState.Cycle isStatic_computed = null; /** @apilevel internal */ protected boolean isStatic_value; /** * @attribute syn * @aspect Modifiers * @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:239 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Modifiers", declaredAt="/home/jesper/git/extendj/java4/frontend/Modifiers.jrag:239") public boolean isStatic() { ASTState state = state(); if (isStatic_computed == ASTState.NON_CYCLE || isStatic_computed == state().cycle()) { return isStatic_value; } isStatic_value = getModifiers().isStatic() || isMemberType(); if (state().inCircle()) { isStatic_computed = state().cycle(); } else { isStatic_computed = ASTState.NON_CYCLE; } return isStatic_value; } /** @apilevel internal */ private void erasedAncestorMethodsMap_reset() { erasedAncestorMethodsMap_computed = null; erasedAncestorMethodsMap_value = null; } /** @apilevel internal */ protected ASTState.Cycle erasedAncestorMethodsMap_computed = null; /** @apilevel internal */ protected Map> erasedAncestorMethodsMap_value; /** * @attribute syn * @aspect GenericsTypeCheck * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:537 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="GenericsTypeCheck", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:537") public Map> erasedAncestorMethodsMap() { ASTState state = state(); if (erasedAncestorMethodsMap_computed == ASTState.NON_CYCLE || erasedAncestorMethodsMap_computed == state().cycle()) { return erasedAncestorMethodsMap_value; } erasedAncestorMethodsMap_value = erasedAncestorMethodsMap_compute(); if (state().inCircle()) { erasedAncestorMethodsMap_computed = state().cycle(); } else { erasedAncestorMethodsMap_computed = ASTState.NON_CYCLE; } return erasedAncestorMethodsMap_value; } /** @apilevel internal */ private Map> erasedAncestorMethodsMap_compute() { Map> localMap = localMethodsSignatureMap(); Map> map = new HashMap>(localMap); for (Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) { MethodDecl m = (MethodDecl) iter.next(); if (m.accessibleFrom(this) && m.erasedMethod() != m) { String erasedSignature = m.erasedMethod().signature(); if (!localMap.containsKey(erasedSignature)) { // Map erased signature to substituted method. putSimpleSetElement(map, m.erasedMethod().signature(), m); } } } for (Iterator iter = typeObject().methodsIterator(); iter.hasNext(); ) { MethodDecl m = (MethodDecl) iter.next(); if (m.isPublic() && m.erasedMethod() != m) { String erasedSignature = m.erasedMethod().signature(); if (!localMap.containsKey(erasedSignature)) { // Map erased signature to substituted method. putSimpleSetElement(map, m.erasedMethod().signature(), m); } } } return map; } /** @apilevel internal */ private void implementedInterfaces_reset() { implementedInterfaces_computed = null; implementedInterfaces_value = null; } /** @apilevel internal */ protected ASTState.Cycle implementedInterfaces_computed = null; /** @apilevel internal */ protected Collection implementedInterfaces_value; /** * @attribute syn * @aspect GenericsTypeCheck * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:646 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="GenericsTypeCheck", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:646") public Collection implementedInterfaces() { ASTState state = state(); if (implementedInterfaces_computed == ASTState.NON_CYCLE || implementedInterfaces_computed == state().cycle()) { return implementedInterfaces_value; } implementedInterfaces_value = implementedInterfaces_compute(); if (state().inCircle()) { implementedInterfaces_computed = state().cycle(); } else { implementedInterfaces_computed = ASTState.NON_CYCLE; } return implementedInterfaces_value; } /** @apilevel internal */ private Collection implementedInterfaces_compute() { HashSet set= new HashSet(); set.addAll(typeObject().implementedInterfaces()); for (Iterator iter = interfacesIterator(); iter.hasNext(); ) { InterfaceDecl decl = (InterfaceDecl) iter.next(); set.add(decl); set.addAll(decl.implementedInterfaces()); } return set; } /** @apilevel internal */ private void subtype_TypeDecl_reset() { subtype_TypeDecl_values = null; } protected java.util.Map subtype_TypeDecl_values; @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true) @ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:492") public boolean subtype(TypeDecl type) { Object _parameters = type; if (subtype_TypeDecl_values == null) subtype_TypeDecl_values = new java.util.HashMap(4); ASTState.CircularValue _value; if (subtype_TypeDecl_values.containsKey(_parameters)) { Object _cache = subtype_TypeDecl_values.get(_parameters); if (!(_cache instanceof ASTState.CircularValue)) { return (Boolean) _cache; } else { _value = (ASTState.CircularValue) _cache; } } else { _value = new ASTState.CircularValue(); subtype_TypeDecl_values.put(_parameters, _value); _value.value = true; } ASTState state = state(); if (!state.inCircle() || state.calledByLazyAttribute()) { state.enterCircle(); boolean new_subtype_TypeDecl_value; do { _value.cycle = state.nextCycle(); new_subtype_TypeDecl_value = type.supertypeInterfaceDecl(this); if (((Boolean)_value.value) != new_subtype_TypeDecl_value) { state.setChangeInCycle(); _value.value = new_subtype_TypeDecl_value; } } while (state.testAndClearChangeInCycle()); subtype_TypeDecl_values.put(_parameters, new_subtype_TypeDecl_value); state.leaveCircle(); return new_subtype_TypeDecl_value; } else if (_value.cycle != state.cycle()) { _value.cycle = state.cycle(); boolean new_subtype_TypeDecl_value = type.supertypeInterfaceDecl(this); if (((Boolean)_value.value) != new_subtype_TypeDecl_value) { state.setChangeInCycle(); _value.value = new_subtype_TypeDecl_value; } return new_subtype_TypeDecl_value; } else { return (Boolean) _value.value; } } /** * @attribute syn * @aspect GenericsSubtype * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:507 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:507") public boolean supertypeClassDecl(ClassDecl type) { { if (super.supertypeClassDecl(type)) { return true; } for (Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { TypeDecl typeDecl = iter.next(); if (typeDecl.subtype(this)) { return true; } } return type.hasSuperclass() && type.superclass().subtype(this); } } /** * @attribute syn * @aspect GenericsSubtype * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:524 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:524") public boolean supertypeInterfaceDecl(InterfaceDecl type) { { if (super.supertypeInterfaceDecl(type)) { return true; } for (Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { TypeDecl superinterface = iter.next(); if (superinterface.subtype(this)) { return true; } } return false; } } /** * @attribute syn * @aspect GenericsSubtype * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:541 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:541") public boolean supertypeArrayDecl(ArrayDecl type) { { if (super.supertypeArrayDecl(type)) { return true; } for (Iterator iter = type.interfacesIterator(); iter.hasNext(); ) { TypeDecl typeDecl = iter.next(); if (typeDecl.subtype(this)) { return true; } } return false; } } /** @apilevel internal */ private void iterableElementType_reset() { iterableElementType_computed = null; iterableElementType_value = null; } /** @apilevel internal */ protected ASTState.Cycle iterableElementType_computed = null; /** @apilevel internal */ protected TypeDecl iterableElementType_value; /** * Computes the element type of a type implementing java.lang.Iterable. * Returns UnknownType if this type does not implement java.lang.Iterable. * @attribute syn * @aspect EnhancedFor * @declaredat /home/jesper/git/extendj/java5/frontend/EnhancedFor.jrag:77 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="EnhancedFor", declaredAt="/home/jesper/git/extendj/java5/frontend/EnhancedFor.jrag:77") public TypeDecl iterableElementType() { ASTState state = state(); if (iterableElementType_computed == ASTState.NON_CYCLE || iterableElementType_computed == state().cycle()) { return iterableElementType_value; } iterableElementType_value = iterableElementType_compute(); if (state().inCircle()) { iterableElementType_computed = state().cycle(); } else { iterableElementType_computed = ASTState.NON_CYCLE; } return iterableElementType_value; } /** @apilevel internal */ private TypeDecl iterableElementType_compute() { TypeDecl type = super.iterableElementType(); if (!type.isUnknown()) { return type; } else { for (Access iface : getSuperInterfaceList()) { type = iface.type().iterableElementType(); if (!type.isUnknown()) { break; } } return type; } } /** * @attribute syn * @aspect CreateBCode * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:995 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:995") public String arrayTypeDescriptor() { String arrayTypeDescriptor_value = constantPoolName(); return arrayTypeDescriptor_value; } /** * @attribute syn * @aspect VerificationTypes * @declaredat /home/jesper/git/extendj/java4/backend/VerificationTypes.jrag:37 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="VerificationTypes", declaredAt="/home/jesper/git/extendj/java4/backend/VerificationTypes.jrag:37") public TypeDecl supertype() { TypeDecl supertype_value = typeObject(); return supertype_value; } /** @apilevel internal */ private void typeDescriptor_reset() { typeDescriptor_computed = null; typeDescriptor_value = null; } /** @apilevel internal */ protected ASTState.Cycle typeDescriptor_computed = null; /** @apilevel internal */ protected String typeDescriptor_value; /** * @attribute syn * @aspect ConstantPoolNames * @declaredat /home/jesper/git/extendj/java4/backend/ConstantPoolNames.jrag:78 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="ConstantPoolNames", declaredAt="/home/jesper/git/extendj/java4/backend/ConstantPoolNames.jrag:78") public String typeDescriptor() { ASTState state = state(); if (typeDescriptor_computed == ASTState.NON_CYCLE || typeDescriptor_computed == state().cycle()) { return typeDescriptor_value; } typeDescriptor_value = "L" + constantPoolName() + ";"; if (state().inCircle()) { typeDescriptor_computed = state().cycle(); } else { typeDescriptor_computed = ASTState.NON_CYCLE; } return typeDescriptor_value; } /** @apilevel internal */ private void bridgeCandidates_String_reset() { bridgeCandidates_String_computed = null; bridgeCandidates_String_values = null; } /** @apilevel internal */ protected java.util.Map bridgeCandidates_String_values; /** @apilevel internal */ protected java.util.Map bridgeCandidates_String_computed; /** * @attribute syn * @aspect GenericsCodegen * @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:279 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="GenericsCodegen", declaredAt="/home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:279") public SimpleSet bridgeCandidates(String signature) { Object _parameters = signature; if (bridgeCandidates_String_computed == null) bridgeCandidates_String_computed = new java.util.HashMap(4); if (bridgeCandidates_String_values == null) bridgeCandidates_String_values = new java.util.HashMap(4); ASTState state = state(); if (bridgeCandidates_String_values.containsKey(_parameters) && bridgeCandidates_String_computed.containsKey(_parameters) && (bridgeCandidates_String_computed.get(_parameters) == ASTState.NON_CYCLE || bridgeCandidates_String_computed.get(_parameters) == state().cycle())) { return (SimpleSet) bridgeCandidates_String_values.get(_parameters); } SimpleSet bridgeCandidates_String_value = ancestorMethods(signature); if (state().inCircle()) { bridgeCandidates_String_values.put(_parameters, bridgeCandidates_String_value); bridgeCandidates_String_computed.put(_parameters, state().cycle()); } else { bridgeCandidates_String_values.put(_parameters, bridgeCandidates_String_value); bridgeCandidates_String_computed.put(_parameters, ASTState.NON_CYCLE); } return bridgeCandidates_String_value; } /** @apilevel internal */ private void needsSignatureAttribute_reset() { needsSignatureAttribute_computed = null; } /** @apilevel internal */ protected ASTState.Cycle needsSignatureAttribute_computed = null; /** @apilevel internal */ protected boolean needsSignatureAttribute_value; /** * @attribute syn * @aspect GenericsCodegen * @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:387 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="GenericsCodegen", declaredAt="/home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:387") public boolean needsSignatureAttribute() { ASTState state = state(); if (needsSignatureAttribute_computed == ASTState.NON_CYCLE || needsSignatureAttribute_computed == state().cycle()) { return needsSignatureAttribute_value; } needsSignatureAttribute_value = needsSignatureAttribute_compute(); if (state().inCircle()) { needsSignatureAttribute_computed = state().cycle(); } else { needsSignatureAttribute_computed = ASTState.NON_CYCLE; } return needsSignatureAttribute_value; } /** @apilevel internal */ private boolean needsSignatureAttribute_compute() { for (Iterator iter = interfacesIterator(); iter.hasNext(); ) { if (iter.next().needsSignatureAttribute()) { return true; } } return false; } /** @apilevel internal */ private void classSignature_reset() { classSignature_computed = null; classSignature_value = null; } /** @apilevel internal */ protected ASTState.Cycle classSignature_computed = null; /** @apilevel internal */ protected String classSignature_value; /** * @attribute syn * @aspect GenericsCodegen * @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:446 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="GenericsCodegen", declaredAt="/home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:446") public String classSignature() { ASTState state = state(); if (classSignature_computed == ASTState.NON_CYCLE || classSignature_computed == state().cycle()) { return classSignature_value; } classSignature_value = classSignature_compute(); if (state().inCircle()) { classSignature_computed = state().cycle(); } else { classSignature_computed = ASTState.NON_CYCLE; } return classSignature_value; } /** @apilevel internal */ private String classSignature_compute() { StringBuilder buf = new StringBuilder(); buf.append(typeObject().classTypeSignature()); for (Iterator iter = interfacesIterator(); iter.hasNext(); ) { buf.append(iter.next().classTypeSignature()); } return buf.toString(); } /** * @attribute inh * @aspect TypeConversion * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:113 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="TypeConversion", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:113") public MethodDecl unknownMethod() { MethodDecl unknownMethod_value = getParent().Define_unknownMethod(this, null); return unknownMethod_value; } /** * @declaredat /home/jesper/git/extendj/java5/backend/AnnotationsCodegen.jrag:311 * @apilevel internal */ public TypeDecl Define_hostType(ASTNode _callerNode, ASTNode _childNode) { if (_callerNode == getSuperInterfaceListNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:651 int childIndex = _callerNode.getIndexOfChild(_childNode); return hostType(); } else { return super.Define_hostType(_callerNode, _childNode); } } /** * @declaredat /home/jesper/git/extendj/java5/backend/AnnotationsCodegen.jrag:311 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute hostType */ protected boolean canDefine_hostType(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36 * @apilevel internal */ public NameType Define_nameType(ASTNode _callerNode, ASTNode _childNode) { if (_callerNode == getSuperInterfaceListNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:99 int childIndex = _callerNode.getIndexOfChild(_childNode); return NameType.TYPE_NAME; } else { return super.Define_nameType(_callerNode, _childNode); } } /** * @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute nameType */ protected boolean canDefine_nameType(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:405 * @apilevel internal */ public boolean Define_withinSuppressWarnings(ASTNode _callerNode, ASTNode _childNode, String annot) { if (_callerNode == getSuperInterfaceListNoTransform()) { // @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:420 int childIndex = _callerNode.getIndexOfChild(_childNode); return hasAnnotationSuppressWarnings(annot) || withinSuppressWarnings(annot); } else { return getParent().Define_withinSuppressWarnings(this, _callerNode, annot); } } /** * @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:405 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute withinSuppressWarnings */ protected boolean canDefine_withinSuppressWarnings(ASTNode _callerNode, ASTNode _childNode, String annot) { return true; } /** * @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:536 * @apilevel internal */ public boolean Define_withinDeprecatedAnnotation(ASTNode _callerNode, ASTNode _childNode) { if (_callerNode == getSuperInterfaceListNoTransform()) { // @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:547 int childIndex = _callerNode.getIndexOfChild(_childNode); return isDeprecated() || withinDeprecatedAnnotation(); } else { return super.Define_withinDeprecatedAnnotation(_callerNode, _childNode); } } /** * @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:536 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute withinDeprecatedAnnotation */ protected boolean canDefine_withinDeprecatedAnnotation(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:383 * @apilevel internal */ public boolean Define_inExtendsOrImplements(ASTNode _callerNode, ASTNode _childNode) { if (_callerNode == getSuperInterfaceListNoTransform()) { // @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:382 int childIndex = _callerNode.getIndexOfChild(_childNode); return true; } else { return getParent().Define_inExtendsOrImplements(this, _callerNode); } } /** * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:383 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute inExtendsOrImplements */ protected boolean canDefine_inExtendsOrImplements(ASTNode _callerNode, ASTNode _childNode) { return true; } /** @apilevel internal */ public ASTNode rewriteTo() { return super.rewriteTo(); } /** @apilevel internal */ public boolean canRewrite() { return false; } /** @apilevel internal */ protected void collect_contributors_CompilationUnit_problems(CompilationUnit _root, java.util.Map> _map) { // @declaredat /home/jesper/git/extendj/java4/frontend/AccessControl.jrag:212 { java.util.Set contributors = _map.get(_root); if (contributors == null) { contributors = new java.util.LinkedHashSet(); _map.put((ASTNode) _root, contributors); } contributors.add(this); } // @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:509 { java.util.Set contributors = _map.get(_root); if (contributors == null) { contributors = new java.util.LinkedHashSet(); _map.put((ASTNode) _root, contributors); } contributors.add(this); } super.collect_contributors_CompilationUnit_problems(_root, _map); } /** @apilevel internal */ protected void contributeTo_CompilationUnit_problems(LinkedList collection) { super.contributeTo_CompilationUnit_problems(collection); for (Problem value : accessControlProblems()) { collection.add(value); } for (Problem value : typeHierarchyProblems()) { collection.add(value); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy