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

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

The newest version!
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.3.0 */
package org.extendj.ast;
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.Collection;
import java.util.Collections;
import java.util.HashSet;
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.util.LinkedHashSet;
import java.util.*;
import org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import java.util.zip.*;
import java.io.*;
import org.jastadd.util.*;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
/** A constructor invocation. 
 * @ast node
 * @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:93
 * @astdecl ConstructorAccess : Access ::=  Arg:Expr*;
 * @production ConstructorAccess : {@link Access} ::= <ID:String> Arg:{@link Expr}*;

 */
public class ConstructorAccess extends Access implements Cloneable {
  /**
   * @aspect Java4PrettyPrint
   * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:248
   */
  public void prettyPrint(PrettyPrinter out) {
    out.print(getID());
    out.print("(");
    out.join(getArgList(), new PrettyPrinter.Joiner() {
      @Override
      public void printSeparator(PrettyPrinter out) {
        out.print(", ");
      }
    });
    out.print(")");
  }
  /**
   * @aspect ExceptionHandling
   * @declaredat /home/jesper/git/extendj/java4/frontend/ExceptionHandling.jrag:356
   */
  protected boolean reachedException(TypeDecl catchType) {
    for (Access exception : decl().getExceptionList()) {
      TypeDecl exceptionType = exception.type();
      if (catchType.mayCatch(exceptionType)) {
        return true;
      }
    }
    return super.reachedException(catchType);
  }
  /**
   * @aspect CreateBCode
   * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:773
   */
  public void createBCode(CodeGeneration gen) {
    if (transformed() != this) {
      // Ensure bytecode is generated for the transformed access.
      transformed().createBCode(gen);
      return;
    }

    ConstructorDecl decl = decl().bytecodeTarget();
    int index = 0;
    // Push this argument.
    gen.ALOAD(index++, VerificationTypes.UNINITIALIZED_THIS);
    // Push this$0 argument.
    if (decl.needsEnclosing()) {
      gen.ALOAD(index++, hostType().enclosing());
    }
    if (decl.needsSuperEnclosing()) {
      gen.ALOAD(index++, hostType().superEnclosing());
    }
    // Push formal arguments.
    for (int i = 0; i < getNumArg(); ++i) {
      getArg(i).createBCode(gen);
      // Method invocation conversion:
      getArg(i).emitCastTo(gen, decl.paramType(i));
    }
    // Push enclosing variable arguments.
    for (Variable var : decl.hostType().enclosingVariables()) {
      var.emitLoadVariable(gen, this);
    }
    if (decl.isPrivate() && decl.hostType() != hostType()) {
      gen.ACONST_NULL();
      decl.createAccessor().emitInvokeConstructor(gen);
    } else {
      decl.emitInvokeConstructor(gen);
    }
  }
  /**
   * @declaredat ASTNode:1
   */
  public ConstructorAccess() {
    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[1];
    setChild(new List(), 0);
  }
  /**
   * @declaredat ASTNode:14
   */
  @ASTNodeAnnotation.Constructor(
    name = {"ID", "Arg"},
    type = {"String", "List"},
    kind = {"Token", "List"}
  )
  public ConstructorAccess(String p0, List p1) {
    setID(p0);
    setChild(p1, 0);
  }
  /**
   * @declaredat ASTNode:23
   */
  public ConstructorAccess(beaver.Symbol p0, List p1) {
    setID(p0);
    setChild(p1, 0);
  }
  /** @apilevel low-level 
   * @declaredat ASTNode:28
   */
  protected int numChildren() {
    return 1;
  }
  /**
   * @apilevel internal
   * @declaredat ASTNode:34
   */
  public boolean mayHaveRewrite() {
    return false;
  }
  /** @apilevel internal 
   * @declaredat ASTNode:38
   */
  public void flushAttrCache() {
    super.flushAttrCache();
    decls_reset();
    decl_reset();
    type_reset();
    unassignedAfter_Variable_reset();
    transformedVariableArity_reset();
  }
  /** @apilevel internal 
   * @declaredat ASTNode:47
   */
  public void flushCollectionCache() {
    super.flushCollectionCache();
  }
  /** @apilevel internal 
   * @declaredat ASTNode:51
   */
  public ConstructorAccess clone() throws CloneNotSupportedException {
    ConstructorAccess node = (ConstructorAccess) super.clone();
    return node;
  }
  /** @apilevel internal 
   * @declaredat ASTNode:56
   */
  public ConstructorAccess copy() {
    try {
      ConstructorAccess node = (ConstructorAccess) 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:75
   */
  @Deprecated
  public ConstructorAccess 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:85
   */
  public ConstructorAccess treeCopyNoTransform() {
    ConstructorAccess tree = (ConstructorAccess) 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:105
   */
  public ConstructorAccess treeCopy() {
    ConstructorAccess tree = (ConstructorAccess) 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:119
   */
  protected boolean is$Equal(ASTNode node) {
    return super.is$Equal(node) && (tokenString_ID == ((ConstructorAccess) node).tokenString_ID);    
  }
  /**
   * Replaces the lexeme ID.
   * @param value The new value for the lexeme ID.
   * @apilevel high-level
   */
  public void setID(String value) {
    tokenString_ID = value;
  }
  /** @apilevel internal 
   */
  protected String tokenString_ID;
  /**
   */
  public int IDstart;
  /**
   */
  public int IDend;
  /**
   * 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 Arg list.
   * @param list The new list node to be used as the Arg list.
   * @apilevel high-level
   */
  public void setArgList(List list) {
    setChild(list, 0);
  }
  /**
   * Retrieves the number of children in the Arg list.
   * @return Number of children in the Arg list.
   * @apilevel high-level
   */
  public int getNumArg() {
    return getArgList().getNumChild();
  }
  /**
   * Retrieves the number of children in the Arg list.
   * Calling this method will not trigger rewrites.
   * @return Number of children in the Arg list.
   * @apilevel low-level
   */
  public int getNumArgNoTransform() {
    return getArgListNoTransform().getNumChildNoTransform();
  }
  /**
   * Retrieves the element at index {@code i} in the Arg list.
   * @param i Index of the element to return.
   * @return The element at position {@code i} in the Arg list.
   * @apilevel high-level
   */
  public Expr getArg(int i) {
    return (Expr) getArgList().getChild(i);
  }
  /**
   * Check whether the Arg list has any children.
   * @return {@code true} if it has at least one child, {@code false} otherwise.
   * @apilevel high-level
   */
  public boolean hasArg() {
    return getArgList().getNumChild() != 0;
  }
  /**
   * Append an element to the Arg list.
   * @param node The element to append to the Arg list.
   * @apilevel high-level
   */
  public void addArg(Expr node) {
    List list = (parent == null) ? getArgListNoTransform() : getArgList();
    list.addChild(node);
  }
  /** @apilevel low-level 
   */
  public void addArgNoTransform(Expr node) {
    List list = getArgListNoTransform();
    list.addChild(node);
  }
  /**
   * Replaces the Arg 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 setArg(Expr node, int i) {
    List list = getArgList();
    list.setChild(node, i);
  }
  /**
   * Retrieves the Arg list.
   * @return The node representing the Arg list.
   * @apilevel high-level
   */
  @ASTNodeAnnotation.ListChild(name="Arg")
  public List getArgList() {
    List list = (List) getChild(0);
    return list;
  }
  /**
   * Retrieves the Arg list.
   * 

This method does not invoke AST transformations.

* @return The node representing the Arg list. * @apilevel low-level */ public List getArgListNoTransform() { return (List) getChildNoTransform(0); } /** * @return the element at index {@code i} in the Arg list without * triggering rewrites. */ public Expr getArgNoTransform(int i) { return (Expr) getArgListNoTransform().getChildNoTransform(i); } /** * Retrieves the Arg list. * @return The node representing the Arg list. * @apilevel high-level */ public List getArgs() { return getArgList(); } /** * Retrieves the Arg list. *

This method does not invoke AST transformations.

* @return The node representing the Arg list. * @apilevel low-level */ public List getArgsNoTransform() { return getArgListNoTransform(); } /** * @aspect Transformations * @declaredat /home/jesper/git/extendj/java4/backend/Transformations.jrag:86 */ private ConstructorAccess refined_Transformations_ConstructorAccess_transformed() { return this; } /** * Defines the expected kind of name for the left hand side in a qualified * expression. * @attribute syn * @aspect SyntacticClassification * @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:60 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="SyntacticClassification", declaredAt="/home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:60") public NameType predNameType() { NameType predNameType_value = NameType.AMBIGUOUS_NAME; return predNameType_value; } /** * @attribute syn * @aspect Names * @declaredat /home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag:37 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Names", declaredAt="/home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag:37") public String name() { String name_value = "this"; return name_value; } /** * @attribute syn * @aspect ConstructScope * @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:85 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="ConstructScope", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:85") public boolean applicableAndAccessible(ConstructorDecl decl) { boolean applicableAndAccessible_ConstructorDecl_value = decl.applicable(getArgList()) && decl.accessibleFrom(hostType()); return applicableAndAccessible_ConstructorDecl_value; } /** @apilevel internal */ private void decls_reset() { decls_computed = null; decls_value = null; } /** @apilevel internal */ protected ASTState.Cycle decls_computed = null; /** @apilevel internal */ protected SimpleSet decls_value; /** * @attribute syn * @aspect ConstructScope * @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:94 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="ConstructScope", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:94") public SimpleSet decls() { ASTState state = state(); if (decls_computed == ASTState.NON_CYCLE || decls_computed == state().cycle()) { return decls_value; } decls_value = chooseConstructor(lookupConstructor(), getArgList()); if (state().inCircle()) { decls_computed = state().cycle(); } else { decls_computed = ASTState.NON_CYCLE; } return decls_value; } /** @apilevel internal */ private void decl_reset() { decl_computed = null; decl_value = null; } /** @apilevel internal */ protected ASTState.Cycle decl_computed = null; /** @apilevel internal */ protected ConstructorDecl decl_value; /** * @attribute syn * @aspect ConstructScope * @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:102 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="ConstructScope", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:102") public ConstructorDecl decl() { ASTState state = state(); if (decl_computed == ASTState.NON_CYCLE || decl_computed == state().cycle()) { return decl_value; } decl_value = decl_compute(); if (state().inCircle()) { decl_computed = state().cycle(); } else { decl_computed = ASTState.NON_CYCLE; } return decl_value; } /** @apilevel internal */ private ConstructorDecl decl_compute() { SimpleSet decls = decls(); if (decls.isSingleton()) { return decls.singletonValue(); } return unknownConstructor(); } /** @apilevel internal */ private void type_reset() { type_computed = null; type_value = null; } /** @apilevel internal */ protected ASTState.Cycle type_computed = null; /** @apilevel internal */ protected TypeDecl type_value; /** * @attribute syn * @aspect TypeAnalysis * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:295 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeAnalysis", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:295") public TypeDecl type() { ASTState state = state(); if (type_computed == ASTState.NON_CYCLE || type_computed == state().cycle()) { return type_value; } type_value = decl().type(); if (state().inCircle()) { type_computed = state().cycle(); } else { type_computed = ASTState.NON_CYCLE; } return type_value; } /** * @attribute syn * @aspect DefiniteAssignment * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:268 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="DefiniteAssignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:268") public boolean assignedAfter(Variable v) { boolean assignedAfter_Variable_value = v.isField(); return assignedAfter_Variable_value; } /** @apilevel internal */ private void unassignedAfter_Variable_reset() { unassignedAfter_Variable_values = null; } protected java.util.Map unassignedAfter_Variable_values; @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true) @ASTNodeAnnotation.Source(aspect="DefiniteUnassignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:899") public boolean unassignedAfter(Variable v) { Object _parameters = v; if (unassignedAfter_Variable_values == null) unassignedAfter_Variable_values = new java.util.HashMap(4); ASTState.CircularValue _value; if (unassignedAfter_Variable_values.containsKey(_parameters)) { Object _cache = unassignedAfter_Variable_values.get(_parameters); if (!(_cache instanceof ASTState.CircularValue)) { return (Boolean) _cache; } else { _value = (ASTState.CircularValue) _cache; } } else { _value = new ASTState.CircularValue(); unassignedAfter_Variable_values.put(_parameters, _value); _value.value = true; } ASTState state = state(); if (!state.inCircle() || state.calledByLazyAttribute()) { state.enterCircle(); boolean new_unassignedAfter_Variable_value; do { _value.cycle = state.nextCycle(); new_unassignedAfter_Variable_value = !v.isField(); if (((Boolean)_value.value) != new_unassignedAfter_Variable_value) { state.setChangeInCycle(); _value.value = new_unassignedAfter_Variable_value; } } while (state.testAndClearChangeInCycle()); unassignedAfter_Variable_values.put(_parameters, new_unassignedAfter_Variable_value); state.leaveCircle(); return new_unassignedAfter_Variable_value; } else if (_value.cycle != state.cycle()) { _value.cycle = state.cycle(); boolean new_unassignedAfter_Variable_value = !v.isField(); if (((Boolean)_value.value) != new_unassignedAfter_Variable_value) { state.setChangeInCycle(); _value.value = new_unassignedAfter_Variable_value; } return new_unassignedAfter_Variable_value; } else { return (Boolean) _value.value; } } /** * @attribute syn * @aspect NameCheck * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:174 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="NameCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/NameCheck.jrag:174") public Collection nameProblems() { { Collection problems = new LinkedList(); ConstructorDecl decl = (ConstructorDecl) enclosingBodyDecl(); if (((ExprStmt) decl.getConstructorInvocation()).getExpr() == this) { // Don't error-check the parsed constructor invocation in case it is not the used one. if (decls().isEmpty()) { problems.add(errorf("no constructor matches %s", this.prettyPrint())); } else if (decls().size() > 1 && validArgs()) { problems.add(errorf("several most specific constructors for %s", this.prettyPrint())); for (ConstructorDecl cons : decls()) { problems.add(errorf(" %s", cons.signature())); } } } return problems; } } /** * @attribute syn * @aspect NameCheck * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:191 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="NameCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/NameCheck.jrag:191") public boolean validArgs() { { for (int i = 0; i < getNumArg(); i++) { if (getArg(i).type().isUnknown()) { return false; } } return true; } } /** * @attribute syn * @aspect ExceptionHandling * @declaredat /home/jesper/git/extendj/java4/frontend/ExceptionHandling.jrag:152 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="ExceptionHandling", declaredAt="/home/jesper/git/extendj/java4/frontend/ExceptionHandling.jrag:152") public Collection exceptionHandlingProblems() { { Collection problems = new LinkedList(); for (Access exception : decl().getExceptionList()) { TypeDecl exceptionType = exception.type(); if (exceptionType.isCheckedException() && !handlesException(exceptionType)) { problems.add(errorf("%s may throw uncaught exception %s", this.prettyPrint(), exceptionType.fullName())); } } return problems; } } /** * @attribute syn * @aspect VariableArityParameters * @declaredat /home/jesper/git/extendj/java5/frontend/VariableArityParameters.jrag:75 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="VariableArityParameters", declaredAt="/home/jesper/git/extendj/java5/frontend/VariableArityParameters.jrag:75") public boolean invokesVariableArityAsArray() { { if (!decl().isVariableArity()) { return false; } if (arity() != decl().arity()) { return false; } return getArg(getNumArg()-1).type().methodInvocationConversionTo(decl().lastParameter().type()); } } /** * @attribute syn * @aspect MethodSignature15 * @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:681 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="MethodSignature15", declaredAt="/home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:681") public int arity() { int arity_value = getNumArg(); return arity_value; } /** * @attribute syn * @aspect Transformations * @declaredat /home/jesper/git/extendj/java4/backend/Transformations.jrag:86 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Transformations", declaredAt="/home/jesper/git/extendj/java4/backend/Transformations.jrag:86") public ConstructorAccess transformed() { { if (decl().isVariableArity() && !invokesVariableArityAsArray()) { return transformedVariableArity(); } else { return refined_Transformations_ConstructorAccess_transformed(); } } } /** * @attribute syn * @aspect CreateBCode * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:300 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:300") public boolean needsPop() { boolean needsPop_value = false; return needsPop_value; } /** @apilevel internal */ private void transformedVariableArity_reset() { transformedVariableArity_computed = false; transformedVariableArity_value = null; } /** @apilevel internal */ protected boolean transformedVariableArity_computed = false; /** @apilevel internal */ protected ConstructorAccess transformedVariableArity_value; /** * @attribute syn * @aspect VariableArityParametersCodegen * @declaredat /home/jesper/git/extendj/java5/backend/VariableArityParametersCodegen.jrag:125 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isNTA=true) @ASTNodeAnnotation.Source(aspect="VariableArityParametersCodegen", declaredAt="/home/jesper/git/extendj/java5/backend/VariableArityParametersCodegen.jrag:125") public ConstructorAccess transformedVariableArity() { ASTState state = state(); if (transformedVariableArity_computed) { return transformedVariableArity_value; } state().enterLazyAttribute(); transformedVariableArity_value = transformedVariableArity_compute(); transformedVariableArity_value.setParent(this); transformedVariableArity_computed = true; state().leaveLazyAttribute(); return transformedVariableArity_value; } /** @apilevel internal */ private ConstructorAccess transformedVariableArity_compute() { ConstructorDecl decl = decl(); // Arguments to normal parameters. List args = new List(); for (int i = 0; i < decl.getNumParameter() - 1; i++) { args.add(getArg(i).treeCopyNoTransform()); } // Arguments to variable arity parameters. List last = new List(); for (int i = decl.getNumParameter() - 1; i < getNumArg(); i++) { last.add(getArg(i).treeCopyNoTransform()); } // Build an array holding arguments. Access typeAccess = decl.lastParameter().type().elementType().createQualifiedAccess(); for (int i = 0; i < decl.lastParameter().type().dimension(); i++) { typeAccess = new ArrayTypeAccess(typeAccess); } args.add(new ArrayCreationExpr(typeAccess, new Opt(new ArrayInit(last)))); return new ConstructorAccess(getID(), args); } /** * @attribute inh * @aspect ConstructScope * @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:35 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="ConstructScope", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:35") public Collection lookupConstructor() { Collection lookupConstructor_value = getParent().Define_lookupConstructor(this, null); return lookupConstructor_value; } /** * @attribute inh * @aspect ConstructScope * @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:110 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="ConstructScope", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:110") public ConstructorDecl unknownConstructor() { ConstructorDecl unknownConstructor_value = getParent().Define_unknownConstructor(this, null); return unknownConstructor_value; } /** * @attribute inh * @aspect ExceptionHandling * @declaredat /home/jesper/git/extendj/java4/frontend/ExceptionHandling.jrag:89 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="ExceptionHandling", declaredAt="/home/jesper/git/extendj/java4/frontend/ExceptionHandling.jrag:89") public boolean handlesException(TypeDecl exceptionType) { boolean handlesException_TypeDecl_value = getParent().Define_handlesException(this, null, exceptionType); return handlesException_TypeDecl_value; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36 * @apilevel internal */ public NameType Define_nameType(ASTNode _callerNode, ASTNode _childNode) { if (_callerNode == getArgListNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:140 int childIndex = _callerNode.getIndexOfChild(_childNode); return NameType.EXPRESSION_NAME; } else { return getParent().Define_nameType(this, _callerNode); } } /** * @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/java4/frontend/LookupType.jrag:113 * @apilevel internal */ public boolean Define_hasPackage(ASTNode _callerNode, ASTNode _childNode, String packageName) { if (_callerNode == getArgListNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:116 int childIndex = _callerNode.getIndexOfChild(_childNode); return unqualifiedScope().hasPackage(packageName); } else { return getParent().Define_hasPackage(this, _callerNode, packageName); } } /** * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:113 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute hasPackage */ protected boolean canDefine_hasPackage(ASTNode _callerNode, ASTNode _childNode, String packageName) { return true; } /** * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:231 * @apilevel internal */ public SimpleSet Define_lookupType(ASTNode _callerNode, ASTNode _childNode, String name) { if (_callerNode == getArgListNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:387 int childIndex = _callerNode.getIndexOfChild(_childNode); return unqualifiedScope().lookupType(name); } else { return getParent().Define_lookupType(this, _callerNode, name); } } /** * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:231 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute lookupType */ protected boolean canDefine_lookupType(ASTNode _callerNode, ASTNode _childNode, String name) { return true; } /** * @declaredat /home/jesper/git/extendj/java5/frontend/EnhancedFor.jrag:138 * @apilevel internal */ public SimpleSet Define_lookupVariable(ASTNode _callerNode, ASTNode _childNode, String name) { if (_callerNode == getArgListNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:242 int childIndex = _callerNode.getIndexOfChild(_childNode); return unqualifiedScope().lookupVariable(name); } else { return getParent().Define_lookupVariable(this, _callerNode, name); } } /** * @declaredat /home/jesper/git/extendj/java5/frontend/EnhancedFor.jrag:138 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute lookupVariable */ protected boolean canDefine_lookupVariable(ASTNode _callerNode, ASTNode _childNode, String name) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:33 * @apilevel internal */ public String Define_methodHost(ASTNode _callerNode, ASTNode _childNode) { int childIndex = this.getIndexOfChild(_callerNode); return unqualifiedScope().methodHost(); } /** * @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:33 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute methodHost */ protected boolean canDefine_methodHost(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:204 * @apilevel internal */ public boolean Define_inExplicitConstructorInvocation(ASTNode _callerNode, ASTNode _childNode) { if (_callerNode == getArgListNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:207 int childIndex = _callerNode.getIndexOfChild(_childNode); return true; } else { return getParent().Define_inExplicitConstructorInvocation(this, _callerNode); } } /** * @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:204 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute inExplicitConstructorInvocation */ protected boolean canDefine_inExplicitConstructorInvocation(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:212 * @apilevel internal */ public TypeDecl Define_enclosingExplicitConstructorHostType(ASTNode _callerNode, ASTNode _childNode) { if (_callerNode == getArgListNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:216 int childIndex = _callerNode.getIndexOfChild(_childNode); return hostType(); } else { return getParent().Define_enclosingExplicitConstructorHostType(this, _callerNode); } } /** * @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:212 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute enclosingExplicitConstructorHostType */ protected boolean canDefine_enclosingExplicitConstructorHostType(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:116 * @apilevel internal */ public Collection Define_lookupMethod(ASTNode _callerNode, ASTNode _childNode, String name) { if (_callerNode == getArgListNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:130 int childIndex = _callerNode.getIndexOfChild(_childNode); return unqualifiedScope().lookupMethod(name); } else { return getParent().Define_lookupMethod(this, _callerNode, name); } } /** * @declaredat /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:116 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute lookupMethod */ protected boolean canDefine_lookupMethod(ASTNode _callerNode, ASTNode _childNode, String name) { 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/NameCheck.jrag:172 { 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/ExceptionHandling.jrag:150 { 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/java5/frontend/Annotations.jrag:513 if (decl().isDeprecated() && !withinDeprecatedAnnotation() && hostType().topLevelType() != decl().hostType().topLevelType() && !withinSuppressWarnings("deprecation")) { { 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 collect_contributors_TypeDecl_accessors(CompilationUnit _root, java.util.Map> _map) { // @declaredat /home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag:386 if (decl().isPrivate() && type() != hostType()) { { TypeDecl target = (TypeDecl) (decl().createAccessor().hostType()); java.util.Set contributors = _map.get(target); if (contributors == null) { contributors = new java.util.LinkedHashSet(); _map.put((ASTNode) target, contributors); } contributors.add(this); } } super.collect_contributors_TypeDecl_accessors(_root, _map); } /** @apilevel internal */ protected void collect_contributors_TypeDecl_nestedTypes(CompilationUnit _root, java.util.Map> _map) { { if (transformed() != this) { transformed().collect_contributors_TypeDecl_nestedTypes(_root, _map); } else { super.collect_contributors_TypeDecl_nestedTypes(_root, _map); } } } /** @apilevel internal */ protected void contributeTo_CompilationUnit_problems(LinkedList collection) { super.contributeTo_CompilationUnit_problems(collection); for (Problem value : nameProblems()) { collection.add(value); } for (Problem value : exceptionHandlingProblems()) { collection.add(value); } if (decl().isDeprecated() && !withinDeprecatedAnnotation() && hostType().topLevelType() != decl().hostType().topLevelType() && !withinSuppressWarnings("deprecation")) { collection.add(warning(decl().signature() + " in " + decl().hostType().typeName() + " has been deprecated")); } } /** @apilevel internal */ protected void contributeTo_TypeDecl_accessors(HashSet collection) { super.contributeTo_TypeDecl_accessors(collection); if (decl().isPrivate() && type() != hostType()) { collection.add(decl().createAccessor()); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy