org.extendj.ast.MemberInterfaceDecl 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/java4/grammar/Java.ast:190
* @astdecl MemberInterfaceDecl : MemberTypeDecl ::= InterfaceDecl;
* @production MemberInterfaceDecl : {@link MemberTypeDecl} ::= {@link InterfaceDecl};
*/
public class MemberInterfaceDecl extends MemberTypeDecl implements Cloneable {
/**
* @aspect Java4PrettyPrint
* @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:457
*/
public void prettyPrint(PrettyPrinter out) {
out.print(getInterfaceDecl());
}
/**
* @declaredat ASTNode:1
*/
public MemberInterfaceDecl() {
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 = {"InterfaceDecl"},
type = {"InterfaceDecl"},
kind = {"Child"}
)
public MemberInterfaceDecl(InterfaceDecl 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();
}
/** @apilevel internal
* @declaredat ASTNode:36
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:40
*/
public MemberInterfaceDecl clone() throws CloneNotSupportedException {
MemberInterfaceDecl node = (MemberInterfaceDecl) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:45
*/
public MemberInterfaceDecl copy() {
try {
MemberInterfaceDecl node = (MemberInterfaceDecl) 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:64
*/
@Deprecated
public MemberInterfaceDecl 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:74
*/
public MemberInterfaceDecl treeCopyNoTransform() {
MemberInterfaceDecl tree = (MemberInterfaceDecl) 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:94
*/
public MemberInterfaceDecl treeCopy() {
MemberInterfaceDecl tree = (MemberInterfaceDecl) 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:108
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node);
}
/**
* Replaces the InterfaceDecl child.
* @param node The new node to replace the InterfaceDecl child.
* @apilevel high-level
*/
public void setInterfaceDecl(InterfaceDecl node) {
setChild(node, 0);
}
/**
* Retrieves the InterfaceDecl child.
* @return The current node used as the InterfaceDecl child.
* @apilevel high-level
*/
@ASTNodeAnnotation.Child(name="InterfaceDecl")
public InterfaceDecl getInterfaceDecl() {
return (InterfaceDecl) getChild(0);
}
/**
* Retrieves the InterfaceDecl child.
* This method does not invoke AST transformations.
* @return The current node used as the InterfaceDecl child.
* @apilevel low-level
*/
public InterfaceDecl getInterfaceDeclNoTransform() {
return (InterfaceDecl) getChildNoTransform(0);
}
/**
* @attribute syn
* @aspect TypeScopePropagation
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:658
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeScopePropagation", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupType.jrag:658")
public TypeDecl typeDecl() {
TypeDecl typeDecl_value = getInterfaceDecl();
return typeDecl_value;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:588
* @apilevel internal
*/
public boolean Define_isMemberType(ASTNode _callerNode, ASTNode _childNode) {
if (getInterfaceDeclNoTransform() != null && _callerNode == getInterfaceDecl()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:590
return true;
}
else {
return getParent().Define_isMemberType(this, _callerNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:588
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute isMemberType
*/
protected boolean canDefine_isMemberType(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/** @apilevel internal */
public ASTNode rewriteTo() {
return super.rewriteTo();
}
/** @apilevel internal */
public boolean canRewrite() {
return false;
}
/** @apilevel internal */
protected void collect_contributors_CompilationUnit_problems(CompilationUnit _root, java.util.Map> _map) {
// @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:222
if (hostType().isInnerClass()) {
{
java.util.Set contributors = _map.get(_root);
if (contributors == null) {
contributors = new java.util.LinkedHashSet();
_map.put((ASTNode) _root, contributors);
}
contributors.add(this);
}
}
super.collect_contributors_CompilationUnit_problems(_root, _map);
}
/** @apilevel internal */
protected void contributeTo_CompilationUnit_problems(LinkedList collection) {
super.contributeTo_CompilationUnit_problems(collection);
if (hostType().isInnerClass()) {
collection.add(error("*** Inner classes may not declare member interfaces"));
}
}
}