org.extendj.ast.ClassDecl 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 java.io.BufferedInputStream;
import java.io.DataInputStream;
import org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.jastadd.util.*;
import java.io.File;
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;
/**
* @ast node
* @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:154
* @astdecl ClassDecl : ReferenceType ::= Modifiers [SuperClass:Access] Implements:Access* BodyDecl* [ImplicitConstructor:ConstructorDecl];
* @production ClassDecl : {@link ReferenceType} ::= {@link Modifiers} <ID:String> [SuperClass:{@link Access}] Implements:{@link Access}* {@link BodyDecl}* [ImplicitConstructor:{@link ConstructorDecl}];
*/
public class ClassDecl extends ReferenceType implements Cloneable {
/**
* @aspect Java4PrettyPrint
* @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:147
*/
public void prettyPrint(PrettyPrinter out) {
if (hasDocComment()) {
out.print(docComment());
}
if (!out.isNewLine()) {
out.println();
}
out.print(getModifiers());
out.print("class ");
out.print(getID());
if (hasSuperClass()) {
out.print(" extends ");
out.print(getSuperClass());
}
if (hasImplements()) {
out.print(" implements ");
out.join(getImplementss(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.print(", ");
}
});
}
out.print(" {");
out.println();
out.indent(1);
out.join(getBodyDecls(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.println();
out.println();
}
});
if (!out.isNewLine()) {
out.println();
}
out.print("}");
}
/**
* @aspect SuperClasses
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:665
*/
public boolean hasSuperclass() {
return !isObject();
}
/**
* @aspect SuperClasses
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:669
*/
public TypeDecl superclass() {
if (isObject()) {
return unknownType();
} else if (hasSuperClass()) {
return getSuperClass().type();
} else {
return typeObject();
}
}
/**
* Check compatibility of interface method and superclass method.
* @param m interface method
* @param n superclass method
* @aspect TypeHierarchyCheck
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:468
*/
private void interfaceMethodCompatibleWithInherited(Collection problems,
MethodDecl m, MethodDecl n) {
if (n.isAbstract()) {
checkAbstractMethodDecls(problems, m, n);
}
if (n.isStatic()) {
problems.add(error("Xa static method may not hide an instance method"));
}
if (!n.isAbstract() && !n.isPublic()) {
problems.add(errorf("Xoverriding access modifier error for %s in %s and %s",
m.fullSignature(), m.hostType().typeName(), n.hostType().typeName()));
}
if (!n.mayOverride(m) && !m.mayOverride(m)) {
problems.add(errorf("Xthe return type of method %s in %s does not match"
+ " the return type of method %s in %s and may thus not be overridden",
m.fullSignature(), m.hostType().typeName(), n.fullSignature(), n.hostType().typeName()));
}
if (!n.isAbstract()) {
// If n implements and overrides method m in the interface then it
// may not throw more checked exceptions.
for (Access e: n.getExceptionList()) {
if (e.type().isCheckedException()) {
boolean found = false;
for (Access declException: m.getExceptionList()) {
if (e.type().instanceOf(declException.type())) {
found = true;
break;
}
}
if (!found) {
problems.add(errorf(
"%s in %s may not throw more checked exceptions than overridden method %s in %s",
n.fullSignature(), n.hostType().typeName(), m.fullSignature(),
m.hostType().typeName()));
}
}
}
}
}
/**
* @aspect GenerateClassfile
* @declaredat /home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag:58
*/
public void generateClassfile() {
super.generateClassfile();
String fileName = destinationPath();
if (program().options().verbose()) {
System.out.println("Writing class file to " + fileName);
}
try {
ConstantPool cp = constantPool();
// Force building of constant pool.
cp.addClass(constantPoolName());
if (hasSuperclass()) {
cp.addClass(superclass().constantPoolName());
}
int numInterfaces = 0;
for (Iterator iter = interfacesIterator(); iter.hasNext(); numInterfaces++) {
cp.addClass(iter.next().constantPoolName());
}
for (FieldDeclarator field : fieldDeclarations()) {
cp.addUtf8(field.name());
cp.addUtf8(field.type().typeDescriptor());
field.attributes();
}
// Add fields to store enclosing variables.
for (Variable var : enclosingVariables()) {
cp.addUtf8("val$" + var.name());
cp.addUtf8(var.type().typeDescriptor());
}
if (needsEnclosing()) {
cp.addUtf8("this$0");
cp.addUtf8(enclosing().typeDescriptor());
cp.addUtf8("Synthetic");
}
for (BodyDecl method : methodsAndConstructors()) {
method.touchMethod(cp);
}
if (hasClinit()) {
cp.addUtf8("");
cp.addUtf8("()V");
clinit_attributes();
}
attributes();
// Actual ClassFile generation.
File dest = new File(fileName);
File parentFile = dest.getParentFile();
if (parentFile != null) {
parentFile.mkdirs();
}
FileOutputStream f = new FileOutputStream(fileName);
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(f));
out.writeInt(magicHeader());
out.writeChar(minorVersion());
out.writeChar(majorVersion());
cp.emit(out);
int flags = flags();
if (isNestedType()) {
flags = mangledFlags(flags);
}
flags |= Modifiers.ACC_SUPER;
out.writeChar(flags);
out.writeChar(cp.addClass(constantPoolName()));
out.writeChar(hasSuperclass() ? cp.addClass(superclass().constantPoolName()) : 0);
out.writeChar(numInterfaces);
for (Iterator iter = interfacesIterator(); iter.hasNext(); ) {
out.writeChar(cp.addClass(iter.next().constantPoolName()));
}
generateFields(out, cp);
if (needsEnclosing()) {
out.writeChar(0);
out.writeChar(cp.addUtf8("this$0"));
out.writeChar(cp.addUtf8(enclosing().typeDescriptor()));
out.writeChar(1);
new SyntheticAttribute(cp).emit(out);
}
Collection methods = methodsAndConstructors();
out.writeChar(methods.size() + (hasClinit() ? 1 : 0));
for (BodyDecl b : methods) {
b.generateMethod(out, cp);
}
if (hasClinit()) {
out.writeChar(Modifiers.ACC_STATIC);
out.writeChar(cp.addUtf8(""));
out.writeChar(cp.addUtf8("()V"));
out.writeChar(clinit_attributes().size());
for (Attribute attribute : clinit_attributes()) {
attribute.emit(out);
}
}
out.writeChar(attributes().size());
for (Attribute attribute : attributes()) {
attribute.emit(out);
}
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* @declaredat ASTNode:1
*/
public ClassDecl() {
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[5];
setChild(new Opt(), 1);
setChild(new List(), 2);
setChild(new List(), 3);
setChild(new Opt(), 4);
}
/**
* @declaredat ASTNode:17
*/
@ASTNodeAnnotation.Constructor(
name = {"Modifiers", "ID", "SuperClass", "Implements", "BodyDecl"},
type = {"Modifiers", "String", "Opt", "List", "List"},
kind = {"Child", "Token", "Opt", "List", "List"}
)
public ClassDecl(Modifiers p0, String p1, Opt p2, List p3, List p4) {
setChild(p0, 0);
setID(p1);
setChild(p2, 1);
setChild(p3, 2);
setChild(p4, 3);
}
/**
* @declaredat ASTNode:29
*/
public ClassDecl(Modifiers p0, beaver.Symbol p1, Opt p2, List p3, List p4) {
setChild(p0, 0);
setID(p1);
setChild(p2, 1);
setChild(p3, 2);
setChild(p4, 3);
}
/** @apilevel low-level
* @declaredat ASTNode:37
*/
protected int numChildren() {
return 4;
}
/**
* @apilevel internal
* @declaredat ASTNode:43
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:47
*/
public void flushAttrCache() {
super.flushAttrCache();
constructors_reset();
getImplicitConstructorOpt_reset();
castingConversionTo_TypeDecl_reset();
isString_reset();
isObject_reset();
instanceOf_TypeDecl_reset();
superInterfaces_reset();
isCircular_reset();
methodsSignatureMap_reset();
ancestorMethods_String_reset();
memberFieldsMap_reset();
memberFields_String_reset();
unimplementedMethods_reset();
hasAbstract_reset();
typeDescriptor_reset();
}
/** @apilevel internal
* @declaredat ASTNode:66
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:70
*/
public ClassDecl clone() throws CloneNotSupportedException {
ClassDecl node = (ClassDecl) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:75
*/
public ClassDecl copy() {
try {
ClassDecl node = (ClassDecl) 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:94
*/
@Deprecated
public ClassDecl 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:104
*/
public ClassDecl treeCopyNoTransform() {
ClassDecl tree = (ClassDecl) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
switch (i) {
case 4:
tree.children[i] = new Opt();
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:129
*/
public ClassDecl treeCopy() {
ClassDecl tree = (ClassDecl) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
switch (i) {
case 4:
tree.children[i] = new Opt();
continue;
}
ASTNode child = (ASTNode) getChild(i);
if (child != null) {
child = child.treeCopy();
tree.setChild(child, i);
}
}
}
return tree;
}
/** @apilevel internal
* @declaredat ASTNode:148
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node) && (tokenString_ID == ((ClassDecl) 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 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, 1);
}
/**
* 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(1);
}
/**
* 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(1);
}
/**
* 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, 2);
}
/**
* 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(2);
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(2);
}
/**
* @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 BodyDecl list.
* @param list The new list node to be used as the BodyDecl list.
* @apilevel high-level
*/
public void setBodyDeclList(List list) {
setChild(list, 3);
}
/**
* 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 BodyDecl list.
* @return The node representing the BodyDecl list.
* @apilevel high-level
*/
@ASTNodeAnnotation.ListChild(name="BodyDecl")
public List getBodyDeclList() {
List list = (List) getChild(3);
return list;
}
/**
* 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(3);
}
/**
* @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();
}
/**
* 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;
}
/**
* @attribute syn
* @aspect TypeScopePropagation
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:674
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeScopePropagation", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupType.jrag:674")
public SimpleSet memberTypes(String name) {
{
SimpleSet result = localTypeDecls(name);
if (!result.isEmpty()) {
return result;
}
for (Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) {
TypeDecl type = outerIter.next();
for (TypeDecl decl : type.memberTypes(name)) {
if (!decl.isPrivate() && decl.accessibleFrom(this)) {
result = result.add(decl);
}
}
}
if (hasSuperclass()) {
for (TypeDecl decl : superclass().memberTypes(name)) {
if (!decl.isPrivate() && decl.accessibleFrom(this)) {
result = result.add(decl);
}
}
}
return result;
}
}
/**
* @attribute syn
* @aspect ConstructScope
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:47
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ConstructScope", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:47")
public Collection lookupSuperConstructor() {
Collection lookupSuperConstructor_value = hasSuperclass() ? superclass().constructors() : Collections.emptyList();
return lookupSuperConstructor_value;
}
/** @apilevel internal */
private void constructors_reset() {
constructors_computed = null;
constructors_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle constructors_computed = null;
/** @apilevel internal */
protected Collection constructors_value;
/**
* @attribute syn
* @aspect ConstructorLookup
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:139
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ConstructorLookup", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:139")
public Collection constructors() {
ASTState state = state();
if (constructors_computed == ASTState.NON_CYCLE || constructors_computed == state().cycle()) {
return constructors_value;
}
constructors_value = constructors_compute();
if (state().inCircle()) {
constructors_computed = state().cycle();
} else {
constructors_computed = ASTState.NON_CYCLE;
}
return constructors_value;
}
/** @apilevel internal */
private Collection constructors_compute() {
Collection c = new ArrayList(super.constructors());
if (hasImplicitConstructor()) {
c.add(getImplicitConstructor());
}
return c;
}
/**
* A class declaration requires an implicit constructor if it has no
* explicit constructor.
* @return true
if this class requires an implicit default
* contstructor.
* @attribute syn
* @aspect ImplicitConstructor
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:225
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ImplicitConstructor", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:225")
public boolean needsImplicitConstructor() {
boolean needsImplicitConstructor_value = compilationUnit().fromSource() && !hasExplicitConstructor();
return needsImplicitConstructor_value;
}
/** @apilevel internal */
private void getImplicitConstructorOpt_reset() {
getImplicitConstructorOpt_computed = false;
getImplicitConstructorOpt_value = null;
}
/** @apilevel internal */
protected boolean getImplicitConstructorOpt_computed = false;
/** @apilevel internal */
protected Opt getImplicitConstructorOpt_value;
/**
* @attribute syn nta
* @aspect ImplicitConstructor
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:248
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isNTA=true)
@ASTNodeAnnotation.Source(aspect="ImplicitConstructor", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:248")
public Opt getImplicitConstructorOpt() {
ASTState state = state();
if (getImplicitConstructorOpt_computed) {
return (Opt) getChild(getImplicitConstructorOptChildPosition());
}
state().enterLazyAttribute();
getImplicitConstructorOpt_value = getImplicitConstructorOpt_compute();
setChild(getImplicitConstructorOpt_value, getImplicitConstructorOptChildPosition());
getImplicitConstructorOpt_computed = true;
state().leaveLazyAttribute();
Opt node = (Opt) this.getChild(getImplicitConstructorOptChildPosition());
return node;
}
/** @apilevel internal */
private Opt getImplicitConstructorOpt_compute() {
if (needsImplicitConstructor()) {
Modifiers modifiers = new Modifiers();
if (isPublic()) {
modifiers.addModifier(new Modifier("public"));
} else if (isProtected()) {
modifiers.addModifier(new Modifier("protected"));
} else if (isPrivate()) {
modifiers.addModifier(new Modifier("private"));
}
ConstructorDecl constructor = new ConstructorDecl(
modifiers,
name(),
new List(),
new List(),
new Opt(),
new Block());
constructor.setParsedConstructorInvocation(new ExprStmt(
new SuperConstructorAccess("super", new List())));
constructor.setImplicitConstructor();
return new Opt(constructor);
} else {
return new Opt();
}
}
/**
* @attribute syn
* @aspect ImplicitConstructor
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:332
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ImplicitConstructor", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupConstructor.jrag:332")
public boolean hasExplicitConstructor() {
{
for (int i = 0; i < getNumBodyDecl(); i++) {
if (getBodyDecl(i) instanceof ConstructorDecl) {
return true;
}
}
return false;
}
}
/** @apilevel internal */
private void castingConversionTo_TypeDecl_reset() {
castingConversionTo_TypeDecl_computed = null;
castingConversionTo_TypeDecl_values = null;
}
/** @apilevel internal */
protected java.util.Map castingConversionTo_TypeDecl_values;
/** @apilevel internal */
protected java.util.Map castingConversionTo_TypeDecl_computed;
/**
* @attribute syn
* @aspect TypeConversion
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:100
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeConversion", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:100")
public boolean castingConversionTo(TypeDecl type) {
Object _parameters = type;
if (castingConversionTo_TypeDecl_computed == null) castingConversionTo_TypeDecl_computed = new java.util.HashMap(4);
if (castingConversionTo_TypeDecl_values == null) castingConversionTo_TypeDecl_values = new java.util.HashMap(4);
ASTState state = state();
if (castingConversionTo_TypeDecl_values.containsKey(_parameters)
&& castingConversionTo_TypeDecl_computed.containsKey(_parameters)
&& (castingConversionTo_TypeDecl_computed.get(_parameters) == ASTState.NON_CYCLE || castingConversionTo_TypeDecl_computed.get(_parameters) == state().cycle())) {
return (Boolean) castingConversionTo_TypeDecl_values.get(_parameters);
}
boolean castingConversionTo_TypeDecl_value = castingConversionTo_compute(type);
if (state().inCircle()) {
castingConversionTo_TypeDecl_values.put(_parameters, castingConversionTo_TypeDecl_value);
castingConversionTo_TypeDecl_computed.put(_parameters, state().cycle());
} else {
castingConversionTo_TypeDecl_values.put(_parameters, castingConversionTo_TypeDecl_value);
castingConversionTo_TypeDecl_computed.put(_parameters, ASTState.NON_CYCLE);
}
return castingConversionTo_TypeDecl_value;
}
/** @apilevel internal */
private boolean castingConversionTo_compute(TypeDecl type) {
if (type.isArrayDecl()) {
return isObject();
} else if (type.isClassDecl()) {
return this == type || instanceOf(type) || type.instanceOf(this);
} else if (type.isInterfaceDecl()) {
return !isFinal() || instanceOf(type);
} else return super.castingConversionTo(type);
}
/**
* @attribute syn
* @aspect TypeAnalysis
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:223
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeAnalysis", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:223")
public boolean isClassDecl() {
boolean isClassDecl_value = true;
return isClassDecl_value;
}
/** @apilevel internal */
private void isString_reset() {
isString_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle isString_computed = null;
/** @apilevel internal */
protected boolean isString_value;
/**
* @attribute syn
* @aspect TypeAnalysis
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:240
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeAnalysis", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:240")
public boolean isString() {
ASTState state = state();
if (isString_computed == ASTState.NON_CYCLE || isString_computed == state().cycle()) {
return isString_value;
}
isString_value = fullName().equals("java.lang.String");
if (state().inCircle()) {
isString_computed = state().cycle();
} else {
isString_computed = ASTState.NON_CYCLE;
}
return isString_value;
}
/** @apilevel internal */
private void isObject_reset() {
isObject_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle isObject_computed = null;
/** @apilevel internal */
protected boolean isObject_value;
/**
* @attribute syn
* @aspect TypeAnalysis
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:243
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeAnalysis", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:243")
public boolean isObject() {
ASTState state = state();
if (isObject_computed == ASTState.NON_CYCLE || isObject_computed == state().cycle()) {
return isObject_value;
}
isObject_value = name().equals("Object") && packageName().equals("java.lang");
if (state().inCircle()) {
isObject_computed = state().cycle();
} else {
isObject_computed = ASTState.NON_CYCLE;
}
return isObject_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:443
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeWideningAndIdentity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:443")
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 = type.isSupertypeOfClassDecl(this);
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 TypeWideningAndIdentity
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:459
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeWideningAndIdentity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:459")
public boolean isSupertypeOfClassDecl(ClassDecl type) {
{
if (super.isSupertypeOfClassDecl(type)) {
return true;
}
return type.hasSuperclass() && type.superclass().instanceOf(this);
}
}
/**
* @attribute syn
* @aspect TypeWideningAndIdentity
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:479
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeWideningAndIdentity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:479")
public boolean isSupertypeOfInterfaceDecl(InterfaceDecl type) {
boolean isSupertypeOfInterfaceDecl_InterfaceDecl_value = isObject();
return isSupertypeOfInterfaceDecl_InterfaceDecl_value;
}
/**
* @attribute syn
* @aspect TypeWideningAndIdentity
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:494
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeWideningAndIdentity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:494")
public boolean isSupertypeOfArrayDecl(ArrayDecl type) {
{
if (super.isSupertypeOfArrayDecl(type)) {
return true;
}
return type.hasSuperclass() && type.superclass().instanceOf(this);
}
}
/**
* @attribute syn
* @aspect NestedTypes
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:596
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="NestedTypes", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:596")
public boolean isInnerClass() {
boolean isInnerClass_value = isNestedType() && !isStatic() && enclosingType().isClassDecl();
return isInnerClass_value;
}
/** @apilevel internal */
private void superInterfaces_reset() {
superInterfaces_computed = null;
superInterfaces_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle superInterfaces_computed = null;
/** @apilevel internal */
protected Collection superInterfaces_value;
/**
* @return the interfaces directly implemented by this type.
* @attribute syn
* @aspect SuperClasses
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:696
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="SuperClasses", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:696")
public Collection superInterfaces() {
ASTState state = state();
if (superInterfaces_computed == ASTState.NON_CYCLE || superInterfaces_computed == state().cycle()) {
return superInterfaces_value;
}
superInterfaces_value = superInterfaces_compute();
if (state().inCircle()) {
superInterfaces_computed = state().cycle();
} else {
superInterfaces_computed = ASTState.NON_CYCLE;
}
return superInterfaces_value;
}
/** @apilevel internal */
private Collection superInterfaces_compute() {
if (isObject()) {
return Collections.emptyList();
} else {
Collection interfaces = new ArrayList();
for (Access access : getImplementsList()) {
TypeDecl implemented = access.type();
if (implemented.isInterfaceDecl()) { // TODO(joqvist): unclear why this is needed.
interfaces.add(implemented);
}
}
return interfaces;
}
}
/** @apilevel internal */
protected ASTState.Cycle isCircular_cycle = null;
/** @apilevel internal */
private void isCircular_reset() {
isCircular_computed = false;
isCircular_initialized = false;
isCircular_cycle = null;
}
/** @apilevel internal */
protected boolean isCircular_computed = false;
/** @apilevel internal */
protected boolean isCircular_value;
/** @apilevel internal */
protected boolean isCircular_initialized = false;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="Circularity", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:728")
public boolean isCircular() {
if (isCircular_computed) {
return isCircular_value;
}
ASTState state = state();
if (!isCircular_initialized) {
isCircular_initialized = true;
isCircular_value = true;
}
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
do {
isCircular_cycle = state.nextCycle();
boolean new_isCircular_value = isCircular_compute();
if (isCircular_value != new_isCircular_value) {
state.setChangeInCycle();
}
isCircular_value = new_isCircular_value;
} while (state.testAndClearChangeInCycle());
isCircular_computed = true;
state.leaveCircle();
} else if (isCircular_cycle != state.cycle()) {
isCircular_cycle = state.cycle();
boolean new_isCircular_value = isCircular_compute();
if (isCircular_value != new_isCircular_value) {
state.setChangeInCycle();
}
isCircular_value = new_isCircular_value;
} else {
}
return isCircular_value;
}
/** @apilevel internal */
private boolean isCircular_compute() {
if (hasSuperClass()) {
Access a = getSuperClass().lastAccess();
while (a != null) {
if (a.type().isCircular()) {
return true;
}
a = (a.isQualified() && a.qualifier().isTypeAccess()) ? (Access) a.qualifier() : null;
}
}
for (int i = 0; i < getNumImplements(); i++) {
Access a = getImplements(i).lastAccess();
while (a != null) {
if (a.type().isCircular()) {
return true;
}
a = (a.isQualified() && a.qualifier().isTypeAccess()) ? (Access) a.qualifier() : null;
}
}
return false;
}
/**
* @attribute syn
* @aspect PrettyPrintUtil
* @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag:244
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="PrettyPrintUtil", declaredAt="/home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag:244")
public boolean hasModifiers() {
boolean hasModifiers_value = getModifiers().getNumModifier() > 0;
return hasModifiers_value;
}
/**
* Computes compile errors for each checked exception thrown by the default
* constructor of this class.
* @attribute syn
* @aspect ExceptionHandling
* @declaredat /home/jesper/git/extendj/java4/frontend/ExceptionHandling.jrag:388
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ExceptionHandling", declaredAt="/home/jesper/git/extendj/java4/frontend/ExceptionHandling.jrag:388")
public Collection exceptionHandlingProblems() {
{
if (!hasImplicitConstructor() || isAnonymous()) {
// If this class is anonymous, then exceptions are checked by the code
// instantiating the anonymous class.
return Collections.emptyList();
}
Collection problems = new LinkedList();
Stmt superCall = getImplicitConstructor().getParsedConstructorInvocation();
SuperConstructorAccess superAccess = (SuperConstructorAccess) ((ExprStmt) superCall).getExpr();
for (Access exception : superAccess.decl().getExceptionList()) {
if (exception.type().isCheckedException()) {
problems.add(errorf(
"default constructor for class %s throws unchecked exception %s via "
+ "superclass constructor", name(), exception.type().fullName()));
}
}
return problems;
}
}
/**
* @attribute syn
* @aspect AccessControl
* @declaredat /home/jesper/git/extendj/java4/frontend/AccessControl.jrag:186
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="AccessControl", declaredAt="/home/jesper/git/extendj/java4/frontend/AccessControl.jrag:186")
public Collection accessControlProblems() {
{
Collection problems = new LinkedList();
// 8.1.1.2 final Classes
TypeDecl typeDecl = superclass();
if (!typeDecl.isUnknown() && !typeDecl.accessibleFromExtend(this)) {
problems.add(errorf("class %s may not extend non accessible type %s",
fullName(), typeDecl.fullName()));
}
if (hasSuperclass() && !superclass().accessibleFrom(this)) {
problems.add(errorf("a superclass must be accessible which %s is not",
superclass().name()));
}
// 8.1.4
for (int i = 0; i < getNumImplements(); i++) {
TypeDecl decl = getImplements(i).type();
if (!decl.isCircular() && !decl.accessibleFrom(this)) {
problems.add(errorf("class %s can not implement non accessible type %s",
fullName(), decl.fullName()));
}
}
return problems;
}
}
/**
* @attribute syn
* @aspect ConstantExpression
* @declaredat /home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:95
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ConstantExpression", declaredAt="/home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:95")
public Constant cast(Constant c) {
Constant cast_Constant_value = Constant.create(c.stringValue());
return cast_Constant_value;
}
/**
* @attribute syn
* @aspect ConstantExpression
* @declaredat /home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:195
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ConstantExpression", declaredAt="/home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:195")
public Constant add(Constant c1, Constant c2) {
Constant add_Constant_Constant_value = Constant.create(c1.stringValue() + c2.stringValue());
return add_Constant_Constant_value;
}
/**
* @attribute syn
* @aspect ConstantExpression
* @declaredat /home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:299
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ConstantExpression", declaredAt="/home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:299")
public Constant questionColon(Constant cond, Constant c1, Constant c2) {
Constant questionColon_Constant_Constant_Constant_value = Constant.create(cond.booleanValue() ? c1.stringValue() : c2.stringValue());
return questionColon_Constant_Constant_Constant_value;
}
/**
* @attribute syn
* @aspect ConstantExpression
* @declaredat /home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:499
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ConstantExpression", declaredAt="/home/jesper/git/extendj/java4/frontend/ConstantExpression.jrag:499")
public boolean eqIsTrue(Expr left, Expr right) {
boolean eqIsTrue_Expr_Expr_value = isString() && left.constant().stringValue().equals(right.constant().stringValue());
return eqIsTrue_Expr_Expr_value;
}
/**
* @attribute syn
* @aspect ErrorCheck
* @declaredat /home/jesper/git/extendj/java4/frontend/ErrorCheck.jrag:46
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="ErrorCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/ErrorCheck.jrag:46")
public int lineNumber() {
int lineNumber_value = getLine(IDstart);
return lineNumber_value;
}
/**
* Find method declarations inherited from superinterfaces with the given
* signature.
* The result can be multiple method declarations.
* @attribute syn
* @aspect MemberMethods
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:629
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="MemberMethods", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:629")
public SimpleSet interfacesMethodsSignature(String signature) {
{
SimpleSet result = interfacesMethodsSignatureMap().get(signature);
if (result != null) {
return result;
} else {
return emptySet();
}
}
}
/** @apilevel internal */
private void methodsSignatureMap_reset() {
methodsSignatureMap_computed = null;
methodsSignatureMap_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle methodsSignatureMap_computed = null;
/** @apilevel internal */
protected Map> methodsSignatureMap_value;
/**
* Map method signatures to sets of method declarations
* for this type.
*
* Includes all supertype method declarations.
* @attribute syn
* @aspect MemberMethods
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:706
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="MemberMethods", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:706")
public Map> methodsSignatureMap() {
ASTState state = state();
if (methodsSignatureMap_computed == ASTState.NON_CYCLE || methodsSignatureMap_computed == state().cycle()) {
return methodsSignatureMap_value;
}
methodsSignatureMap_value = methodsSignatureMap_compute();
if (state().inCircle()) {
methodsSignatureMap_computed = state().cycle();
} else {
methodsSignatureMap_computed = ASTState.NON_CYCLE;
}
return methodsSignatureMap_value;
}
/** @apilevel internal */
private Map> methodsSignatureMap_compute() {
Map> localMap = localMethodsSignatureMap();
Map> map = new HashMap>(localMap);
if (hasSuperclass()) {
for (Iterator iter = superclass().methodsIterator(); iter.hasNext(); ) {
MethodDecl m = iter.next();
if (!m.isPrivate() && m.accessibleFrom(this) && !localMap.containsKey(m.signature())) {
putSimpleSetElement(map, m.signature(), m);
}
}
}
for (Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) {
MethodDecl m = iter.next();
if (m.accessibleFrom(this) && !localMap.containsKey(m.signature())) {
if (allMethodsAbstract((SimpleSet) map.get(m.signature()))) {
putSimpleSetElement(map, m.signature(), m);
}
}
}
return map;
}
/** @apilevel internal */
private void ancestorMethods_String_reset() {
ancestorMethods_String_computed = null;
ancestorMethods_String_values = null;
}
/** @apilevel internal */
protected java.util.Map ancestorMethods_String_values;
/** @apilevel internal */
protected java.util.Map ancestorMethods_String_computed;
/**
* Finds methods with the same signature declared in ancestors types. This
* is used when checking correct overriding, hiding, and implementation of
* abstract methods.
* @attribute syn
* @aspect AncestorMethods
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:788
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="AncestorMethods", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:788")
public SimpleSet ancestorMethods(String signature) {
Object _parameters = signature;
if (ancestorMethods_String_computed == null) ancestorMethods_String_computed = new java.util.HashMap(4);
if (ancestorMethods_String_values == null) ancestorMethods_String_values = new java.util.HashMap(4);
ASTState state = state();
if (ancestorMethods_String_values.containsKey(_parameters)
&& ancestorMethods_String_computed.containsKey(_parameters)
&& (ancestorMethods_String_computed.get(_parameters) == ASTState.NON_CYCLE || ancestorMethods_String_computed.get(_parameters) == state().cycle())) {
return (SimpleSet) ancestorMethods_String_values.get(_parameters);
}
SimpleSet ancestorMethods_String_value = ancestorMethods_compute(signature);
if (state().inCircle()) {
ancestorMethods_String_values.put(_parameters, ancestorMethods_String_value);
ancestorMethods_String_computed.put(_parameters, state().cycle());
} else {
ancestorMethods_String_values.put(_parameters, ancestorMethods_String_value);
ancestorMethods_String_computed.put(_parameters, ASTState.NON_CYCLE);
}
return ancestorMethods_String_value;
}
/** @apilevel internal */
private SimpleSet ancestorMethods_compute(String signature) {
SimpleSet result = emptySet();
if (hasSuperclass()) {
for (MethodDecl method : superclass().localMethodsSignature(signature)) {
if (!method.isPrivate()) {
result = result.add(method);
}
}
}
// Always add interface methods to the ancestorMethods set so that their
// access modifiers are checked against local overriding methods.
for (MethodDecl method : interfacesMethodsSignature(signature)) {
result = result.add(method);
}
if (!hasSuperclass()) {
return result;
}
if (result.isSingleton()) {
MethodDecl m = result.singletonValue();
if (!m.isAbstract()) {
boolean done = true;
for (MethodDecl n : superclass().ancestorMethods(signature)) {
if (n.isPrivate() || !n.accessibleFrom(m.hostType())) {
done = false;
}
}
if (done) {
return result;
}
}
}
for (MethodDecl m : superclass().ancestorMethods(signature)) {
result = result.add(m);
}
return result;
}
/** @apilevel internal */
private void memberFieldsMap_reset() {
memberFieldsMap_computed = null;
memberFieldsMap_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle memberFieldsMap_computed = null;
/** @apilevel internal */
protected Map> memberFieldsMap_value;
/**
* @attribute syn
* @aspect Fields
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:402
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Fields", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:402")
public Map> memberFieldsMap() {
ASTState state = state();
if (memberFieldsMap_computed == ASTState.NON_CYCLE || memberFieldsMap_computed == state().cycle()) {
return memberFieldsMap_value;
}
memberFieldsMap_value = memberFieldsMap_compute();
if (state().inCircle()) {
memberFieldsMap_computed = state().cycle();
} else {
memberFieldsMap_computed = ASTState.NON_CYCLE;
}
return memberFieldsMap_value;
}
/** @apilevel internal */
private Map> memberFieldsMap_compute() {
Map> map =
new HashMap>(localFieldsMap());
if (hasSuperclass()) {
Iterator iter = superclass().fieldsIterator();
while (iter.hasNext()) {
Variable decl = iter.next();
if (!decl.isPrivate() && decl.accessibleFrom(this)
&& !localFieldsMap().containsKey(decl.name())) {
putSimpleSetElement(map, decl.name(), decl);
}
}
}
Iterator outerIter = interfacesIterator();
while (outerIter.hasNext()) {
TypeDecl type = outerIter.next();
Iterator iter = type.fieldsIterator();
while (iter.hasNext()) {
Variable decl = iter.next();
if (!decl.isPrivate() && decl.accessibleFrom(this)
&& !localFieldsMap().containsKey(decl.name())) {
putSimpleSetElement(map, decl.name(), decl);
}
}
}
return map;
}
/** @apilevel internal */
private void memberFields_String_reset() {
memberFields_String_computed = null;
memberFields_String_values = null;
}
/** @apilevel internal */
protected java.util.Map memberFields_String_values;
/** @apilevel internal */
protected java.util.Map memberFields_String_computed;
/**
* @attribute syn
* @aspect Fields
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:475
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Fields", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:475")
public SimpleSet memberFields(String name) {
Object _parameters = name;
if (memberFields_String_computed == null) memberFields_String_computed = new java.util.HashMap(4);
if (memberFields_String_values == null) memberFields_String_values = new java.util.HashMap(4);
ASTState state = state();
if (memberFields_String_values.containsKey(_parameters)
&& memberFields_String_computed.containsKey(_parameters)
&& (memberFields_String_computed.get(_parameters) == ASTState.NON_CYCLE || memberFields_String_computed.get(_parameters) == state().cycle())) {
return (SimpleSet) memberFields_String_values.get(_parameters);
}
SimpleSet memberFields_String_value = memberFields_compute(name);
if (state().inCircle()) {
memberFields_String_values.put(_parameters, memberFields_String_value);
memberFields_String_computed.put(_parameters, state().cycle());
} else {
memberFields_String_values.put(_parameters, memberFields_String_value);
memberFields_String_computed.put(_parameters, ASTState.NON_CYCLE);
}
return memberFields_String_value;
}
/** @apilevel internal */
private SimpleSet memberFields_compute(String name) {
SimpleSet fields = localFields(name);
if (!fields.isEmpty()) {
return fields; // This causes hiding of fields in superclass and interfaces.
}
if (hasSuperclass()) {
Iterator iter = superclass().memberFields(name).iterator();
while (iter.hasNext()) {
Variable decl = iter.next();
if (!decl.isPrivate() && decl.accessibleFrom(this)) {
fields = fields.add(decl);
}
}
}
Iterator outerIter = interfacesIterator();
while (outerIter.hasNext()) {
TypeDecl type = outerIter.next();
Iterator iter = type.memberFields(name).iterator();
while (iter.hasNext()) {
Variable decl = iter.next();
if (!decl.isPrivate() && decl.accessibleFrom(this)) {
fields = fields.add(decl);
}
}
}
return fields;
}
/**
* @attribute syn
* @aspect TypeHierarchyCheck
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:353
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeHierarchyCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:353")
public Collection typeProblems() {
{
Collection problems = new LinkedList(super.typeProblems());
// Check if methods inherited from interfaces are compatible with the
// overriding method in this class or method inherited from ancestor class.
for (Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) {
MethodDecl decl = iter.next();
// First we check locally declared methods, then if no local method
// overrides the interface method we check ancestor methods. We check
// ancestor types in superclass order and stop at the first overriding method.
boolean overridden = false;
ClassDecl hostType = this;
while (!overridden) {
for (MethodDecl m : hostType.localMethodsSignature(decl.signature())) {
if (m.overrideCandidate(decl)) {
overridden = true;
if (!m.mayOverride(decl)) {
problems.add(errorf(
"the return type of method %s in %s does not match the return type of"
+ " method %s in %s and may thus not be overridden",
m.fullSignature(), hostType.typeName(), decl.fullSignature(),
decl.hostType().typeName()));
}
}
}
if (!hostType.hasSuperclass()) {
break;
}
hostType = (ClassDecl) hostType.superclass();
}
}
return problems;
}
}
/**
* @attribute syn
* @aspect TypeHierarchyCheck
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:389
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="TypeHierarchyCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:389")
public Collection nameProblems() {
{
Collection problems = new LinkedList(super.nameProblems());
if (hasSuperClass() && !getSuperClass().type().isClassDecl()) {
problems.add(errorf("a class may only inherit another class, which %s is not",
getSuperClass().type().typeName()));
}
if (isObject() && hasSuperClass()) {
problems.add(error("class Object may not have a superclass"));
}
if (isObject() && getNumImplements() != 0) {
problems.add(error("class Object may not implement an interface"));
}
// 8.1.3
if (isCircular()) {
problems.add(errorf("circular inheritance dependency in %s", typeName()));
}
// 8.1.4
Collection set = new HashSet();
for (int i = 0; i < getNumImplements(); i++) {
TypeDecl decl = getImplements(i).type();
if (!decl.isInterfaceDecl() && !decl.isUnknown()) {
problems.add(errorf("type %s can not implement the non-interface type %s",
fullName(), decl.fullName()));
}
if (set.contains(decl)) {
problems.add(errorf("type %s is mentionened multiple times in implements clause",
decl.fullName()));
}
set.add(decl);
}
for (Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl) iter.next();
if (localMethodsSignature(m.signature()).isEmpty()) {
SimpleSet s = superclass().methodsSignature(m.signature());
for (MethodDecl n : s) {
if (n.accessibleFrom(this)) {
interfaceMethodCompatibleWithInherited(problems, m, n);
}
}
if (s.isEmpty()) {
for (MethodDecl n : interfacesMethodsSignature(m.signature())) {
// TODO(joqvist): don't report this error twice.
checkAbstractMethodDecls(problems, m, n);
}
}
}
}
// Check if there is a matching accessible super constructor for the default constructor.
if (hasImplicitConstructor()) {
Stmt superCall = getImplicitConstructor().getParsedConstructorInvocation();
SuperConstructorAccess superAccess =
(SuperConstructorAccess) ((ExprStmt) superCall).getExpr();
if (superAccess.decls().isEmpty()) {
problems.add(errorf(
"can not generate default constructor for class %s because "
+ "superclass %s has no accessible zero-argument constructor",
name(), superclass().name()));
} else if (!isAnonymous() && superclass().isInnerType()
&& !hasEnclosingType(superclass().enclosingType())) {
problems.add(errorf(
"can not generate default constructor for class %s because its "
+ "superclass %s is an inner type of %s but %s is not an inner type of %s or a "
+ "subtype thereof",
name(), superclass().typeName(), superclass().enclosingType().name(),
name(), superclass().enclosingType().name()));
}
}
return problems;
}
}
/** @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 methods = new ArrayList();
for (Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl) iter.next();
boolean implemented = false;
SimpleSet result = localMethodsSignature(m.signature());
if (result.isSingleton()) {
MethodDecl n = result.singletonValue();
if (!n.isAbstract()) {
implemented = true;
}
}
if (!implemented) {
result = ancestorMethods(m.signature());
for (MethodDecl n : result) {
if (!n.isAbstract() && n.isPublic()) {
implemented = true;
break;
}
}
}
if (!implemented) {
methods.add(m);
}
}
if (hasSuperclass()) {
for (MethodDecl m : superclass().unimplementedMethods()) {
SimpleSet result = localMethodsSignature(m.signature());
if (result.isSingleton()) {
MethodDecl n = result.singletonValue();
if (n.isAbstract() || !n.overrides(m)) {
methods.add(m);
}
} else {
methods.add(m);
}
}
}
for (Iterator iter = localMethodsIterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl) iter.next();
if (m.isAbstract()) {
methods.add(m);
}
}
return methods;
}
/** @apilevel internal */
private void hasAbstract_reset() {
hasAbstract_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle hasAbstract_computed = null;
/** @apilevel internal */
protected boolean hasAbstract_value;
/**
* @attribute syn
* @aspect Modifiers
* @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:33
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Modifiers", declaredAt="/home/jesper/git/extendj/java4/frontend/Modifiers.jrag:33")
public boolean hasAbstract() {
ASTState state = state();
if (hasAbstract_computed == ASTState.NON_CYCLE || hasAbstract_computed == state().cycle()) {
return hasAbstract_value;
}
hasAbstract_value = !unimplementedMethods().isEmpty();
if (state().inCircle()) {
hasAbstract_computed = state().cycle();
} else {
hasAbstract_computed = ASTState.NON_CYCLE;
}
return hasAbstract_value;
}
/** @return a collection of the methods and constructors declared in this type.
* @attribute syn
* @aspect GenerateClassfile
* @declaredat /home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag:423
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenerateClassfile", declaredAt="/home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag:423")
public Collection methodsAndConstructors() {
{
Collection methods = new ArrayList();
if (hasImplicitConstructor()) {
methods.add(getImplicitConstructor());
}
methods.addAll(super.methodsAndConstructors());
return methods;
}
}
/**
* @attribute syn
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:995
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:995")
public String arrayTypeDescriptor() {
String arrayTypeDescriptor_value = constantPoolName();
return arrayTypeDescriptor_value;
}
/**
* @attribute syn
* @aspect VerificationTypes
* @declaredat /home/jesper/git/extendj/java4/backend/VerificationTypes.jrag:37
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="VerificationTypes", declaredAt="/home/jesper/git/extendj/java4/backend/VerificationTypes.jrag:37")
public TypeDecl supertype() {
TypeDecl supertype_value = superclass();
return supertype_value;
}
/**
* @attribute syn
* @aspect InnerClasses
* @declaredat /home/jesper/git/extendj/java4/backend/InnerClasses.jrag:76
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="InnerClasses", declaredAt="/home/jesper/git/extendj/java4/backend/InnerClasses.jrag:76")
public boolean hasMethod(MethodDecl decl) {
boolean hasMethod_MethodDecl_value = super.hasMethod(decl) || hasSuperclass() && superclass().hasMethod(decl);
return hasMethod_MethodDecl_value;
}
/**
* @attribute syn
* @aspect InnerClasses
* @declaredat /home/jesper/git/extendj/java4/backend/InnerClasses.jrag:480
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="InnerClasses", declaredAt="/home/jesper/git/extendj/java4/backend/InnerClasses.jrag:480")
public TypeDecl superEnclosing() {
TypeDecl superEnclosing_value = superclass().enclosing();
return superEnclosing_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 = "L" + constantPoolName() + ";";
if (state().inCircle()) {
typeDescriptor_computed = state().cycle();
} else {
typeDescriptor_computed = ASTState.NON_CYCLE;
}
return typeDescriptor_value;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:396
* @apilevel internal
*/
public SimpleSet Define_lookupType(ASTNode _callerNode, ASTNode _childNode, String name) {
if (_callerNode == getImplicitConstructorOptNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:535
return localLookupType(name);
}
else {
return super.Define_lookupType(_callerNode, _childNode, name);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:396
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute lookupType
*/
protected boolean canDefine_lookupType(ASTNode _callerNode, ASTNode _childNode, String name) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:555
* @apilevel internal
*/
public TypeDecl Define_enclosingType(ASTNode _callerNode, ASTNode _childNode) {
if (_callerNode == getImplicitConstructorOptNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:545
return this;
}
else {
return super.Define_enclosingType(_callerNode, _childNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:555
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute enclosingType
*/
protected boolean canDefine_enclosingType(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:658
* @apilevel internal
*/
public TypeDecl Define_hostType(ASTNode _callerNode, ASTNode _childNode) {
if (_callerNode == getImplementsListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:650
int childIndex = _callerNode.getIndexOfChild(_childNode);
return hostType();
}
else if (_callerNode == getSuperClassOptNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:649
return hostType();
}
else {
return super.Define_hostType(_callerNode, _childNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:658
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute hostType
*/
protected boolean canDefine_hostType(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36
* @apilevel internal
*/
public NameType Define_nameType(ASTNode _callerNode, ASTNode _childNode) {
if (_callerNode == getImplementsListNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:98
int childIndex = _callerNode.getIndexOfChild(_childNode);
return NameType.TYPE_NAME;
}
else if (_callerNode == getSuperClassOptNoTransform()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:97
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/java4/frontend/Modifiers.jrag:436
* @apilevel internal
*/
public boolean Define_mayBeFinal(ASTNode _callerNode, ASTNode _childNode) {
if (getModifiersNoTransform() != null && _callerNode == getModifiers()) {
// @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:311
return true;
}
else {
return super.Define_mayBeFinal(_callerNode, _childNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:436
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute mayBeFinal
*/
protected boolean canDefine_mayBeFinal(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/ExceptionHandling.jrag:382
{
java.util.Set contributors = _map.get(_root);
if (contributors == null) {
contributors = new java.util.LinkedHashSet();
_map.put((ASTNode) _root, contributors);
}
contributors.add(this);
}
// @declaredat /home/jesper/git/extendj/java4/frontend/AccessControl.jrag:184
{
java.util.Set contributors = _map.get(_root);
if (contributors == null) {
contributors = new java.util.LinkedHashSet();
_map.put((ASTNode) _root, contributors);
}
contributors.add(this);
}
// @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:351
{
java.util.Set contributors = _map.get(_root);
if (contributors == null) {
contributors = new java.util.LinkedHashSet();
_map.put((ASTNode) _root, contributors);
}
contributors.add(this);
}
// @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:123
if (!superclass().isUnknown() && superclass().isFinal()) {
{
java.util.Set contributors = _map.get(_root);
if (contributors == null) {
contributors = new java.util.LinkedHashSet();
_map.put((ASTNode) _root, contributors);
}
contributors.add(this);
}
}
super.collect_contributors_CompilationUnit_problems(_root, _map);
}
/** @apilevel internal */
protected void collect_contributors_TypeDecl_accessors(CompilationUnit _root, java.util.Map> _map) {
getImplicitConstructorOpt().collect_contributors_TypeDecl_accessors(_root, _map);
super.collect_contributors_TypeDecl_accessors(_root, _map);
}
/** @apilevel internal */
protected void contributeTo_CompilationUnit_problems(LinkedList collection) {
super.contributeTo_CompilationUnit_problems(collection);
for (Problem value : exceptionHandlingProblems()) {
collection.add(value);
}
for (Problem value : accessControlProblems()) {
collection.add(value);
}
for (Problem value : typeProblems()) {
collection.add(value);
}
if (!superclass().isUnknown() && superclass().isFinal()) {
collection.add(errorf("class %s may not extend final class %s", fullName(), superclass().fullName()));
}
}
}