org.extendj.ast.ParClassDecl Maven / Gradle / Ivy
/* 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 specific parameterization of a generic class declaration.
*
* The parameterization is specified by the Parameterization token.
*
*
The members declarations of this class are constructed on demand using
* the BodyDecl nonterminal attribute. The member declarations are "signature"
* copies of the original declarations, keeping only the information needed for
* type analysis.
* @ast node
* @declaredat /home/jesper/git/extendj/java5/grammar/Generics.ast:17
* @astdecl ParClassDecl : ClassDecl ::= TypeParameter:TypeVariable* SubstTypeParam:TypeVariable* [SuperClass:Access] Implements:Access* BodyDecl*;
* @production ParClassDecl : {@link ClassDecl} ::= TypeParameter:{@link TypeVariable}* SubstTypeParam:{@link TypeVariable}* <Parameterization:Parameterization> [SuperClass:{@link Access}] Implements:{@link Access}* {@link BodyDecl}*;
*/
public class ParClassDecl extends ClassDecl implements Cloneable, ParTypeDecl, MemberSubstitutor {
/**
* @aspect PrettyPrintUtil5
* @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrintUtil.jrag:68
*/
@Override public String toString() {
StringBuilder params = new StringBuilder();
Parameterization parameterization = getParameterization(); // Token child (no rewrites).
for (TypeDecl arg : parameterization.args) {
if (params.length() > 0) {
params.append(", ");
}
params.append(arg.toString());
}
return String.format("%s<%s>", getID(), params.toString());
}
/**
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1273
*/
public int numTypeParameter() {
return ((GenericTypeDecl) original()).getNumTypeParameter();
}
/**
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1277
*/
public TypeVariable typeParameter(int index) {
return ((GenericTypeDecl) original()).getTypeParameter(index);
}
/**
* @aspect GenericsParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsParTypeDecl.jrag:107
*/
public Access createQualifiedAccess() {
List typeArgumentList = new List();
for (TypeDecl arg : getParameterization().args) {
typeArgumentList.add(arg.createQualifiedAccess());
}
if (!isTopLevelType()) {
if (isRawType()) {
return enclosingType().createQualifiedAccess()
.qualifiesAccess(new TypeAccess("", getID()));
} else {
return enclosingType().createQualifiedAccess()
.qualifiesAccess(new ParTypeAccess(new TypeAccess("", getID()), typeArgumentList));
}
} else {
if (isRawType()) {
return new TypeAccess(packageName(), getID());
} else {
return new ParTypeAccess(new TypeAccess(packageName(), getID()), typeArgumentList);
}
}
}
/**
* @declaredat ASTNode:1
*/
public ParClassDecl() {
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[7];
setChild(new List(), 1);
setChild(new Opt(), 2);
setChild(new List(), 3);
setChild(new Opt(), 4);
setChild(new List(), 5);
setChild(new List(), 6);
}
/**
* @declaredat ASTNode:19
*/
@ASTNodeAnnotation.Constructor(
name = {"Modifiers", "ID", "TypeParameter", "Parameterization", "SuperClass", "Implements"},
type = {"Modifiers", "String", "List", "Parameterization", "Opt", "List"},
kind = {"Child", "Token", "List", "Token", "Opt", "List"}
)
public ParClassDecl(Modifiers p0, String p1, List p2, Parameterization p3, Opt p4, List p5) {
setChild(p0, 0);
setID(p1);
setChild(p2, 1);
setParameterization(p3);
setChild(p4, 2);
setChild(p5, 3);
}
/**
* @declaredat ASTNode:32
*/
public ParClassDecl(Modifiers p0, beaver.Symbol p1, List p2, Parameterization p3, Opt p4, List p5) {
setChild(p0, 0);
setID(p1);
setChild(p2, 1);
setParameterization(p3);
setChild(p4, 2);
setChild(p5, 3);
}
/** @apilevel low-level
* @declaredat ASTNode:41
*/
protected int numChildren() {
return 4;
}
/**
* @apilevel internal
* @declaredat ASTNode:47
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:51
*/
public void flushAttrCache() {
super.flushAttrCache();
subtype_TypeDecl_reset();
sameStructure_TypeDecl_reset();
instanceOf_TypeDecl_reset();
erasure_reset();
getSubstTypeParamList_reset();
getBodyDeclList_reset();
involvesTypeParameters_reset();
strictSubtype_TypeDecl_reset();
typeDescriptor_reset();
constantPoolName_reset();
needsSignatureAttribute_reset();
firstTypeArgument_reset();
sameSignature_java_util_List_TypeDecl__reset();
usesTypeVariable_reset();
sourceTypeDecl_reset();
fullName_reset();
typeName_reset();
unimplementedMethods_reset();
uniqueIndex_reset();
localMethods_reset();
localFields_String_reset();
localTypeDecls_String_reset();
genericDecl_reset();
}
/** @apilevel internal
* @declaredat ASTNode:78
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:82
*/
public ParClassDecl clone() throws CloneNotSupportedException {
ParClassDecl node = (ParClassDecl) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:87
*/
public ParClassDecl copy() {
try {
ParClassDecl node = (ParClassDecl) 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:106
*/
@Deprecated
public ParClassDecl 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:116
*/
public ParClassDecl treeCopyNoTransform() {
ParClassDecl tree = (ParClassDecl) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
switch (i) {
case 4:
tree.children[i] = new Opt();
continue;
case 5:
case 6:
tree.children[i] = new List();
continue;
}
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:145
*/
public ParClassDecl treeCopy() {
ParClassDecl tree = (ParClassDecl) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
switch (i) {
case 4:
tree.children[i] = new Opt();
continue;
case 5:
case 6:
tree.children[i] = new List();
continue;
}
ASTNode child = (ASTNode) getChild(i);
if (child != null) {
child = child.treeCopy();
tree.setChild(child, i);
}
}
}
return tree;
}
/** @apilevel internal
* @declaredat ASTNode:168
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node) && (tokenString_ID == ((ParClassDecl) node).tokenString_ID) && (tokenParameterization_Parameterization == ((ParClassDecl) node).tokenParameterization_Parameterization);
}
/**
* 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 TypeParameter list.
* @param list The new list node to be used as the TypeParameter list.
* @apilevel high-level
*/
public void setTypeParameterList(List list) {
setChild(list, 1);
}
/**
* Retrieves the number of children in the TypeParameter list.
* @return Number of children in the TypeParameter list.
* @apilevel high-level
*/
public int getNumTypeParameter() {
return getTypeParameterList().getNumChild();
}
/**
* Retrieves the number of children in the TypeParameter list.
* Calling this method will not trigger rewrites.
* @return Number of children in the TypeParameter list.
* @apilevel low-level
*/
public int getNumTypeParameterNoTransform() {
return getTypeParameterListNoTransform().getNumChildNoTransform();
}
/**
* Retrieves the element at index {@code i} in the TypeParameter list.
* @param i Index of the element to return.
* @return The element at position {@code i} in the TypeParameter list.
* @apilevel high-level
*/
public TypeVariable getTypeParameter(int i) {
return (TypeVariable) getTypeParameterList().getChild(i);
}
/**
* Check whether the TypeParameter list has any children.
* @return {@code true} if it has at least one child, {@code false} otherwise.
* @apilevel high-level
*/
public boolean hasTypeParameter() {
return getTypeParameterList().getNumChild() != 0;
}
/**
* Append an element to the TypeParameter list.
* @param node The element to append to the TypeParameter list.
* @apilevel high-level
*/
public void addTypeParameter(TypeVariable node) {
List list = (parent == null) ? getTypeParameterListNoTransform() : getTypeParameterList();
list.addChild(node);
}
/** @apilevel low-level
*/
public void addTypeParameterNoTransform(TypeVariable node) {
List list = getTypeParameterListNoTransform();
list.addChild(node);
}
/**
* Replaces the TypeParameter 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 setTypeParameter(TypeVariable node, int i) {
List list = getTypeParameterList();
list.setChild(node, i);
}
/**
* Retrieves the TypeParameter list.
* @return The node representing the TypeParameter list.
* @apilevel high-level
*/
@ASTNodeAnnotation.ListChild(name="TypeParameter")
public List getTypeParameterList() {
List list = (List) getChild(1);
return list;
}
/**
* Retrieves the TypeParameter list.
* This method does not invoke AST transformations.
* @return The node representing the TypeParameter list.
* @apilevel low-level
*/
public List getTypeParameterListNoTransform() {
return (List) getChildNoTransform(1);
}
/**
* @return the element at index {@code i} in the TypeParameter list without
* triggering rewrites.
*/
public TypeVariable getTypeParameterNoTransform(int i) {
return (TypeVariable) getTypeParameterListNoTransform().getChildNoTransform(i);
}
/**
* Retrieves the TypeParameter list.
* @return The node representing the TypeParameter list.
* @apilevel high-level
*/
public List getTypeParameters() {
return getTypeParameterList();
}
/**
* Retrieves the TypeParameter list.
* This method does not invoke AST transformations.
* @return The node representing the TypeParameter list.
* @apilevel low-level
*/
public List getTypeParametersNoTransform() {
return getTypeParameterListNoTransform();
}
/**
* Replaces the lexeme Parameterization.
* @param value The new value for the lexeme Parameterization.
* @apilevel high-level
*/
public void setParameterization(Parameterization value) {
tokenParameterization_Parameterization = value;
}
/** @apilevel internal
*/
protected Parameterization tokenParameterization_Parameterization;
/**
* Retrieves the value for the lexeme Parameterization.
* @return The value for the lexeme Parameterization.
* @apilevel high-level
*/
@ASTNodeAnnotation.Token(name="Parameterization")
public Parameterization getParameterization() {
return tokenParameterization_Parameterization;
}
/**
* Replaces the optional node for the SuperClass child. This is the Opt
* node containing the child SuperClass, not the actual child!
* @param opt The new node to be used as the optional node for the SuperClass child.
* @apilevel low-level
*/
public void setSuperClassOpt(Opt opt) {
setChild(opt, 2);
}
/**
* Replaces the (optional) SuperClass child.
* @param node The new node to be used as the SuperClass child.
* @apilevel high-level
*/
public void setSuperClass(Access node) {
getSuperClassOpt().setChild(node, 0);
}
/**
* Check whether the optional SuperClass child exists.
* @return {@code true} if the optional SuperClass child exists, {@code false} if it does not.
* @apilevel high-level
*/
public boolean hasSuperClass() {
return getSuperClassOpt().getNumChild() != 0;
}
/**
* Retrieves the (optional) SuperClass child.
* @return The SuperClass child, if it exists. Returns {@code null} otherwise.
* @apilevel low-level
*/
public Access getSuperClass() {
return (Access) getSuperClassOpt().getChild(0);
}
/**
* Retrieves the optional node for the SuperClass child. This is the Opt
node containing the child SuperClass, not the actual child!
* @return The optional node for child the SuperClass child.
* @apilevel low-level
*/
@ASTNodeAnnotation.OptChild(name="SuperClass")
public Opt getSuperClassOpt() {
return (Opt) getChild(2);
}
/**
* Retrieves the optional node for child SuperClass. This is the Opt
node containing the child SuperClass, not the actual child!
* This method does not invoke AST transformations.
* @return The optional node for child SuperClass.
* @apilevel low-level
*/
public Opt getSuperClassOptNoTransform() {
return (Opt) getChildNoTransform(2);
}
/**
* Replaces the Implements list.
* @param list The new list node to be used as the Implements list.
* @apilevel high-level
*/
public void setImplementsList(List list) {
setChild(list, 3);
}
/**
* Retrieves the number of children in the Implements list.
* @return Number of children in the Implements list.
* @apilevel high-level
*/
public int getNumImplements() {
return getImplementsList().getNumChild();
}
/**
* Retrieves the number of children in the Implements list.
* Calling this method will not trigger rewrites.
* @return Number of children in the Implements list.
* @apilevel low-level
*/
public int getNumImplementsNoTransform() {
return getImplementsListNoTransform().getNumChildNoTransform();
}
/**
* Retrieves the element at index {@code i} in the Implements list.
* @param i Index of the element to return.
* @return The element at position {@code i} in the Implements list.
* @apilevel high-level
*/
public Access getImplements(int i) {
return (Access) getImplementsList().getChild(i);
}
/**
* Check whether the Implements list has any children.
* @return {@code true} if it has at least one child, {@code false} otherwise.
* @apilevel high-level
*/
public boolean hasImplements() {
return getImplementsList().getNumChild() != 0;
}
/**
* Append an element to the Implements list.
* @param node The element to append to the Implements list.
* @apilevel high-level
*/
public void addImplements(Access node) {
List list = (parent == null) ? getImplementsListNoTransform() : getImplementsList();
list.addChild(node);
}
/** @apilevel low-level
*/
public void addImplementsNoTransform(Access node) {
List list = getImplementsListNoTransform();
list.addChild(node);
}
/**
* Replaces the Implements 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 setImplements(Access node, int i) {
List list = getImplementsList();
list.setChild(node, i);
}
/**
* Retrieves the Implements list.
* @return The node representing the Implements list.
* @apilevel high-level
*/
@ASTNodeAnnotation.ListChild(name="Implements")
public List getImplementsList() {
List list = (List) getChild(3);
return list;
}
/**
* Retrieves the Implements list.
* This method does not invoke AST transformations.
* @return The node representing the Implements list.
* @apilevel low-level
*/
public List getImplementsListNoTransform() {
return (List) getChildNoTransform(3);
}
/**
* @return the element at index {@code i} in the Implements list without
* triggering rewrites.
*/
public Access getImplementsNoTransform(int i) {
return (Access) getImplementsListNoTransform().getChildNoTransform(i);
}
/**
* Retrieves the Implements list.
* @return The node representing the Implements list.
* @apilevel high-level
*/
public List getImplementss() {
return getImplementsList();
}
/**
* Retrieves the Implements list.
* This method does not invoke AST transformations.
* @return The node representing the Implements list.
* @apilevel low-level
*/
public List getImplementssNoTransform() {
return getImplementsListNoTransform();
}
/**
* Replaces the (optional) ImplicitConstructor child.
* @param node The new node to be used as the ImplicitConstructor child.
* @apilevel high-level
*/
public void setImplicitConstructor(ConstructorDecl node) {
getImplicitConstructorOpt().setChild(node, 0);
}
/**
* Check whether the optional ImplicitConstructor child exists.
* @return {@code true} if the optional ImplicitConstructor child exists, {@code false} if it does not.
* @apilevel high-level
*/
public boolean hasImplicitConstructor() {
return getImplicitConstructorOpt().getNumChild() != 0;
}
/**
* Retrieves the (optional) ImplicitConstructor child.
* @return The ImplicitConstructor child, if it exists. Returns {@code null} otherwise.
* @apilevel low-level
*/
public ConstructorDecl getImplicitConstructor() {
return (ConstructorDecl) getImplicitConstructorOpt().getChild(0);
}
/**
* Retrieves the optional node for child ImplicitConstructor. This is the Opt
node containing the child ImplicitConstructor, not the actual child!
* This method does not invoke AST transformations.
* @return The optional node for child ImplicitConstructor.
* @apilevel low-level
*/
public Opt getImplicitConstructorOptNoTransform() {
return (Opt) getChildNoTransform(4);
}
/**
* Retrieves the child position of the optional child ImplicitConstructor.
* @return The the child position of the optional child ImplicitConstructor.
* @apilevel low-level
*/
protected int getImplicitConstructorOptChildPosition() {
return 4;
}
/**
* Retrieves the number of children in the SubstTypeParam list.
* @return Number of children in the SubstTypeParam list.
* @apilevel high-level
*/
public int getNumSubstTypeParam() {
return getSubstTypeParamList().getNumChild();
}
/**
* Retrieves the number of children in the SubstTypeParam list.
* Calling this method will not trigger rewrites.
* @return Number of children in the SubstTypeParam list.
* @apilevel low-level
*/
public int getNumSubstTypeParamNoTransform() {
return getSubstTypeParamListNoTransform().getNumChildNoTransform();
}
/**
* Retrieves the element at index {@code i} in the SubstTypeParam list.
* @param i Index of the element to return.
* @return The element at position {@code i} in the SubstTypeParam list.
* @apilevel high-level
*/
public TypeVariable getSubstTypeParam(int i) {
return (TypeVariable) getSubstTypeParamList().getChild(i);
}
/**
* Check whether the SubstTypeParam list has any children.
* @return {@code true} if it has at least one child, {@code false} otherwise.
* @apilevel high-level
*/
public boolean hasSubstTypeParam() {
return getSubstTypeParamList().getNumChild() != 0;
}
/**
* Append an element to the SubstTypeParam list.
* @param node The element to append to the SubstTypeParam list.
* @apilevel high-level
*/
public void addSubstTypeParam(TypeVariable node) {
List list = (parent == null) ? getSubstTypeParamListNoTransform() : getSubstTypeParamList();
list.addChild(node);
}
/** @apilevel low-level
*/
public void addSubstTypeParamNoTransform(TypeVariable node) {
List list = getSubstTypeParamListNoTransform();
list.addChild(node);
}
/**
* Replaces the SubstTypeParam 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 setSubstTypeParam(TypeVariable node, int i) {
List list = getSubstTypeParamList();
list.setChild(node, i);
}
/**
* Retrieves the child position of the SubstTypeParam list.
* @return The the child position of the SubstTypeParam list.
* @apilevel low-level
*/
protected int getSubstTypeParamListChildPosition() {
return 5;
}
/**
* Retrieves the SubstTypeParam list.
* This method does not invoke AST transformations.
* @return The node representing the SubstTypeParam list.
* @apilevel low-level
*/
public List getSubstTypeParamListNoTransform() {
return (List) getChildNoTransform(5);
}
/**
* @return the element at index {@code i} in the SubstTypeParam list without
* triggering rewrites.
*/
public TypeVariable getSubstTypeParamNoTransform(int i) {
return (TypeVariable) getSubstTypeParamListNoTransform().getChildNoTransform(i);
}
/**
* Retrieves the SubstTypeParam list.
* @return The node representing the SubstTypeParam list.
* @apilevel high-level
*/
public List getSubstTypeParams() {
return getSubstTypeParamList();
}
/**
* Retrieves the SubstTypeParam list.
* This method does not invoke AST transformations.
* @return The node representing the SubstTypeParam list.
* @apilevel low-level
*/
public List getSubstTypeParamsNoTransform() {
return getSubstTypeParamListNoTransform();
}
/**
* This method should not be called. This method throws an exception due to
* the corresponding child being an NTA shadowing a non-NTA child.
* @param node
* @apilevel internal
*/
public void setBodyDeclList(List node) {
throw new Error("Can not replace NTA child BodyDeclList in ParClassDecl!");
}
/**
* 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 child position of the BodyDecl list.
* @return The the child position of the BodyDecl list.
* @apilevel low-level
*/
protected int getBodyDeclListChildPosition() {
return 6;
}
/**
* 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(6);
}
/**
* @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();
}
/**
* A type is reifiable if it either refers to a non-parameterized type,
* is a raw type, is a parameterized type with only unbound wildcard
* parameters or is an array type with a reifiable type parameter.
*
* @see "JLS SE7 §4.7"
* @attribute syn
* @aspect ReifiableTypes
* @declaredat /home/jesper/git/extendj/java5/frontend/ReifiableTypes.jrag:39
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ReifiableTypes", declaredAt="/home/jesper/git/extendj/java5/frontend/ReifiableTypes.jrag:39")
public boolean isReifiable() {
{
if (original().isInnerClass() && !original().enclosingType().isReifiable()) {
return false;
}
for (TypeDecl argument : getParameterization().args) {
if (!argument.isUnboundedWildcard()) {
return false;
}
}
return true;
}
}
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:37
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:37")
public boolean supertypeGenericClassDecl(GenericClassDecl type) {
boolean supertypeGenericClassDecl_GenericClassDecl_value = type.subtype(genericDecl().original());
return supertypeGenericClassDecl_GenericClassDecl_value;
}
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:515
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:515")
public boolean supertypeClassDecl(ClassDecl type) {
boolean supertypeClassDecl_ClassDecl_value = super.supertypeClassDecl(type);
return supertypeClassDecl_ClassDecl_value;
}
/** @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:500")
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.supertypeParClassDecl(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.supertypeParClassDecl(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:49
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:49")
public boolean supertypeRawClassDecl(RawClassDecl type) {
boolean supertypeRawClassDecl_RawClassDecl_value = type.genericDecl().original().subtype(genericDecl().original());
return supertypeRawClassDecl_RawClassDecl_value;
}
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:53
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:53")
public boolean supertypeRawInterfaceDecl(RawInterfaceDecl type) {
boolean supertypeRawInterfaceDecl_RawInterfaceDecl_value = type.genericDecl().original().subtype(genericDecl().original());
return supertypeRawInterfaceDecl_RawInterfaceDecl_value;
}
/** @apilevel internal */
private void sameStructure_TypeDecl_reset() {
sameStructure_TypeDecl_values = null;
}
protected java.util.Map sameStructure_TypeDecl_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:218")
public boolean sameStructure(TypeDecl t) {
Object _parameters = t;
if (sameStructure_TypeDecl_values == null) sameStructure_TypeDecl_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (sameStructure_TypeDecl_values.containsKey(_parameters)) {
Object _cache = sameStructure_TypeDecl_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
sameStructure_TypeDecl_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_sameStructure_TypeDecl_value;
do {
_value.cycle = state.nextCycle();
new_sameStructure_TypeDecl_value = sameStructure_compute(t);
if (((Boolean)_value.value) != new_sameStructure_TypeDecl_value) {
state.setChangeInCycle();
_value.value = new_sameStructure_TypeDecl_value;
}
} while (state.testAndClearChangeInCycle());
sameStructure_TypeDecl_values.put(_parameters, new_sameStructure_TypeDecl_value);
state.leaveCircle();
return new_sameStructure_TypeDecl_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_sameStructure_TypeDecl_value = sameStructure_compute(t);
if (((Boolean)_value.value) != new_sameStructure_TypeDecl_value) {
state.setChangeInCycle();
_value.value = new_sameStructure_TypeDecl_value;
}
return new_sameStructure_TypeDecl_value;
} else {
return (Boolean) _value.value;
}
}
/** @apilevel internal */
private boolean sameStructure_compute(TypeDecl t) {
if (!(t instanceof ParClassDecl)) {
return false;
}
ParClassDecl type = (ParClassDecl) t;
if (type.genericDecl().original() == genericDecl().original()) {
if (!getParameterization().compare(type.getParameterization(),
Parameterization.SAME_STRUCTURE)) {
return false;
}
if (isNestedType() && type.isNestedType()) {
return type.enclosingType().sameStructure(enclosingType());
}
return true;
}
return false;
}
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:148
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:148")
public boolean supertypeParClassDecl(ParClassDecl type) {
{
if (type.genericDecl().original() == genericDecl().original()) {
if (!type.getParameterization().compareSubstituted(getParameterization(),
Parameterization.CONTAINED_IN)) {
return false;
}
if (isNestedType() && type.isNestedType()) {
return type.enclosingType().subtype(enclosingType());
}
return true;
}
return supertypeClassDecl(type);
}
}
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:152
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsSubtype", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:152")
public boolean supertypeParInterfaceDecl(ParInterfaceDecl type) {
boolean supertypeParInterfaceDecl_ParInterfaceDecl_value = false;
return supertypeParInterfaceDecl_ParInterfaceDecl_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:442
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeWideningAndIdentity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:442")
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 = subtype(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;
}
/**
* @attribute syn
* @aspect NestedTypes
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:639
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="NestedTypes", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:639")
public TypeDecl hostType() {
TypeDecl hostType_value = original();
return hostType_value;
}
/**
* @attribute syn
* @aspect NestedTypes
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:552
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="NestedTypes", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:552")
public TypeDecl topLevelType() {
TypeDecl topLevelType_value = erasure().topLevelType();
return topLevelType_value;
}
/**
* @attribute syn
* @aspect Generics
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:341
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Generics", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:341")
public boolean isRawType() {
boolean isRawType_value = isNestedType() && enclosingType().isRawType();
return isRawType_value;
}
/** @apilevel internal */
private void erasure_reset() {
erasure_computed = null;
erasure_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle erasure_computed = null;
/** @apilevel internal */
protected TypeDecl erasure_value;
/**
* @attribute syn
* @aspect GenericsErasure
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:460
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsErasure", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:460")
public TypeDecl erasure() {
ASTState state = state();
if (erasure_computed == ASTState.NON_CYCLE || erasure_computed == state().cycle()) {
return erasure_value;
}
erasure_value = genericDecl();
if (state().inCircle()) {
erasure_computed = state().cycle();
} else {
erasure_computed = ASTState.NON_CYCLE;
}
return erasure_value;
}
/** @apilevel internal */
private void getSubstTypeParamList_reset() {
getSubstTypeParamList_computed = false;
getSubstTypeParamList_value = null;
}
/** @apilevel internal */
protected boolean getSubstTypeParamList_computed = false;
/** @apilevel internal */
protected List getSubstTypeParamList_value;
/** Substituted type parameters are used when checking type argument bounds.
* @attribute syn nta
* @aspect GenericsTypeCheck
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:736
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isNTA=true)
@ASTNodeAnnotation.Source(aspect="GenericsTypeCheck", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:736")
public List getSubstTypeParamList() {
ASTState state = state();
if (getSubstTypeParamList_computed) {
return (List) getChild(getSubstTypeParamListChildPosition());
}
state().enterLazyAttribute();
getSubstTypeParamList_value = getSubstTypeParamList_compute();
setChild(getSubstTypeParamList_value, getSubstTypeParamListChildPosition());
getSubstTypeParamList_computed = true;
state().leaveLazyAttribute();
List node = (List) this.getChild(getSubstTypeParamListChildPosition());
return node;
}
/** @apilevel internal */
private List getSubstTypeParamList_compute() {
List result = new List();
for (TypeVariable param : getTypeParameterList()) {
result.add(new SubstitutedTypeVariable(
new Modifiers(new List()),
param.getID(),
new List(),
param.getBoundList().treeCopy(),
getParameterization()));
}
return result;
}
/** @apilevel internal */
private void getBodyDeclList_reset() {
getBodyDeclList_computed = false;
getBodyDeclList_value = null;
}
/** @apilevel internal */
protected boolean getBodyDeclList_computed = false;
/** @apilevel internal */
protected List getBodyDeclList_value;
/**
* @attribute syn nta
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1708
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isNTA=true)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1708")
public List getBodyDeclList() {
ASTState state = state();
if (getBodyDeclList_computed) {
return (List) getChild(getBodyDeclListChildPosition());
}
state().enterLazyAttribute();
getBodyDeclList_value = original().substitutedBodyDecls();
setChild(getBodyDeclList_value, getBodyDeclListChildPosition());
getBodyDeclList_computed = true;
state().leaveLazyAttribute();
List node = (List) this.getChild(getBodyDeclListChildPosition());
return node;
}
/** @apilevel internal */
protected ASTState.Cycle involvesTypeParameters_cycle = null;
/** @apilevel internal */
private void involvesTypeParameters_reset() {
involvesTypeParameters_computed = false;
involvesTypeParameters_initialized = false;
involvesTypeParameters_cycle = null;
}
/** @apilevel internal */
protected boolean involvesTypeParameters_computed = false;
/** @apilevel internal */
protected boolean involvesTypeParameters_value;
/** @apilevel internal */
protected boolean involvesTypeParameters_initialized = false;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="GenericMethodsInference", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericMethodsInference.jrag:37")
public boolean involvesTypeParameters() {
if (involvesTypeParameters_computed) {
return involvesTypeParameters_value;
}
ASTState state = state();
if (!involvesTypeParameters_initialized) {
involvesTypeParameters_initialized = true;
involvesTypeParameters_value = false;
}
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
do {
involvesTypeParameters_cycle = state.nextCycle();
boolean new_involvesTypeParameters_value = involvesTypeParameters_compute();
if (involvesTypeParameters_value != new_involvesTypeParameters_value) {
state.setChangeInCycle();
}
involvesTypeParameters_value = new_involvesTypeParameters_value;
} while (state.testAndClearChangeInCycle());
involvesTypeParameters_computed = true;
state.leaveCircle();
} else if (involvesTypeParameters_cycle != state.cycle()) {
involvesTypeParameters_cycle = state.cycle();
boolean new_involvesTypeParameters_value = involvesTypeParameters_compute();
if (involvesTypeParameters_value != new_involvesTypeParameters_value) {
state.setChangeInCycle();
}
involvesTypeParameters_value = new_involvesTypeParameters_value;
} else {
}
return involvesTypeParameters_value;
}
/** @apilevel internal */
private boolean involvesTypeParameters_compute() {
for (TypeDecl arg : getParameterization().args) {
if (arg.involvesTypeParameters()) {
return true;
}
}
return false;
}
/**
* @attribute syn
* @aspect StrictSubtype
* @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:39
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="StrictSubtype", declaredAt="/home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:39")
public boolean strictSupertypeGenericClassDecl(GenericClassDecl type) {
boolean strictSupertypeGenericClassDecl_GenericClassDecl_value = type.strictSubtype(genericDecl().original());
return strictSupertypeGenericClassDecl_GenericClassDecl_value;
}
/**
* @attribute syn
* @aspect StrictSubtype
* @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:378
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="StrictSubtype", declaredAt="/home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:378")
public boolean strictSupertypeClassDecl(ClassDecl type) {
boolean strictSupertypeClassDecl_ClassDecl_value = super.strictSupertypeClassDecl(type);
return strictSupertypeClassDecl_ClassDecl_value;
}
/** @apilevel internal */
private void strictSubtype_TypeDecl_reset() {
strictSubtype_TypeDecl_values = null;
}
protected java.util.Map strictSubtype_TypeDecl_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="StrictSubtype", declaredAt="/home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:363")
public boolean strictSubtype(TypeDecl type) {
Object _parameters = type;
if (strictSubtype_TypeDecl_values == null) strictSubtype_TypeDecl_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (strictSubtype_TypeDecl_values.containsKey(_parameters)) {
Object _cache = strictSubtype_TypeDecl_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
strictSubtype_TypeDecl_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_strictSubtype_TypeDecl_value;
do {
_value.cycle = state.nextCycle();
new_strictSubtype_TypeDecl_value = type.strictSupertypeParClassDecl(this);
if (((Boolean)_value.value) != new_strictSubtype_TypeDecl_value) {
state.setChangeInCycle();
_value.value = new_strictSubtype_TypeDecl_value;
}
} while (state.testAndClearChangeInCycle());
strictSubtype_TypeDecl_values.put(_parameters, new_strictSubtype_TypeDecl_value);
state.leaveCircle();
return new_strictSubtype_TypeDecl_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_strictSubtype_TypeDecl_value = type.strictSupertypeParClassDecl(this);
if (((Boolean)_value.value) != new_strictSubtype_TypeDecl_value) {
state.setChangeInCycle();
_value.value = new_strictSubtype_TypeDecl_value;
}
return new_strictSubtype_TypeDecl_value;
} else {
return (Boolean) _value.value;
}
}
/**
* @attribute syn
* @aspect StrictSubtype
* @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:52
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="StrictSubtype", declaredAt="/home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:52")
public boolean strictSupertypeRawClassDecl(RawClassDecl type) {
boolean strictSupertypeRawClassDecl_RawClassDecl_value = type.genericDecl().original().strictSubtype(genericDecl().original());
return strictSupertypeRawClassDecl_RawClassDecl_value;
}
/**
* @attribute syn
* @aspect StrictSubtype
* @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:56
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="StrictSubtype", declaredAt="/home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:56")
public boolean strictSupertypeRawInterfaceDecl(RawInterfaceDecl type) {
boolean strictSupertypeRawInterfaceDecl_RawInterfaceDecl_value = type.genericDecl().original().strictSubtype(genericDecl().original());
return strictSupertypeRawInterfaceDecl_RawInterfaceDecl_value;
}
/**
* @attribute syn
* @aspect StrictSubtype
* @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:149
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="StrictSubtype", declaredAt="/home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:149")
public boolean strictSupertypeParClassDecl(ParClassDecl type) {
{
if (isRawType()) {
return true;
}
if (type.genericDecl().original() == genericDecl().original()) {
if (!type.getParameterization().compare(getParameterization(),
Parameterization.STRICT_CONTAINED_IN)) {
return false;
}
if (isNestedType() && type.isNestedType()) {
return type.enclosingType().strictSubtype(enclosingType());
}
return true;
}
return strictSupertypeClassDecl(type);
}
}
/**
* @attribute syn
* @aspect StrictSubtype
* @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:153
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="StrictSubtype", declaredAt="/home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:153")
public boolean strictSupertypeParInterfaceDecl(ParInterfaceDecl type) {
boolean strictSupertypeParInterfaceDecl_ParInterfaceDecl_value = false;
return strictSupertypeParInterfaceDecl_ParInterfaceDecl_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 = erasure().typeDescriptor();
if (state().inCircle()) {
typeDescriptor_computed = state().cycle();
} else {
typeDescriptor_computed = ASTState.NON_CYCLE;
}
return typeDescriptor_value;
}
/**
* @attribute syn
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:998
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:998")
public String arrayTypeDescriptor() {
String arrayTypeDescriptor_value = erasure().arrayTypeDescriptor();
return arrayTypeDescriptor_value;
}
/** @apilevel internal */
private void constantPoolName_reset() {
constantPoolName_computed = null;
constantPoolName_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle constantPoolName_computed = null;
/** @apilevel internal */
protected String constantPoolName_value;
/**
* For a top-level type the constant pool name of the type is the same as the
* canonical name but with dots replaced by solidus.
*
* For nested types the constant pool name is based on the enclosing top-level
* types constant pool name followed by a dollar sign and a unique index and/or
* the type name.
*
* @return constant pool name of this type
* @attribute syn
* @aspect ConstantPoolNames
* @declaredat /home/jesper/git/extendj/java4/backend/ConstantPoolNames.jrag:44
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ConstantPoolNames", declaredAt="/home/jesper/git/extendj/java4/backend/ConstantPoolNames.jrag:44")
public String constantPoolName() {
ASTState state = state();
if (constantPoolName_computed == ASTState.NON_CYCLE || constantPoolName_computed == state().cycle()) {
return constantPoolName_value;
}
constantPoolName_value = genericDecl().constantPoolName();
if (state().inCircle()) {
constantPoolName_computed = state().cycle();
} else {
constantPoolName_computed = ASTState.NON_CYCLE;
}
return constantPoolName_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:406
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsCodegen", declaredAt="/home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:406")
public boolean needsSignatureAttribute() {
ASTState state = state();
if (needsSignatureAttribute_computed == ASTState.NON_CYCLE || needsSignatureAttribute_computed == state().cycle()) {
return needsSignatureAttribute_value;
}
needsSignatureAttribute_value = true;
if (state().inCircle()) {
needsSignatureAttribute_computed = state().cycle();
} else {
needsSignatureAttribute_computed = ASTState.NON_CYCLE;
}
return needsSignatureAttribute_value;
}
/** @apilevel internal */
private void firstTypeArgument_reset() {
firstTypeArgument_computed = null;
firstTypeArgument_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle firstTypeArgument_computed = null;
/** @apilevel internal */
protected TypeDecl firstTypeArgument_value;
/**
* Returns the first type argument of this type, if it is parameterized, otherwise returns
* java.lang.Object.
* @attribute syn
* @aspect EnhancedFor
* @declaredat /home/jesper/git/extendj/java5/frontend/EnhancedFor.jrag:129
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="EnhancedFor", declaredAt="/home/jesper/git/extendj/java5/frontend/EnhancedFor.jrag:129")
public TypeDecl firstTypeArgument() {
ASTState state = state();
if (firstTypeArgument_computed == ASTState.NON_CYCLE || firstTypeArgument_computed == state().cycle()) {
return firstTypeArgument_value;
}
firstTypeArgument_value = getParameterization().args.get(0);
if (state().inCircle()) {
firstTypeArgument_computed = state().cycle();
} else {
firstTypeArgument_computed = ASTState.NON_CYCLE;
}
return firstTypeArgument_value;
}
/**
* @attribute syn
* @aspect Generics
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:340
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Generics", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:340")
public boolean isParameterizedType() {
boolean isParameterizedType_value = true;
return isParameterizedType_value;
}
/**
* @attribute syn
* @aspect GenericsTypeCheck
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:628
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsTypeCheck", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:628")
public boolean sameArguments(ParTypeDecl decl) {
{
if (this == decl) {
return true;
}
if (genericDecl() != decl.genericDecl()) {
return false;
}
return getParameterization().sameArguments(decl.getParameterization());
}
}
/**
* @attribute syn
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:876
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:876")
public boolean sameSignature(Access a) {
{
if (a instanceof ParTypeAccess) {
ParTypeAccess ta = (ParTypeAccess) a;
if (genericDecl() != ta.genericDecl()) {
return false;
}
Parameterization par = getParameterization();
if (par.args.size() != ta.getNumTypeArgument()) {
return false;
}
for (int i = 0; i < par.args.size(); i++) {
if (!par.args.get(i).sameSignature(ta.getTypeArgument(i))) {
return false;
}
}
return true;
} else if (a instanceof TypeAccess && ((TypeAccess) a).isRaw()) {
return false;
}
return super.sameSignature(a);
}
}
/** @apilevel internal */
private void sameSignature_java_util_List_TypeDecl__reset() {
sameSignature_java_util_List_TypeDecl__values = null;
}
protected java.util.Map sameSignature_java_util_List_TypeDecl__values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:923")
public boolean sameSignature(java.util.List list) {
Object _parameters = list;
if (sameSignature_java_util_List_TypeDecl__values == null) sameSignature_java_util_List_TypeDecl__values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (sameSignature_java_util_List_TypeDecl__values.containsKey(_parameters)) {
Object _cache = sameSignature_java_util_List_TypeDecl__values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
sameSignature_java_util_List_TypeDecl__values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_sameSignature_java_util_List_TypeDecl__value;
do {
_value.cycle = state.nextCycle();
new_sameSignature_java_util_List_TypeDecl__value = sameSignature_compute(list);
if (((Boolean)_value.value) != new_sameSignature_java_util_List_TypeDecl__value) {
state.setChangeInCycle();
_value.value = new_sameSignature_java_util_List_TypeDecl__value;
}
} while (state.testAndClearChangeInCycle());
sameSignature_java_util_List_TypeDecl__values.put(_parameters, new_sameSignature_java_util_List_TypeDecl__value);
state.leaveCircle();
return new_sameSignature_java_util_List_TypeDecl__value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_sameSignature_java_util_List_TypeDecl__value = sameSignature_compute(list);
if (((Boolean)_value.value) != new_sameSignature_java_util_List_TypeDecl__value) {
state.setChangeInCycle();
_value.value = new_sameSignature_java_util_List_TypeDecl__value;
}
return new_sameSignature_java_util_List_TypeDecl__value;
} else {
return (Boolean) _value.value;
}
}
/** @apilevel internal */
private boolean sameSignature_compute(java.util.List list) {
Parameterization par = getParameterization();
if (par.args.size() != list.size()) {
return false;
}
for (int i = 0; i < list.size(); i++) {
if (par.args.get(i) != list.get(i)) {
return false;
}
}
return true;
}
/** @apilevel internal */
protected ASTState.Cycle usesTypeVariable_cycle = null;
/** @apilevel internal */
private void usesTypeVariable_reset() {
usesTypeVariable_computed = false;
usesTypeVariable_initialized = false;
usesTypeVariable_cycle = null;
}
/** @apilevel internal */
protected boolean usesTypeVariable_computed = false;
/** @apilevel internal */
protected boolean usesTypeVariable_value;
/** @apilevel internal */
protected boolean usesTypeVariable_initialized = false;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1337")
public boolean usesTypeVariable() {
if (usesTypeVariable_computed) {
return usesTypeVariable_value;
}
ASTState state = state();
if (!usesTypeVariable_initialized) {
usesTypeVariable_initialized = true;
usesTypeVariable_value = false;
}
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
do {
usesTypeVariable_cycle = state.nextCycle();
boolean new_usesTypeVariable_value = usesTypeVariable_compute();
if (usesTypeVariable_value != new_usesTypeVariable_value) {
state.setChangeInCycle();
}
usesTypeVariable_value = new_usesTypeVariable_value;
} while (state.testAndClearChangeInCycle());
usesTypeVariable_computed = true;
state.leaveCircle();
} else if (usesTypeVariable_cycle != state.cycle()) {
usesTypeVariable_cycle = state.cycle();
boolean new_usesTypeVariable_value = usesTypeVariable_compute();
if (usesTypeVariable_value != new_usesTypeVariable_value) {
state.setChangeInCycle();
}
usesTypeVariable_value = new_usesTypeVariable_value;
} else {
}
return usesTypeVariable_value;
}
/** @apilevel internal */
private boolean usesTypeVariable_compute() {
if (super.usesTypeVariable()) {
return true;
}
for (TypeDecl argument : getParameterization().args) {
if (argument.usesTypeVariable()) {
return true;
}
}
return false;
}
/**
* @attribute syn
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1680
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1680")
public TypeDecl original() {
TypeDecl original_value = genericDecl().original();
return original_value;
}
/** @apilevel internal */
private void sourceTypeDecl_reset() {
sourceTypeDecl_computed = null;
sourceTypeDecl_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle sourceTypeDecl_computed = null;
/** @apilevel internal */
protected TypeDecl sourceTypeDecl_value;
/**
* @attribute syn
* @aspect SourceDeclarations
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1902
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="SourceDeclarations", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1902")
public TypeDecl sourceTypeDecl() {
ASTState state = state();
if (sourceTypeDecl_computed == ASTState.NON_CYCLE || sourceTypeDecl_computed == state().cycle()) {
return sourceTypeDecl_value;
}
sourceTypeDecl_value = genericDecl().original().sourceTypeDecl();
if (state().inCircle()) {
sourceTypeDecl_computed = state().cycle();
} else {
sourceTypeDecl_computed = ASTState.NON_CYCLE;
}
return sourceTypeDecl_value;
}
/** @apilevel internal */
private void fullName_reset() {
fullName_computed = null;
fullName_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle fullName_computed = null;
/** @apilevel internal */
protected String fullName_value;
/**
* @attribute syn
* @aspect TypeName
* @declaredat /home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag:84
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeName", declaredAt="/home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag:84")
public String fullName() {
ASTState state = state();
if (fullName_computed == ASTState.NON_CYCLE || fullName_computed == state().cycle()) {
return fullName_value;
}
fullName_value = fullName_compute();
if (state().inCircle()) {
fullName_computed = state().cycle();
} else {
fullName_computed = ASTState.NON_CYCLE;
}
return fullName_value;
}
/** @apilevel internal */
private String fullName_compute() {
if (isNestedType()) {
return enclosingType().fullName() + "." + nameWithArgs();
}
String packageName = packageName();
if (packageName.equals("")) {
return nameWithArgs();
}
return packageName + "." + nameWithArgs();
}
/** @apilevel internal */
private void typeName_reset() {
typeName_computed = null;
typeName_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle typeName_computed = null;
/** @apilevel internal */
protected String typeName_value;
/**
* The qualified typename of this type.
*
* Includes array suffix and type arguments.
* @attribute syn
* @aspect TypeName
* @declaredat /home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag:100
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeName", declaredAt="/home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag:100")
public String typeName() {
ASTState state = state();
if (typeName_computed == ASTState.NON_CYCLE || typeName_computed == state().cycle()) {
return typeName_value;
}
typeName_value = typeName_compute();
if (state().inCircle()) {
typeName_computed = state().cycle();
} else {
typeName_computed = ASTState.NON_CYCLE;
}
return typeName_value;
}
/** @apilevel internal */
private String typeName_compute() {
if (isNestedType()) {
return enclosingType().typeName() + "." + nameWithArgs();
}
String packageName = packageName();
if (packageName.equals("") || packageName.equals(PRIMITIVE_PACKAGE_NAME)) {
return nameWithArgs();
}
return packageName + "." + nameWithArgs();
}
/**
* @attribute syn
* @aspect GenericsParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsParTypeDecl.jrag:55
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsParTypeDecl.jrag:55")
public String nameWithArgs() {
{
java.util.List args = getParameterization().args;
StringBuilder sb = new StringBuilder();
sb.append(name());
sb.append("<");
for (int i = 0; i < args.size(); i++) {
if (i != 0) {
sb.append(", ");
}
sb.append(args.get(i).typeName());
}
sb.append(">");
return sb.toString();
}
}
/**
* @attribute syn
* @aspect TypeScopePropagation
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:541
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeScopePropagation", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupType.jrag:541")
public SimpleSet localLookupType(String name) {
{
SimpleSet result = memberTypes(name);
if (!result.isEmpty()) {
return result;
}
if (name().equals(name)) {
return genericDecl(); // Type lookups for this type resolve to the generic type.
}
result = lookupType(name);
// 8.5.2
if (isClassDecl() && isStatic() && !isTopLevelType()) {
SimpleSet newSet = emptySet();
for (TypeDecl type : result) {
newSet = newSet.add(type);
}
result = newSet;
}
return result;
}
}
/** @apilevel internal */
private void unimplementedMethods_reset() {
unimplementedMethods_computed = null;
unimplementedMethods_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle unimplementedMethods_computed = null;
/** @apilevel internal */
protected Collection unimplementedMethods_value;
/**
* @attribute syn
* @aspect Modifiers
* @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:35
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Modifiers", declaredAt="/home/jesper/git/extendj/java4/frontend/Modifiers.jrag:35")
public Collection unimplementedMethods() {
ASTState state = state();
if (unimplementedMethods_computed == ASTState.NON_CYCLE || unimplementedMethods_computed == state().cycle()) {
return unimplementedMethods_value;
}
unimplementedMethods_value = unimplementedMethods_compute();
if (state().inCircle()) {
unimplementedMethods_computed = state().cycle();
} else {
unimplementedMethods_computed = ASTState.NON_CYCLE;
}
return unimplementedMethods_value;
}
/** @apilevel internal */
private Collection unimplementedMethods_compute() {
Collection set = new HashSet();
Collection result = new HashSet();
for (MethodDecl m : genericDecl().unimplementedMethods()) {
set.add(m.sourceMethodDecl());
}
for (MethodDecl m : super.unimplementedMethods()) {
if (set.contains(m.sourceMethodDecl())) {
result.add(m);
}
}
return result;
}
/** @apilevel internal */
private void uniqueIndex_reset() {
uniqueIndex_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle uniqueIndex_computed = null;
/** @apilevel internal */
protected int uniqueIndex_value;
/**
* @attribute syn
* @aspect Java2Rewrites
* @declaredat /home/jesper/git/extendj/java4/backend/Java2Rewrites.jrag:35
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Java2Rewrites", declaredAt="/home/jesper/git/extendj/java4/backend/Java2Rewrites.jrag:35")
public int uniqueIndex() {
ASTState state = state();
if (uniqueIndex_computed == ASTState.NON_CYCLE || uniqueIndex_computed == state().cycle()) {
return uniqueIndex_value;
}
uniqueIndex_value = genericDecl().uniqueIndex();
if (state().inCircle()) {
uniqueIndex_computed = state().cycle();
} else {
uniqueIndex_computed = ASTState.NON_CYCLE;
}
return uniqueIndex_value;
}
/**
* @attribute syn
* @aspect GenericsCodegen
* @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:541
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsCodegen", declaredAt="/home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:541")
public String typeArgumentsOpt() {
{
StringBuilder buf = new StringBuilder();
buf.append("<");
for (TypeDecl argument : getParameterization().args) {
buf.append(argument.fieldTypeSignature());
}
buf.append(">");
return buf.toString();
}
}
/** @apilevel internal */
private void localMethods_reset() {
localMethods_computed = null;
localMethods_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle localMethods_computed = null;
/** @apilevel internal */
protected java.util.List localMethods_value;
/**
* Substituted local methods.
*
* Includes all non-substitutable original methods plus all substituted methods.
* @attribute syn
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1364
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1364")
public java.util.List localMethods() {
ASTState state = state();
if (localMethods_computed == ASTState.NON_CYCLE || localMethods_computed == state().cycle()) {
return localMethods_value;
}
localMethods_value = localMethods_compute();
if (state().inCircle()) {
localMethods_computed = state().cycle();
} else {
localMethods_computed = ASTState.NON_CYCLE;
}
return localMethods_value;
}
/** @apilevel internal */
private java.util.List localMethods_compute() {
ArrayList methods = new ArrayList();
for (MethodDecl m : original().localMethods()) {
if (!m.isSubstitutable()) {
methods.add(m);
}
}
for (BodyDecl decl : getBodyDeclList()) {
if (decl instanceof MethodDecl) {
methods.add((MethodDecl) decl);
}
}
return methods;
}
/** @apilevel internal */
private void localFields_String_reset() {
localFields_String_computed = null;
localFields_String_values = null;
}
/** @apilevel internal */
protected java.util.Map localFields_String_values;
/** @apilevel internal */
protected java.util.Map localFields_String_computed;
/**
* @attribute syn
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1379
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1379")
public SimpleSet localFields(String name) {
Object _parameters = name;
if (localFields_String_computed == null) localFields_String_computed = new java.util.HashMap(4);
if (localFields_String_values == null) localFields_String_values = new java.util.HashMap(4);
ASTState state = state();
if (localFields_String_values.containsKey(_parameters)
&& localFields_String_computed.containsKey(_parameters)
&& (localFields_String_computed.get(_parameters) == ASTState.NON_CYCLE || localFields_String_computed.get(_parameters) == state().cycle())) {
return (SimpleSet) localFields_String_values.get(_parameters);
}
SimpleSet localFields_String_value = localFields_compute(name);
if (state().inCircle()) {
localFields_String_values.put(_parameters, localFields_String_value);
localFields_String_computed.put(_parameters, state().cycle());
} else {
localFields_String_values.put(_parameters, localFields_String_value);
localFields_String_computed.put(_parameters, ASTState.NON_CYCLE);
}
return localFields_String_value;
}
/** @apilevel internal */
private SimpleSet localFields_compute(String name) {
SimpleSet set = emptySet();
for (Variable field : original().localFields(name)) {
if (field.name().equals(name)
&& field.fieldDecl() != null && !field.fieldDecl().isSubstitutable()) {
set = set.add(field);
}
}
for (BodyDecl decl : getBodyDeclList()) {
if (decl instanceof FieldDecl) {
FieldDecl field = (FieldDecl) decl;
for (FieldDeclarator f : field.getDeclaratorList()) {
if (f.name().equals(name)) {
set = set.add(f);
}
}
}
}
return set;
}
/** @apilevel internal */
private void localTypeDecls_String_reset() {
localTypeDecls_String_values = null;
}
protected java.util.Map localTypeDecls_String_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1410")
public SimpleSet localTypeDecls(String name) {
Object _parameters = name;
if (localTypeDecls_String_values == null) localTypeDecls_String_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (localTypeDecls_String_values.containsKey(_parameters)) {
Object _cache = localTypeDecls_String_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (SimpleSet) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
localTypeDecls_String_values.put(_parameters, _value);
_value.value = emptySet();
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
SimpleSet new_localTypeDecls_String_value;
do {
_value.cycle = state.nextCycle();
new_localTypeDecls_String_value = localTypeDecls_compute(name);
if (!AttributeValue.equals(((SimpleSet)_value.value), new_localTypeDecls_String_value)) {
state.setChangeInCycle();
_value.value = new_localTypeDecls_String_value;
}
} while (state.testAndClearChangeInCycle());
localTypeDecls_String_values.put(_parameters, new_localTypeDecls_String_value);
state.leaveCircle();
return new_localTypeDecls_String_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
SimpleSet new_localTypeDecls_String_value = localTypeDecls_compute(name);
if (!AttributeValue.equals(((SimpleSet)_value.value), new_localTypeDecls_String_value)) {
state.setChangeInCycle();
_value.value = new_localTypeDecls_String_value;
}
return new_localTypeDecls_String_value;
} else {
return (SimpleSet) _value.value;
}
}
/** @apilevel internal */
private SimpleSet localTypeDecls_compute(String name) {
SimpleSet set = emptySet();
for (TypeDecl type : original().localTypeDecls(name)) {
if (type.isStatic()) {
set = set.add(type);
}
}
for (BodyDecl decl : getBodyDeclList()) {
if (decl instanceof MemberClassDecl) {
ClassDecl typeDecl = ((MemberClassDecl) decl).getClassDecl();
if (typeDecl.name().equals(name)) {
set = set.add(typeDecl);
}
}
}
return set;
}
/**
* @attribute inh
* @aspect GenericsParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsParTypeDecl.jrag:74
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH)
@ASTNodeAnnotation.Source(aspect="GenericsParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericsParTypeDecl.jrag:74")
public TypeDecl genericDecl() {
ASTState state = state();
if (genericDecl_computed == ASTState.NON_CYCLE || genericDecl_computed == state().cycle()) {
return genericDecl_value;
}
genericDecl_value = getParent().Define_genericDecl(this, null);
if (state().inCircle()) {
genericDecl_computed = state().cycle();
} else {
genericDecl_computed = ASTState.NON_CYCLE;
}
return genericDecl_value;
}
/** @apilevel internal */
private void genericDecl_reset() {
genericDecl_computed = null;
genericDecl_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle genericDecl_computed = null;
/** @apilevel internal */
protected TypeDecl genericDecl_value;
/**
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsParTypeDecl.jrag:74
* @apilevel internal
*/
public TypeDecl Define_genericDecl(ASTNode _callerNode, ASTNode _childNode) {
if (_callerNode == getBodyDeclListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java5/frontend/GenericsParTypeDecl.jrag:82
int index = _callerNode.getIndexOfChild(_childNode);
{
if (getBodyDecl(index) instanceof MemberTypeDecl) {
MemberTypeDecl m = (MemberTypeDecl) getBodyDecl(index);
return extractSingleType(genericDecl().memberTypes(m.typeDecl().name()));
}
return genericDecl();
}
}
else {
return getParent().Define_genericDecl(this, _callerNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericsParTypeDecl.jrag:74
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute genericDecl
*/
protected boolean canDefine_genericDecl(ASTNode _callerNode, ASTNode _childNode) {
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 == getBodyDeclListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:999
int childIndex = _callerNode.getIndexOfChild(_childNode);
{
TypeDecl paramType = getParameterization().substitute(name);
if (paramType != null) {
return paramType;
}
return localLookupType(name);
}
}
else {
int childIndex = this.getIndexOfChild(_callerNode);
{
TypeDecl paramType = getParameterization().substitute(name);
if (paramType != null) {
return paramType;
}
return lookupType(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;
}
/** @apilevel internal */
public ASTNode rewriteTo() {
return super.rewriteTo();
}
/** @apilevel internal */
public boolean canRewrite() {
return false;
}
}