org.extendj.ast.WildcardSuper 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;
/**
* @ast node
* @declaredat /home/jesper/git/extendj/java5/grammar/Generics.ast:68
* @astdecl WildcardSuper : AbstractWildcard ::= Access;
* @production WildcardSuper : {@link AbstractWildcard} ::= {@link Access};
*/
public class WildcardSuper extends AbstractWildcard implements Cloneable {
/**
* @aspect Java5PrettyPrint
* @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrint.jadd:380
*/
public void prettyPrint(PrettyPrinter out) {
out.print("? super ");
out.print(getAccess());
}
/**
* @aspect PrettyPrintUtil5
* @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrintUtil.jrag:133
*/
@Override public String toString() {
return String.format("? super %s", getAccessNoTransform().toString());
}
/**
* @declaredat ASTNode:1
*/
public WildcardSuper() {
super();
}
/**
* Initializes the child array to the correct size.
* Initializes List and Opt nta children.
* @apilevel internal
* @ast method
* @declaredat ASTNode:10
*/
public void init$Children() {
children = new ASTNode[1];
}
/**
* @declaredat ASTNode:13
*/
@ASTNodeAnnotation.Constructor(
name = {"Access"},
type = {"Access"},
kind = {"Child"}
)
public WildcardSuper(Access p0) {
setChild(p0, 0);
}
/** @apilevel low-level
* @declaredat ASTNode:22
*/
protected int numChildren() {
return 1;
}
/**
* @apilevel internal
* @declaredat ASTNode:28
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:32
*/
public void flushAttrCache() {
super.flushAttrCache();
type_reset();
}
/** @apilevel internal
* @declaredat ASTNode:37
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:41
*/
public WildcardSuper clone() throws CloneNotSupportedException {
WildcardSuper node = (WildcardSuper) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:46
*/
public WildcardSuper copy() {
try {
WildcardSuper node = (WildcardSuper) 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:65
*/
@Deprecated
public WildcardSuper 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:75
*/
public WildcardSuper treeCopyNoTransform() {
WildcardSuper tree = (WildcardSuper) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
ASTNode child = (ASTNode) children[i];
if (child != null) {
child = child.treeCopyNoTransform();
tree.setChild(child, i);
}
}
}
return tree;
}
/**
* Create a deep copy of the AST subtree at this node.
* The subtree of this node is traversed to trigger rewrites before copy.
* The copy is dangling, i.e. has no parent.
* @return dangling copy of the subtree at this node
* @apilevel low-level
* @declaredat ASTNode:95
*/
public WildcardSuper treeCopy() {
WildcardSuper tree = (WildcardSuper) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
ASTNode child = (ASTNode) getChild(i);
if (child != null) {
child = child.treeCopy();
tree.setChild(child, i);
}
}
}
return tree;
}
/** @apilevel internal
* @declaredat ASTNode:109
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node);
}
/**
* Replaces the Access child.
* @param node The new node to replace the Access child.
* @apilevel high-level
*/
public void setAccess(Access node) {
setChild(node, 0);
}
/**
* Retrieves the Access child.
* @return The current node used as the Access child.
* @apilevel high-level
*/
@ASTNodeAnnotation.Child(name="Access")
public Access getAccess() {
return (Access) getChild(0);
}
/**
* Retrieves the Access child.
* This method does not invoke AST transformations.
* @return The current node used as the Access child.
* @apilevel low-level
*/
public Access getAccessNoTransform() {
return (Access) getChildNoTransform(0);
}
/** @apilevel internal */
private void type_reset() {
type_computed = null;
type_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle type_computed = null;
/** @apilevel internal */
protected TypeDecl type_value;
/**
* @attribute syn
* @aspect TypeAnalysis
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:295
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeAnalysis", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:295")
public TypeDecl type() {
ASTState state = state();
if (type_computed == ASTState.NON_CYCLE || type_computed == state().cycle()) {
return type_value;
}
type_value = lookupWildcardSuper(getAccess().type());
if (state().inCircle()) {
type_computed = state().cycle();
} else {
type_computed = ASTState.NON_CYCLE;
}
return type_value;
}
/**
* @attribute syn
* @aspect LambdaParametersInference
* @declaredat /home/jesper/git/extendj/java8/frontend/TypeCheck.jrag:624
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="LambdaParametersInference", declaredAt="/home/jesper/git/extendj/java8/frontend/TypeCheck.jrag:624")
public boolean mentionsTypeVariable(TypeVariable var) {
boolean mentionsTypeVariable_TypeVariable_value = getAccess().mentionsTypeVariable(var);
return mentionsTypeVariable_TypeVariable_value;
}
/**
* @attribute inh
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1755
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1755")
public TypeDecl lookupWildcardSuper(TypeDecl typeDecl) {
TypeDecl lookupWildcardSuper_TypeDecl_value = getParent().Define_lookupWildcardSuper(this, null, typeDecl);
return lookupWildcardSuper_TypeDecl_value;
}
/** @apilevel internal */
public ASTNode rewriteTo() {
return super.rewriteTo();
}
/** @apilevel internal */
public boolean canRewrite() {
return false;
}
}