org.extendj.ast.GenericConstructorDecl Maven / Gradle / Ivy
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.3.0 */
package org.extendj.ast;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.ArrayList;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.zip.*;
import java.io.*;
import org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import org.jastadd.util.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.util.Set;
import beaver.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
/**
* @ast node
* @declaredat /home/jesper/git/extendj/java5/grammar/GenericMethods.ast:2
* @astdecl GenericConstructorDecl : ConstructorDecl ::= TypeParameter:TypeVariable*;
* @production GenericConstructorDecl : {@link ConstructorDecl} ::= TypeParameter:{@link TypeVariable}*;
*/
public class GenericConstructorDecl extends ConstructorDecl implements Cloneable {
/**
* @aspect Java5PrettyPrint
* @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrint.jadd:191
*/
public void prettyPrint(PrettyPrinter out) {
if (!isImplicitConstructor()) {
if (hasDocComment()) {
out.print(docComment());
}
if (!out.isNewLine()) {
out.println();
}
out.print(getModifiers());
out.print("<");
out.join(getTypeParameterList(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.print(", ");
}
});
out.print("> ");
out.print(getID());
out.print("(");
out.join(getParameterList(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.print(", ");
}
});
out.print(")");
if (hasExceptions()) {
out.print(" throws ");
out.join(getExceptionList(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.print(", ");
}
});
}
out.print(" {");
out.println();
out.indent(1);
out.print(getParsedConstructorInvocation());
if (!out.isNewLine()) {
out.println();
}
out.println();
out.indent(1);
out.join(blockStmts(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.println();
}
});
if (!out.isNewLine()) {
out.println();
}
out.print("}");
}
}
/**
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1460
*/
public BodyDecl signatureCopy() {
return new GenericConstructorDeclSubstituted(
getModifiers().treeCopyNoTransform(),
getID(),
getParameterList().treeCopyNoTransform(),
getExceptionList().treeCopyNoTransform(),
new Opt(),
new Block(),
getTypeParameterList().treeCopyNoTransform(),
this);
}
/**
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1557
*/
public BodyDecl erasedCopy() {
return new GenericConstructorDeclErased(
getModifiers().treeCopyNoTransform(),
getID(),
erasedParameterList(getParameterList()),
erasedAccessList(getExceptionList()),
new Opt(),
new Block(),
getTypeParameterList().treeCopyNoTransform(),
this);
}
/**
* @aspect GenericMethods
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:109
*/
public ParConstructorDecl newParConstructorDecl(
Collection typeArguments) {
Parameterization parameterization = new Parameterization(getTypeParameterList(),
typeArguments);
ParConstructorDecl constructorDecl = typeArguments.isEmpty()
? new RawConstructorDecl()
: new ParConstructorDecl();
// Adding a link to GenericConstructorDecl to be used during substitution
// instead of the not yet existing parent link.
constructorDecl.setGenericConstructorDecl(genericDecl());
List list = new List();
if (typeArguments.isEmpty()) {
GenericConstructorDecl original = genericDecl();
for (int i = 0; i < original.getNumTypeParameter(); i++) {
list.add(original.getTypeParameter(i).erasure().createBoundAccess());
}
} else {
for (TypeDecl arg : typeArguments) {
list.add(arg.createBoundAccess());
}
}
constructorDecl.setTypeArgumentList(list);
constructorDecl.setModifiers(getModifiers().treeCopy());
constructorDecl.setID(getID());
constructorDecl.setParameterList(getParameterList().treeCopy());
constructorDecl.setExceptionList(getExceptionList().treeCopy());
constructorDecl.setTypeParameterList(getTypeParameterList().treeCopy());
constructorDecl.setParameterization(parameterization);
return constructorDecl;
}
/**
* @declaredat ASTNode:1
*/
public GenericConstructorDecl() {
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 List(), 2);
setChild(new Opt(), 3);
setChild(new List(), 5);
}
/**
* @declaredat ASTNode:17
*/
@ASTNodeAnnotation.Constructor(
name = {"Modifiers", "ID", "Parameter", "Exception", "ParsedConstructorInvocation", "Block", "TypeParameter"},
type = {"Modifiers", "String", "List", "List", "Opt", "Block", "List"},
kind = {"Child", "Token", "List", "List", "Opt", "Child", "List"}
)
public GenericConstructorDecl(Modifiers p0, String p1, List p2, List p3, Opt p4, Block p5, List p6) {
setChild(p0, 0);
setID(p1);
setChild(p2, 1);
setChild(p3, 2);
setChild(p4, 3);
setChild(p5, 4);
setChild(p6, 5);
}
/**
* @declaredat ASTNode:31
*/
public GenericConstructorDecl(Modifiers p0, beaver.Symbol p1, List p2, List p3, Opt p4, Block p5, List p6) {
setChild(p0, 0);
setID(p1);
setChild(p2, 1);
setChild(p3, 2);
setChild(p4, 3);
setChild(p5, 4);
setChild(p6, 5);
}
/** @apilevel low-level
* @declaredat ASTNode:41
*/
protected int numChildren() {
return 6;
}
/**
* @apilevel internal
* @declaredat ASTNode:47
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:51
*/
public void flushAttrCache() {
super.flushAttrCache();
lookupParConstructorDecl_Collection_TypeDecl__reset();
}
/** @apilevel internal
* @declaredat ASTNode:56
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:60
*/
public GenericConstructorDecl clone() throws CloneNotSupportedException {
GenericConstructorDecl node = (GenericConstructorDecl) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:65
*/
public GenericConstructorDecl copy() {
try {
GenericConstructorDecl node = (GenericConstructorDecl) 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:84
*/
@Deprecated
public GenericConstructorDecl 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:94
*/
public GenericConstructorDecl treeCopyNoTransform() {
GenericConstructorDecl tree = (GenericConstructorDecl) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
switch (i) {
case 6:
tree.children[i] = null;
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:119
*/
public GenericConstructorDecl treeCopy() {
GenericConstructorDecl tree = (GenericConstructorDecl) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
switch (i) {
case 6:
tree.children[i] = null;
continue;
}
ASTNode child = (ASTNode) getChild(i);
if (child != null) {
child = child.treeCopy();
tree.setChild(child, i);
}
}
}
return tree;
}
/** @apilevel internal
* @declaredat ASTNode:138
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node) && (tokenString_ID == ((GenericConstructorDecl) node).tokenString_ID);
}
/**
* Replaces the Modifiers child.
* @param node The new node to replace the Modifiers child.
* @apilevel high-level
*/
public void setModifiers(Modifiers node) {
setChild(node, 0);
}
/**
* Retrieves the Modifiers child.
* @return The current node used as the Modifiers child.
* @apilevel high-level
*/
@ASTNodeAnnotation.Child(name="Modifiers")
public Modifiers getModifiers() {
return (Modifiers) getChild(0);
}
/**
* Retrieves the Modifiers child.
* This method does not invoke AST transformations.
* @return The current node used as the Modifiers child.
* @apilevel low-level
*/
public Modifiers getModifiersNoTransform() {
return (Modifiers) getChildNoTransform(0);
}
/**
* Replaces the lexeme ID.
* @param value The new value for the lexeme ID.
* @apilevel high-level
*/
public void setID(String value) {
tokenString_ID = value;
}
/**
* JastAdd-internal setter for lexeme ID using the Beaver parser.
* @param symbol Symbol containing the new value for the lexeme ID
* @apilevel internal
*/
public void setID(beaver.Symbol symbol) {
if (symbol.value != null && !(symbol.value instanceof String))
throw new UnsupportedOperationException("setID is only valid for String lexemes");
tokenString_ID = (String)symbol.value;
IDstart = symbol.getStart();
IDend = symbol.getEnd();
}
/**
* Retrieves the value for the lexeme ID.
* @return The value for the lexeme ID.
* @apilevel high-level
*/
@ASTNodeAnnotation.Token(name="ID")
public String getID() {
return tokenString_ID != null ? tokenString_ID : "";
}
/**
* Replaces the Parameter list.
* @param list The new list node to be used as the Parameter list.
* @apilevel high-level
*/
public void setParameterList(List list) {
setChild(list, 1);
}
/**
* Retrieves the number of children in the Parameter list.
* @return Number of children in the Parameter list.
* @apilevel high-level
*/
public int getNumParameter() {
return getParameterList().getNumChild();
}
/**
* Retrieves the number of children in the Parameter list.
* Calling this method will not trigger rewrites.
* @return Number of children in the Parameter list.
* @apilevel low-level
*/
public int getNumParameterNoTransform() {
return getParameterListNoTransform().getNumChildNoTransform();
}
/**
* Retrieves the element at index {@code i} in the Parameter list.
* @param i Index of the element to return.
* @return The element at position {@code i} in the Parameter list.
* @apilevel high-level
*/
public ParameterDeclaration getParameter(int i) {
return (ParameterDeclaration) getParameterList().getChild(i);
}
/**
* Check whether the Parameter list has any children.
* @return {@code true} if it has at least one child, {@code false} otherwise.
* @apilevel high-level
*/
public boolean hasParameter() {
return getParameterList().getNumChild() != 0;
}
/**
* Append an element to the Parameter list.
* @param node The element to append to the Parameter list.
* @apilevel high-level
*/
public void addParameter(ParameterDeclaration node) {
List list = (parent == null) ? getParameterListNoTransform() : getParameterList();
list.addChild(node);
}
/** @apilevel low-level
*/
public void addParameterNoTransform(ParameterDeclaration node) {
List list = getParameterListNoTransform();
list.addChild(node);
}
/**
* Replaces the Parameter 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 setParameter(ParameterDeclaration node, int i) {
List list = getParameterList();
list.setChild(node, i);
}
/**
* Retrieves the Parameter list.
* @return The node representing the Parameter list.
* @apilevel high-level
*/
@ASTNodeAnnotation.ListChild(name="Parameter")
public List getParameterList() {
List list = (List) getChild(1);
return list;
}
/**
* Retrieves the Parameter list.
* This method does not invoke AST transformations.
* @return The node representing the Parameter list.
* @apilevel low-level
*/
public List getParameterListNoTransform() {
return (List) getChildNoTransform(1);
}
/**
* @return the element at index {@code i} in the Parameter list without
* triggering rewrites.
*/
public ParameterDeclaration getParameterNoTransform(int i) {
return (ParameterDeclaration) getParameterListNoTransform().getChildNoTransform(i);
}
/**
* Retrieves the Parameter list.
* @return The node representing the Parameter list.
* @apilevel high-level
*/
public List getParameters() {
return getParameterList();
}
/**
* Retrieves the Parameter list.
* This method does not invoke AST transformations.
* @return The node representing the Parameter list.
* @apilevel low-level
*/
public List getParametersNoTransform() {
return getParameterListNoTransform();
}
/**
* Replaces the Exception list.
* @param list The new list node to be used as the Exception list.
* @apilevel high-level
*/
public void setExceptionList(List list) {
setChild(list, 2);
}
/**
* Retrieves the number of children in the Exception list.
* @return Number of children in the Exception list.
* @apilevel high-level
*/
public int getNumException() {
return getExceptionList().getNumChild();
}
/**
* Retrieves the number of children in the Exception list.
* Calling this method will not trigger rewrites.
* @return Number of children in the Exception list.
* @apilevel low-level
*/
public int getNumExceptionNoTransform() {
return getExceptionListNoTransform().getNumChildNoTransform();
}
/**
* Retrieves the element at index {@code i} in the Exception list.
* @param i Index of the element to return.
* @return The element at position {@code i} in the Exception list.
* @apilevel high-level
*/
public Access getException(int i) {
return (Access) getExceptionList().getChild(i);
}
/**
* Check whether the Exception list has any children.
* @return {@code true} if it has at least one child, {@code false} otherwise.
* @apilevel high-level
*/
public boolean hasException() {
return getExceptionList().getNumChild() != 0;
}
/**
* Append an element to the Exception list.
* @param node The element to append to the Exception list.
* @apilevel high-level
*/
public void addException(Access node) {
List list = (parent == null) ? getExceptionListNoTransform() : getExceptionList();
list.addChild(node);
}
/** @apilevel low-level
*/
public void addExceptionNoTransform(Access node) {
List list = getExceptionListNoTransform();
list.addChild(node);
}
/**
* Replaces the Exception 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 setException(Access node, int i) {
List list = getExceptionList();
list.setChild(node, i);
}
/**
* Retrieves the Exception list.
* @return The node representing the Exception list.
* @apilevel high-level
*/
@ASTNodeAnnotation.ListChild(name="Exception")
public List getExceptionList() {
List list = (List) getChild(2);
return list;
}
/**
* Retrieves the Exception list.
* This method does not invoke AST transformations.
* @return The node representing the Exception list.
* @apilevel low-level
*/
public List getExceptionListNoTransform() {
return (List) getChildNoTransform(2);
}
/**
* @return the element at index {@code i} in the Exception list without
* triggering rewrites.
*/
public Access getExceptionNoTransform(int i) {
return (Access) getExceptionListNoTransform().getChildNoTransform(i);
}
/**
* Retrieves the Exception list.
* @return The node representing the Exception list.
* @apilevel high-level
*/
public List getExceptions() {
return getExceptionList();
}
/**
* Retrieves the Exception list.
* This method does not invoke AST transformations.
* @return The node representing the Exception list.
* @apilevel low-level
*/
public List getExceptionsNoTransform() {
return getExceptionListNoTransform();
}
/**
* Replaces the optional node for the ParsedConstructorInvocation child. This is the Opt
* node containing the child ParsedConstructorInvocation, not the actual child!
* @param opt The new node to be used as the optional node for the ParsedConstructorInvocation child.
* @apilevel low-level
*/
public void setParsedConstructorInvocationOpt(Opt opt) {
setChild(opt, 3);
}
/**
* Replaces the (optional) ParsedConstructorInvocation child.
* @param node The new node to be used as the ParsedConstructorInvocation child.
* @apilevel high-level
*/
public void setParsedConstructorInvocation(Stmt node) {
getParsedConstructorInvocationOpt().setChild(node, 0);
}
/**
* Check whether the optional ParsedConstructorInvocation child exists.
* @return {@code true} if the optional ParsedConstructorInvocation child exists, {@code false} if it does not.
* @apilevel high-level
*/
public boolean hasParsedConstructorInvocation() {
return getParsedConstructorInvocationOpt().getNumChild() != 0;
}
/**
* Retrieves the (optional) ParsedConstructorInvocation child.
* @return The ParsedConstructorInvocation child, if it exists. Returns {@code null} otherwise.
* @apilevel low-level
*/
public Stmt getParsedConstructorInvocation() {
return (Stmt) getParsedConstructorInvocationOpt().getChild(0);
}
/**
* Retrieves the optional node for the ParsedConstructorInvocation child. This is the Opt
node containing the child ParsedConstructorInvocation, not the actual child!
* @return The optional node for child the ParsedConstructorInvocation child.
* @apilevel low-level
*/
@ASTNodeAnnotation.OptChild(name="ParsedConstructorInvocation")
public Opt getParsedConstructorInvocationOpt() {
return (Opt) getChild(3);
}
/**
* Retrieves the optional node for child ParsedConstructorInvocation. This is the Opt
node containing the child ParsedConstructorInvocation, not the actual child!
* This method does not invoke AST transformations.
* @return The optional node for child ParsedConstructorInvocation.
* @apilevel low-level
*/
public Opt getParsedConstructorInvocationOptNoTransform() {
return (Opt) getChildNoTransform(3);
}
/**
* Replaces the Block child.
* @param node The new node to replace the Block child.
* @apilevel high-level
*/
public void setBlock(Block node) {
setChild(node, 4);
}
/**
* Retrieves the Block child.
* @return The current node used as the Block child.
* @apilevel high-level
*/
@ASTNodeAnnotation.Child(name="Block")
public Block getBlock() {
return (Block) getChild(4);
}
/**
* Retrieves the Block child.
* This method does not invoke AST transformations.
* @return The current node used as the Block child.
* @apilevel low-level
*/
public Block getBlockNoTransform() {
return (Block) getChildNoTransform(4);
}
/**
* 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, 5);
}
/**
* 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(5);
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(5);
}
/**
* @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();
}
/**
* Retrieves the ImplicitConstructorInvocation child.
* This method does not invoke AST transformations.
* @return The current node used as the ImplicitConstructorInvocation child.
* @apilevel low-level
*/
public Stmt getImplicitConstructorInvocationNoTransform() {
return (Stmt) getChildNoTransform(6);
}
/**
* Retrieves the child position of the optional child ImplicitConstructorInvocation.
* @return The the child position of the optional child ImplicitConstructorInvocation.
* @apilevel low-level
*/
protected int getImplicitConstructorInvocationChildPosition() {
return 6;
}
/**
* @attribute syn
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1447
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1447")
public GenericConstructorDecl original() {
GenericConstructorDecl original_value = this;
return original_value;
}
/**
* @return {@code true} if this is a generic method or constructor, or a
* substitued generic method or constructor.
* @attribute syn
* @aspect MethodSignature15
* @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:320
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="MethodSignature15", declaredAt="/home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:320")
public boolean isGeneric() {
boolean isGeneric_value = true;
return isGeneric_value;
}
/**
* Note: isGeneric must be called first to check if this declaration is generic.
* Otherwise this attribute will throw an error!
* @return original generic declaration of this constructor.
* @attribute syn
* @aspect MethodSignature15
* @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:342
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="MethodSignature15", declaredAt="/home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:342")
public GenericConstructorDecl genericDecl() {
GenericConstructorDecl genericDecl_value = this;
return genericDecl_value;
}
/**
* Note: isGeneric must be called first to check if this declaration is generic.
* Otherwise this attribute will throw an error!
* @return type parameters for this declaration.
* @attribute syn
* @aspect MethodSignature15
* @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:355
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="MethodSignature15", declaredAt="/home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:355")
public List typeParameters() {
List typeParameters_value = getTypeParameterList();
return typeParameters_value;
}
/** @apilevel internal */
private void lookupParConstructorDecl_Collection_TypeDecl__reset() {
lookupParConstructorDecl_Collection_TypeDecl__values = null;
lookupParConstructorDecl_Collection_TypeDecl__proxy = null;
}
/** @apilevel internal */
protected ASTNode lookupParConstructorDecl_Collection_TypeDecl__proxy;
/** @apilevel internal */
protected java.util.Map lookupParConstructorDecl_Collection_TypeDecl__values;
/**
* @attribute syn
* @aspect GenericMethods
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:101
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isNTA=true)
@ASTNodeAnnotation.Source(aspect="GenericMethods", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:101")
public ParConstructorDecl lookupParConstructorDecl(Collection typeArguments) {
Object _parameters = typeArguments;
if (lookupParConstructorDecl_Collection_TypeDecl__values == null) lookupParConstructorDecl_Collection_TypeDecl__values = new java.util.HashMap(4);
ASTState state = state();
if (lookupParConstructorDecl_Collection_TypeDecl__values.containsKey(_parameters)) {
return (ParConstructorDecl) lookupParConstructorDecl_Collection_TypeDecl__values.get(_parameters);
}
state().enterLazyAttribute();
ParConstructorDecl lookupParConstructorDecl_Collection_TypeDecl__value = newParConstructorDecl(typeArguments);
if (lookupParConstructorDecl_Collection_TypeDecl__proxy == null) {
lookupParConstructorDecl_Collection_TypeDecl__proxy = new ASTNode();
lookupParConstructorDecl_Collection_TypeDecl__proxy.setParent(this);
}
if (lookupParConstructorDecl_Collection_TypeDecl__value != null) {
lookupParConstructorDecl_Collection_TypeDecl__value.setParent(lookupParConstructorDecl_Collection_TypeDecl__proxy);
if (lookupParConstructorDecl_Collection_TypeDecl__value.mayHaveRewrite()) {
lookupParConstructorDecl_Collection_TypeDecl__value = (ParConstructorDecl) lookupParConstructorDecl_Collection_TypeDecl__value.rewrittenNode();
lookupParConstructorDecl_Collection_TypeDecl__value.setParent(lookupParConstructorDecl_Collection_TypeDecl__proxy);
}
}
lookupParConstructorDecl_Collection_TypeDecl__values.put(_parameters, lookupParConstructorDecl_Collection_TypeDecl__value);
state().leaveLazyAttribute();
return lookupParConstructorDecl_Collection_TypeDecl__value;
}
/**
* @attribute syn
* @aspect GenericMethodsNameAnalysis
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:233
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericMethodsNameAnalysis", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:233")
public SimpleSet localLookupType(String name) {
{
for (int i = 0; i < getNumTypeParameter(); i++) {
if (original().getTypeParameter(i).name().equals(name)) {
return original().getTypeParameter(i);
}
}
return emptySet();
}
}
/**
* @attribute syn
* @aspect GenericsCodegen
* @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:433
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsCodegen", declaredAt="/home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:433")
public boolean needsSignatureAttribute() {
boolean needsSignatureAttribute_value = true;
return needsSignatureAttribute_value;
}
/**
* @attribute inh
* @aspect GenericMethodsNameAnalysis
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:231
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH)
@ASTNodeAnnotation.Source(aspect="GenericMethodsNameAnalysis", declaredAt="/home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:231")
public SimpleSet lookupType(String name) {
SimpleSet lookupType_String_value = getParent().Define_lookupType(this, null, name);
return lookupType_String_value;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36
* @apilevel internal
*/
public NameType Define_nameType(ASTNode _callerNode, ASTNode _childNode) {
if (_callerNode == getTypeParameterListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:229
int childIndex = _callerNode.getIndexOfChild(_childNode);
return NameType.TYPE_NAME;
}
else {
return super.Define_nameType(_callerNode, _childNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute nameType
*/
protected boolean canDefine_nameType(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:231
* @apilevel internal
*/
public SimpleSet Define_lookupType(ASTNode _callerNode, ASTNode _childNode, String name) {
int childIndex = this.getIndexOfChild(_callerNode);
return localLookupType(name).isEmpty() ? lookupType(name) : localLookupType(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;
}
}