soot.JastAddJ.ClassDecl Maven / Gradle / Ivy
/* This file was generated with JastAdd2 (http://jastadd.org) version R20130212 (r1031) */
package soot.JastAddJ;
import java.util.HashSet;
import java.io.File;
import java.util.*;
import beaver.*;
import java.util.ArrayList;
import java.util.zip.*;
import java.io.*;
import java.io.FileNotFoundException;
import java.util.Collection;
import soot.*;
import soot.util.*;
import soot.jimple.*;
import soot.coffi.ClassFile;
import soot.coffi.method_info;
import soot.coffi.CONSTANT_Utf8_info;
import soot.tagkit.SourceFileTag;
import soot.coffi.CoffiMethodSource;
/**
* @production ClassDecl : {@link ReferenceType} ::= {@link Modifiers} <ID:String> [SuperClassAccess:{@link Access}] Implements:{@link Access}* {@link BodyDecl}*;
* @ast node
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/java.ast:66
*/
public class ClassDecl extends ReferenceType implements Cloneable {
/**
* @apilevel low-level
*/
public void flushCache() {
super.flushCache();
interfacesMethodsSignatureMap_computed = false;
interfacesMethodsSignatureMap_value = null;
methodsSignatureMap_computed = false;
methodsSignatureMap_value = null;
ancestorMethods_String_values = null;
memberTypes_String_values = null;
memberFieldsMap_computed = false;
memberFieldsMap_value = null;
memberFields_String_values = null;
unimplementedMethods_computed = false;
unimplementedMethods_value = null;
hasAbstract_computed = false;
castingConversionTo_TypeDecl_values = null;
isString_computed = false;
isObject_computed = false;
instanceOf_TypeDecl_values = null;
isCircular_visited = -1;
isCircular_computed = false;
isCircular_initialized = false;
implementedInterfaces_computed = false;
implementedInterfaces_value = null;
subtype_TypeDecl_values = null;
sootClass_computed = false;
sootClass_value = null;
}
/**
* @apilevel internal
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/**
* @apilevel internal
*/
@SuppressWarnings({"unchecked", "cast"})
public ClassDecl clone() throws CloneNotSupportedException {
ClassDecl node = (ClassDecl)super.clone();
node.interfacesMethodsSignatureMap_computed = false;
node.interfacesMethodsSignatureMap_value = null;
node.methodsSignatureMap_computed = false;
node.methodsSignatureMap_value = null;
node.ancestorMethods_String_values = null;
node.memberTypes_String_values = null;
node.memberFieldsMap_computed = false;
node.memberFieldsMap_value = null;
node.memberFields_String_values = null;
node.unimplementedMethods_computed = false;
node.unimplementedMethods_value = null;
node.hasAbstract_computed = false;
node.castingConversionTo_TypeDecl_values = null;
node.isString_computed = false;
node.isObject_computed = false;
node.instanceOf_TypeDecl_values = null;
node.isCircular_visited = -1;
node.isCircular_computed = false;
node.isCircular_initialized = false;
node.implementedInterfaces_computed = false;
node.implementedInterfaces_value = null;
node.subtype_TypeDecl_values = null;
node.sootClass_computed = false;
node.sootClass_value = null;
node.in$Circle(false);
node.is$Final(false);
return node;
}
/**
* @apilevel internal
*/
@SuppressWarnings({"unchecked", "cast"})
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
*/
@SuppressWarnings({"unchecked", "cast"})
public ClassDecl fullCopy() {
ClassDecl tree = (ClassDecl) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
ASTNode child = (ASTNode) children[i];
if(child != null) {
child = child.fullCopy();
tree.setChild(child, i);
}
}
}
return tree;
}
/**
* @ast method
* @aspect AccessControl
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/AccessControl.jrag:147
*/
public void accessControl() {
super.accessControl();
// 8.1.1.2 final Classes
TypeDecl typeDecl = hasSuperclass() ? superclass() : null;
if(typeDecl != null && !typeDecl.accessibleFromExtend(this))
//if(typeDecl != null && !isCircular() && !typeDecl.accessibleFrom(this))
error("class " + fullName() + " may not extend non accessible type " + typeDecl.fullName());
if(hasSuperclass() && !superclass().accessibleFrom(this))
error("a superclass must be accessible which " + superclass().name() + " is not");
// 8.1.4
for(int i = 0; i < getNumImplements(); i++) {
TypeDecl decl = getImplements(i).type();
if(!decl.isCircular() && !decl.accessibleFrom(this))
error("class " + fullName() + " can not implement non accessible type " + decl.fullName());
}
}
/**
* @ast method
* @aspect ExceptionHandling
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/ExceptionHandling.jrag:106
*/
public void exceptionHandling() {
constructors();
super.exceptionHandling();
}
/**
* @ast method
* @aspect MemberMethods
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupMethod.jrag:265
*/
public Iterator interfacesMethodsIterator() {
return new Iterator() {
private Iterator outer = interfacesMethodsSignatureMap().values().iterator();
private Iterator inner = null;
public boolean hasNext() {
if((inner == null || !inner.hasNext()) && outer.hasNext())
inner = ((SimpleSet)outer.next()).iterator();
return inner == null ? false : inner.hasNext();
}
public Object next() {
return inner.next();
}
public void remove() { throw new UnsupportedOperationException(); }
};
}
/**
* @ast method
* @aspect Modifiers
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/Modifiers.jrag:96
*/
public void checkModifiers() {
super.checkModifiers();
// 8.1.1.2 final Classes
TypeDecl typeDecl = hasSuperclass() ? superclass() : null;
if(typeDecl != null && typeDecl.isFinal()) {
error("class " + fullName() + " may not extend final class " + typeDecl.fullName());
}
}
/**
* @ast method
* @aspect PrettyPrint
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:70
*/
public void toString(StringBuffer s) {
s.append(indent());
getModifiers().toString(s);
s.append("class " + name());
if(hasSuperClassAccess()) {
s.append(" extends ");
getSuperClassAccess().toString(s);
}
if(getNumImplements() > 0) {
s.append(" implements ");
getImplements(0).toString(s);
for(int i = 1; i < getNumImplements(); i++) {
s.append(", ");
getImplements(i).toString(s);
}
}
ppBodyDecls(s);
}
/**
* @ast method
* @aspect SuperClasses
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:596
*/
public boolean hasSuperclass() {
return !isObject();
}
/**
* @ast method
* @aspect SuperClasses
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:600
*/
public ClassDecl superclass() {
if(isObject())
return null;
if(hasSuperClassAccess() && !isCircular() && getSuperClassAccess().type().isClassDecl())
return (ClassDecl)getSuperClassAccess().type();
return (ClassDecl)typeObject();
}
/**
* @ast method
* @aspect SuperClasses
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:615
*/
public Iterator interfacesIterator() {
return new Iterator() {
public boolean hasNext() {
computeNextCurrent();
return current != null;
}
public Object next() {
return current;
}
public void remove() {
throw new UnsupportedOperationException();
}
private int index = 0;
private TypeDecl current = null;
private void computeNextCurrent() {
current = null;
if(isObject() || isCircular())
return;
while(index < getNumImplements()) {
TypeDecl typeDecl = getImplements(index++).type();
if(!typeDecl.isCircular() && typeDecl.isInterfaceDecl()) {
current = typeDecl;
return;
}
}
}
};
}
/**
* @ast method
* @aspect TypeHierarchyCheck
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeHierarchyCheck.jrag:239
*/
public void nameCheck() {
super.nameCheck();
if(hasSuperClassAccess() && !getSuperClassAccess().type().isClassDecl())
error("class may only inherit a class and not " + getSuperClassAccess().type().typeName());
if(isObject() && hasSuperClassAccess())
error("class Object may not have superclass");
if(isObject() && getNumImplements() != 0)
error("class Object may not implement interfaces");
// 8.1.3
if(isCircular())
error("circular inheritance dependency in " + typeName());
// 8.1.4
HashSet set = new HashSet();
for(int i = 0; i < getNumImplements(); i++) {
TypeDecl decl = getImplements(i).type();
if(!decl.isInterfaceDecl() && !decl.isUnknown())
error("type " + fullName() + " tries to implement non interface type " + decl.fullName());
if(set.contains(decl))
error("type " + decl.fullName() + " mentionened multiple times in implements clause");
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(Iterator i2 = s.iterator(); i2.hasNext(); ) {
MethodDecl n = (MethodDecl)i2.next();
if(n.accessibleFrom(this)) {
interfaceMethodCompatibleWithInherited(m, n);
}
}
if(s.isEmpty()) {
for(Iterator i2 = interfacesMethodsSignature(m.signature()).iterator(); i2.hasNext(); ) {
MethodDecl n = (MethodDecl)i2.next();
if(!n.mayOverrideReturn(m) && !m.mayOverrideReturn(n))
error("Xthe return type of method " + m.signature() + " in " + m.hostType().typeName() +
" does not match the return type of method " + n.signature() + " in " +
n.hostType().typeName() + " and may thus not be overriden");
}
}
}
}
}
/**
* @ast method
* @aspect TypeHierarchyCheck
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeHierarchyCheck.jrag:286
*/
private void interfaceMethodCompatibleWithInherited(MethodDecl m, MethodDecl n) {
if(n.isStatic())
error("Xa static method may not hide an instance method");
if(!n.isAbstract() && !n.isPublic())
error("Xoverriding access modifier error for " + m.signature() + " in " + m.hostType().typeName() + " and " + n.hostType().typeName());
if(!n.mayOverrideReturn(m) && !m.mayOverrideReturn(m))
error("Xthe return type of method " + m.signature() + " in " + m.hostType().typeName() +
" does not match the return type of method " + n.signature() + " in " +
n.hostType().typeName() + " and may thus not be overriden");
if(!n.isAbstract()) {
// n implements and overrides method m in the interface
// may not throw more checked exceptions
for(int i = 0; i < n.getNumException(); i++) {
Access e = n.getException(i);
boolean found = false;
for(int j = 0; !found && j < m.getNumException(); j++) {
if(e.type().instanceOf(m.getException(j).type()))
found = true;
}
if(!found && e.type().isUncheckedException())
error("X" + n.signature() + " in " + n.hostType().typeName() + " may not throw more checked exceptions than overridden method " +
m.signature() + " in " + m.hostType().typeName());
}
}
}
/**
* @ast method
* @aspect Generics
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/Generics.jrag:187
*/
public TypeDecl makeGeneric(Signatures.ClassSignature s) {
if(s.hasFormalTypeParameters()) {
ASTNode node = getParent();
int index = node.getIndexOfChild(this);
node.setChild(
new GenericClassDecl(
getModifiersNoTransform(),
getID(),
s.hasSuperclassSignature() ? new Opt(s.superclassSignature()) : getSuperClassAccessOptNoTransform(),
s.hasSuperinterfaceSignature() ? s.superinterfaceSignature() : getImplementsListNoTransform(),
getBodyDeclListNoTransform(),
s.typeParameters()
),
index
);
return (TypeDecl)node.getChildNoTransform(index);
}
else {
if(s.hasSuperclassSignature())
setSuperClassAccessOpt(new Opt(s.superclassSignature()));
if(s.hasSuperinterfaceSignature())
setImplementsList(s.superinterfaceSignature());
return this;
}
}
/**
* @ast method
* @aspect LookupParTypeDecl
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/Generics.jrag:1313
*/
public ClassDecl substitutedClassDecl(Parameterization parTypeDecl) {
ClassDecl c = new ClassDeclSubstituted(
(Modifiers)getModifiers().fullCopy(),
getID(),
hasSuperClassAccess() ? new Opt(getSuperClassAccess().type().substitute(parTypeDecl)) : new Opt(),
getImplementsList().substitute(parTypeDecl),
// ES: new List(),
this
);
return c;
}
/**
* @ast method
* @aspect EmitJimple
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/EmitJimple.jrag:163
*/
public void jimplify1phase2() {
SootClass sc = getSootClassDecl();
sc.setResolvingLevel(SootClass.DANGLING);
sc.setModifiers(sootTypeModifiers());
sc.setApplicationClass();
SourceFileTag st = new soot.tagkit.SourceFileTag(sourceNameWithoutPath());
st.setAbsolutePath(compilationUnit().pathName());
sc.addTag(st);
if(hasSuperclass()) {
sc.setSuperclass(superclass().getSootClassDecl());
}
for(Iterator iter = interfacesIterator(); iter.hasNext(); ) {
TypeDecl typeDecl = (TypeDecl)iter.next();
if(!sc.implementsInterface(typeDecl.getSootClassDecl().getName()))
sc.addInterface(typeDecl.getSootClassDecl());
}
if(isNestedType())
sc.setOuterClass(enclosingType().getSootClassDecl());
sc.setResolvingLevel(SootClass.HIERARCHY);
super.jimplify1phase2();
sc.setResolvingLevel(SootClass.SIGNATURES);
}
/**
* @ast method
*
*/
public ClassDecl() {
super();
}
/**
* Initializes the child array to the correct size.
* Initializes List and Opt nta children.
* @apilevel internal
* @ast method
* @ast method
*
*/
public void init$Children() {
children = new ASTNode[4];
setChild(new Opt(), 1);
setChild(new List(), 2);
setChild(new List(), 3);
}
/**
* @ast method
*
*/
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);
}
/**
* @ast method
*
*/
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
* @ast method
*
*/
protected int numChildren() {
return 4;
}
/**
* @apilevel internal
* @ast method
*
*/
public boolean mayHaveRewrite() {
return false;
}
/**
* Replaces the Modifiers child.
* @param node The new node to replace the Modifiers child.
* @apilevel high-level
* @ast method
*
*/
public void setModifiers(Modifiers node) {
setChild(node, 0);
}
/**
* Retrieves the Modifiers child.
* @return The current node used as the Modifiers child.
* @apilevel high-level
* @ast method
*
*/
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
* @ast method
*
*/
public Modifiers getModifiersNoTransform() {
return (Modifiers)getChildNoTransform(0);
}
/**
* Replaces the lexeme ID.
* @param value The new value for the lexeme ID.
* @apilevel high-level
* @ast method
*
*/
public void setID(String value) {
tokenString_ID = value;
}
/**
* JastAdd-internal setter for lexeme ID using the Beaver parser.
* @apilevel internal
* @ast method
*
*/
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
* @ast method
*
*/
public String getID() {
return tokenString_ID != null ? tokenString_ID : "";
}
/**
* Replaces the optional node for the SuperClassAccess child. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child!
* @param opt The new node to be used as the optional node for the SuperClassAccess child.
* @apilevel low-level
* @ast method
*
*/
public void setSuperClassAccessOpt(Opt opt) {
setChild(opt, 1);
}
/**
* Check whether the optional SuperClassAccess child exists.
* @return {@code true} if the optional SuperClassAccess child exists, {@code false} if it does not.
* @apilevel high-level
* @ast method
*
*/
public boolean hasSuperClassAccess() {
return getSuperClassAccessOpt().getNumChild() != 0;
}
/**
* Retrieves the (optional) SuperClassAccess child.
* @return The SuperClassAccess child, if it exists. Returns {@code null} otherwise.
* @apilevel low-level
* @ast method
*
*/
@SuppressWarnings({"unchecked", "cast"})
public Access getSuperClassAccess() {
return (Access)getSuperClassAccessOpt().getChild(0);
}
/**
* Replaces the (optional) SuperClassAccess child.
* @param node The new node to be used as the SuperClassAccess child.
* @apilevel high-level
* @ast method
*
*/
public void setSuperClassAccess(Access node) {
getSuperClassAccessOpt().setChild(node, 0);
}
/**
* @apilevel low-level
* @ast method
*
*/
@SuppressWarnings({"unchecked", "cast"})
public Opt getSuperClassAccessOpt() {
return (Opt)getChild(1);
}
/**
* Retrieves the optional node for child SuperClassAccess. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child!
* This method does not invoke AST transformations.
* @return The optional node for child SuperClassAccess.
* @apilevel low-level
* @ast method
*
*/
@SuppressWarnings({"unchecked", "cast"})
public Opt getSuperClassAccessOptNoTransform() {
return (Opt)getChildNoTransform(1);
}
/**
* Replaces the Implements list.
* @param list The new list node to be used as the Implements list.
* @apilevel high-level
* @ast method
*
*/
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
* @ast method
*
*/
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
* @ast method
*
*/
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
* @ast method
*
*/
@SuppressWarnings({"unchecked", "cast"})
public Access getImplements(int i) {
return (Access)getImplementsList().getChild(i);
}
/**
* Append an element to the Implements list.
* @param node The element to append to the Implements list.
* @apilevel high-level
* @ast method
*
*/
public void addImplements(Access node) {
List list = (parent == null || state == null) ? getImplementsListNoTransform() : getImplementsList();
list.addChild(node);
}
/**
* @apilevel low-level
* @ast method
*
*/
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
* @ast method
*
*/
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
* @ast method
*
*/
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
* @ast method
*
*/
public List getImplementssNoTransform() {
return getImplementsListNoTransform();
}
/**
* Retrieves the Implements list.
* @return The node representing the Implements list.
* @apilevel high-level
* @ast method
*
*/
@SuppressWarnings({"unchecked", "cast"})
public List getImplementsList() {
List list = (List)getChild(2);
list.getNumChild();
return list;
}
/**
* Retrieves the Implements list.
* This method does not invoke AST transformations.
* @return The node representing the Implements list.
* @apilevel low-level
* @ast method
*
*/
@SuppressWarnings({"unchecked", "cast"})
public List getImplementsListNoTransform() {
return (List)getChildNoTransform(2);
}
/**
* Replaces the BodyDecl list.
* @param list The new list node to be used as the BodyDecl list.
* @apilevel high-level
* @ast method
*
*/
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
* @ast method
*
*/
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
* @ast method
*
*/
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
* @ast method
*
*/
@SuppressWarnings({"unchecked", "cast"})
public BodyDecl getBodyDecl(int i) {
return (BodyDecl)getBodyDeclList().getChild(i);
}
/**
* Append an element to the BodyDecl list.
* @param node The element to append to the BodyDecl list.
* @apilevel high-level
* @ast method
*
*/
public void addBodyDecl(BodyDecl node) {
List list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList();
list.addChild(node);
}
/**
* @apilevel low-level
* @ast method
*
*/
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
* @ast method
*
*/
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
* @ast method
*
*/
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
* @ast method
*
*/
public List getBodyDeclsNoTransform() {
return getBodyDeclListNoTransform();
}
/**
* Retrieves the BodyDecl list.
* @return The node representing the BodyDecl list.
* @apilevel high-level
* @ast method
*
*/
@SuppressWarnings({"unchecked", "cast"})
public List getBodyDeclList() {
List list = (List)getChild(3);
list.getNumChild();
return list;
}
/**
* Retrieves the BodyDecl list.
* This method does not invoke AST transformations.
* @return The node representing the BodyDecl list.
* @apilevel low-level
* @ast method
*
*/
@SuppressWarnings({"unchecked", "cast"})
public List getBodyDeclListNoTransform() {
return (List)getChildNoTransform(3);
}
/**
* @ast method
* @aspect TypeConversion
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:84
*/
private boolean refined_TypeConversion_ClassDecl_castingConversionTo_TypeDecl(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);
}
/**
* @ast method
* @aspect Generics
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/Generics.jrag:57
*/
private boolean refined_Generics_ClassDecl_castingConversionTo_TypeDecl(TypeDecl type)
{
TypeDecl S = this;
TypeDecl T = type;
if(T instanceof TypeVariable) {
TypeVariable t = (TypeVariable)T;
if(t.getNumTypeBound() == 0) return true;
for(int i = 0; i < t.getNumTypeBound(); i++)
if(castingConversionTo(t.getTypeBound(i).type()))
return true;
return false;
}
if(T.isClassDecl() && (S.erasure() != S || T.erasure() != T))
return S.erasure().castingConversionTo(T.erasure());
return refined_TypeConversion_ClassDecl_castingConversionTo_TypeDecl(type);
}
/**
* @ast method
* @aspect EmitJimpleRefinements
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/SootJastAddJ/EmitJimpleRefinements.jrag:24
*/
private SootClass refined_EmitJimpleRefinements_ClassDecl_sootClass()
{
boolean needAddclass = false;
SootClass sc = null;
if(Scene.v().containsClass(jvmName())) {
SootClass cl = Scene.v().getSootClass(jvmName());
//fix for test case 653: if there's a class java.lang.Object etc. on the command line
//prefer that class over the Coffi class that may already have been loaded from bytecode
try {
MethodSource source = cl.getMethodByName("").getSource();
if(source instanceof CoffiMethodSource) {
Scene.v().removeClass(cl);
needAddclass = true;
}
} catch(RuntimeException e) {
//method not found
}
sc = cl;
}
else {
needAddclass = true;
}
if(needAddclass) {
if(options().verbose())
System.out.println("Creating from source " + jvmName());
sc = new SootClass(jvmName());
sc.setResolvingLevel(SootClass.DANGLING);
Scene.v().addClass(sc);
}
return sc;
}
/**
* @attribute syn
* @aspect ConstantExpression
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java7Frontend/ConstantExpression.jrag:160
*/
public Constant cast(Constant c) {
ASTNode$State state = state();
try { return Constant.create(c.stringValue()); }
finally {
}
}
/**
* @attribute syn
* @aspect ConstantExpression
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java7Frontend/ConstantExpression.jrag:226
*/
public Constant add(Constant c1, Constant c2) {
ASTNode$State state = state();
try { return Constant.create(c1.stringValue() + c2.stringValue()); }
finally {
}
}
/**
* @attribute syn
* @aspect ConstantExpression
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java7Frontend/ConstantExpression.jrag:290
*/
public Constant questionColon(Constant cond, Constant c1, Constant c2) {
ASTNode$State state = state();
try { return Constant.create(cond.booleanValue() ? c1.stringValue() : c2.stringValue()); }
finally {
}
}
/**
* @attribute syn
* @aspect ConstantExpression
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java7Frontend/ConstantExpression.jrag:394
*/
public boolean eqIsTrue(Expr left, Expr right) {
ASTNode$State state = state();
try { return isString() && left.constant().stringValue().equals(right.constant().stringValue()); }
finally {
}
}
/**
* @attribute syn
* @aspect ErrorCheck
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/ErrorCheck.jrag:22
*/
public int lineNumber() {
ASTNode$State state = state();
try { return getLine(IDstart); }
finally {
}
}
/**
* @attribute syn
* @aspect ConstructScope
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupConstructor.jrag:21
*/
public Collection lookupSuperConstructor() {
ASTNode$State state = state();
try { return hasSuperclass() ? superclass().constructors() : Collections.EMPTY_LIST; }
finally {
}
}
/**
* @attribute syn
* @aspect ImplicitConstructor
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupConstructor.jrag:207
*/
public boolean noConstructor() {
ASTNode$State state = state();
try {
if(!compilationUnit().fromSource())
return false;
for(int i = 0; i < getNumBodyDecl(); i++)
if(getBodyDecl(i) instanceof ConstructorDecl)
return false;
return true;
}
finally {
}
}
/**
* @attribute syn
* @aspect MemberMethods
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupMethod.jrag:280
*/
public SimpleSet interfacesMethodsSignature(String signature) {
ASTNode$State state = state();
try {
SimpleSet set = (SimpleSet)interfacesMethodsSignatureMap().get(signature);
if(set != null) return set;
return SimpleSet.emptySet;
}
finally {
}
}
/**
* @apilevel internal
*/
protected boolean interfacesMethodsSignatureMap_computed = false;
/**
* @apilevel internal
*/
protected HashMap interfacesMethodsSignatureMap_value;
/**
* @attribute syn
* @aspect MemberMethods
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupMethod.jrag:286
*/
@SuppressWarnings({"unchecked", "cast"})
public HashMap interfacesMethodsSignatureMap() {
if(interfacesMethodsSignatureMap_computed) {
return interfacesMethodsSignatureMap_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
interfacesMethodsSignatureMap_value = interfacesMethodsSignatureMap_compute();
if(isFinal && num == state().boundariesCrossed) interfacesMethodsSignatureMap_computed = true;
return interfacesMethodsSignatureMap_value;
}
/**
* @apilevel internal
*/
private HashMap interfacesMethodsSignatureMap_compute() {
HashMap map = new HashMap();
for(Iterator iter = interfacesIterator(); iter.hasNext(); ) {
TypeDecl typeDecl = (InterfaceDecl)iter.next();
for(Iterator i2 = typeDecl.methodsIterator(); i2.hasNext(); ) {
MethodDecl m = (MethodDecl)i2.next();
putSimpleSetElement(map, m.signature(), m);
}
}
return map;
}
/**
* @apilevel internal
*/
protected boolean methodsSignatureMap_computed = false;
/**
* @apilevel internal
*/
protected HashMap methodsSignatureMap_value;
/**
* @attribute syn
* @aspect MethodSignature15
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/MethodSignature.jrag:359
*/
@SuppressWarnings({"unchecked", "cast"})
public HashMap methodsSignatureMap() {
if(methodsSignatureMap_computed) {
return methodsSignatureMap_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
methodsSignatureMap_value = methodsSignatureMap_compute();
if(isFinal && num == state().boundariesCrossed) methodsSignatureMap_computed = true;
return methodsSignatureMap_value;
}
/**
* @apilevel internal
*/
private HashMap methodsSignatureMap_compute() {
HashMap map = new HashMap(localMethodsSignatureMap());
if(hasSuperclass()) {
for(Iterator iter = superclass().methodsIterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl)iter.next();
if(!m.isPrivate() && m.accessibleFrom(this) && !localMethodsSignatureMap().containsKey(m.signature())) {
if(!(m instanceof MethodDeclSubstituted) || !localMethodsSignatureMap().containsKey(m.sourceMethodDecl().signature()))
putSimpleSetElement(map, m.signature(), m);
}
}
}
for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) {
TypeDecl typeDecl = (TypeDecl)outerIter.next();
for(Iterator iter = typeDecl.methodsIterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl)iter.next();
if(!m.isPrivate() && m.accessibleFrom(this) && !localMethodsSignatureMap().containsKey(m.signature())) {
if(!(m instanceof MethodDeclSubstituted) || !localMethodsSignatureMap().containsKey(m.sourceMethodDecl().signature())) {
if(allMethodsAbstract((SimpleSet)map.get(m.signature())) &&
(!(m instanceof MethodDeclSubstituted) ||
allMethodsAbstract((SimpleSet)map.get(m.sourceMethodDecl().signature())) )
)
putSimpleSetElement(map, m.signature(), m);
}
}
}
}
return map;
}
protected java.util.Map ancestorMethods_String_values;
/**
* @attribute syn
* @aspect AncestorMethods
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupMethod.jrag:380
*/
@SuppressWarnings({"unchecked", "cast"})
public SimpleSet ancestorMethods(String signature) {
Object _parameters = signature;
if(ancestorMethods_String_values == null) ancestorMethods_String_values = new java.util.HashMap(4);
if(ancestorMethods_String_values.containsKey(_parameters)) {
return (SimpleSet)ancestorMethods_String_values.get(_parameters);
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
SimpleSet ancestorMethods_String_value = ancestorMethods_compute(signature);
if(isFinal && num == state().boundariesCrossed) ancestorMethods_String_values.put(_parameters, ancestorMethods_String_value);
return ancestorMethods_String_value;
}
/**
* @apilevel internal
*/
private SimpleSet ancestorMethods_compute(String signature) {
SimpleSet set = SimpleSet.emptySet;
if(hasSuperclass()) {
for(Iterator iter = superclass().localMethodsSignature(signature).iterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl)iter.next();
if(!m.isPrivate())
set = set.add(m);
}
}
if(set.size() != 1 || ((MethodDecl)set.iterator().next()).isAbstract()) {
for(Iterator iter = interfacesMethodsSignature(signature).iterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl)iter.next();
set = set.add(m);
}
}
if(!hasSuperclass()) return set;
if(set.size() == 1) {
MethodDecl m = (MethodDecl)set.iterator().next();
if(!m.isAbstract()) {
boolean done = true;
for(Iterator iter = superclass().ancestorMethods(signature).iterator(); iter.hasNext(); ) {
MethodDecl n = (MethodDecl)iter.next();
if(n.isPrivate() || !n.accessibleFrom(m.hostType()))
done = false;
}
if(done) return set;
}
}
for(Iterator iter = superclass().ancestorMethods(signature).iterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl)iter.next();
set = set.add(m);
}
return set;
}
protected java.util.Map memberTypes_String_values;
/**
* @attribute syn
* @aspect TypeScopePropagation
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupType.jrag:498
*/
@SuppressWarnings({"unchecked", "cast"})
public SimpleSet memberTypes(String name) {
Object _parameters = name;
if(memberTypes_String_values == null) memberTypes_String_values = new java.util.HashMap(4);
if(memberTypes_String_values.containsKey(_parameters)) {
return (SimpleSet)memberTypes_String_values.get(_parameters);
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
SimpleSet memberTypes_String_value = memberTypes_compute(name);
if(isFinal && num == state().boundariesCrossed) memberTypes_String_values.put(_parameters, memberTypes_String_value);
return memberTypes_String_value;
}
/**
* @apilevel internal
*/
private SimpleSet memberTypes_compute(String name) {
SimpleSet set = localTypeDecls(name);
if(!set.isEmpty()) return set;
for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) {
TypeDecl type = (TypeDecl)outerIter.next();
for(Iterator iter = type.memberTypes(name).iterator(); iter.hasNext(); ) {
TypeDecl decl = (TypeDecl)iter.next();
if(!decl.isPrivate() && decl.accessibleFrom(this))
set = set.add(decl);
}
}
if(hasSuperclass()) {
for(Iterator iter = superclass().memberTypes(name).iterator(); iter.hasNext(); ) {
TypeDecl decl = (TypeDecl)iter.next();
if(!decl.isPrivate() && decl.accessibleFrom(this)) {
set = set.add(decl);
}
}
}
return set;
}
/**
* @apilevel internal
*/
protected boolean memberFieldsMap_computed = false;
/**
* @apilevel internal
*/
protected HashMap memberFieldsMap_value;
/**
* @attribute syn
* @aspect Fields
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupVariable.jrag:283
*/
@SuppressWarnings({"unchecked", "cast"})
public HashMap memberFieldsMap() {
if(memberFieldsMap_computed) {
return memberFieldsMap_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
memberFieldsMap_value = memberFieldsMap_compute();
if(isFinal && num == state().boundariesCrossed) memberFieldsMap_computed = true;
return memberFieldsMap_value;
}
/**
* @apilevel internal
*/
private HashMap memberFieldsMap_compute() {
HashMap map = new HashMap(localFieldsMap());
if(hasSuperclass()) {
for(Iterator iter = superclass().fieldsIterator(); iter.hasNext(); ) {
FieldDeclaration decl = (FieldDeclaration)iter.next();
if(!decl.isPrivate() && decl.accessibleFrom(this) && !localFieldsMap().containsKey(decl.name()))
putSimpleSetElement(map, decl.name(), decl);
}
}
for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) {
TypeDecl type = (TypeDecl)outerIter.next();
for(Iterator iter = type.fieldsIterator(); iter.hasNext(); ) {
FieldDeclaration decl = (FieldDeclaration)iter.next();
if(!decl.isPrivate() && decl.accessibleFrom(this) && !localFieldsMap().containsKey(decl.name()))
putSimpleSetElement(map, decl.name(), decl);
}
}
return map;
}
protected java.util.Map memberFields_String_values;
/**
* @attribute syn
* @aspect Fields
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupVariable.jrag:334
*/
@SuppressWarnings({"unchecked", "cast"})
public SimpleSet memberFields(String name) {
Object _parameters = name;
if(memberFields_String_values == null) memberFields_String_values = new java.util.HashMap(4);
if(memberFields_String_values.containsKey(_parameters)) {
return (SimpleSet)memberFields_String_values.get(_parameters);
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
SimpleSet memberFields_String_value = memberFields_compute(name);
if(isFinal && num == state().boundariesCrossed) memberFields_String_values.put(_parameters, memberFields_String_value);
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()) {
for(Iterator iter = superclass().memberFields(name).iterator(); iter.hasNext(); ) {
FieldDeclaration decl = (FieldDeclaration)iter.next();
if(!decl.isPrivate() && decl.accessibleFrom(this))
fields = fields.add(decl);
}
}
for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) {
TypeDecl type = (TypeDecl)outerIter.next();
for(Iterator iter = type.memberFields(name).iterator(); iter.hasNext(); ) {
FieldDeclaration decl = (FieldDeclaration)iter.next();
if(!decl.isPrivate() && decl.accessibleFrom(this))
fields = fields.add(decl);
}
}
return fields;
}
/**
* @apilevel internal
*/
protected boolean unimplementedMethods_computed = false;
/**
* @apilevel internal
*/
protected Collection unimplementedMethods_value;
/**
* @attribute syn
* @aspect Modifiers
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/Modifiers.jrag:17
*/
@SuppressWarnings({"unchecked", "cast"})
public Collection unimplementedMethods() {
if(unimplementedMethods_computed) {
return unimplementedMethods_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
unimplementedMethods_value = unimplementedMethods_compute();
if(isFinal && num == state().boundariesCrossed) unimplementedMethods_computed = true;
return unimplementedMethods_value;
}
/**
* @apilevel internal
*/
private Collection unimplementedMethods_compute() {
Collection c = new ArrayList();
for(Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl)iter.next();
boolean implemented = false;
SimpleSet set = (SimpleSet)localMethodsSignature(m.signature());
if(set.size() == 1) {
MethodDecl n = (MethodDecl)set.iterator().next();
if(!n.isAbstract())
implemented = true;
}
if(!implemented) {
set = (SimpleSet)ancestorMethods(m.signature());
for(Iterator i2 = set.iterator(); i2.hasNext(); ) {
MethodDecl n = (MethodDecl)i2.next();
if(!n.isAbstract()) {
implemented = true;
break;
}
}
}
if(!implemented) {
c.add(m);
}
}
if(hasSuperclass()) {
for(Iterator iter = superclass().unimplementedMethods().iterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl)iter.next();
SimpleSet set = (SimpleSet)localMethodsSignature(m.signature());
if(set.size() == 1) {
MethodDecl n = (MethodDecl)set.iterator().next();
if(n.isAbstract() || !n.overrides(m))
c.add(m);
}
else
c.add(m);
}
}
for(Iterator iter = localMethodsIterator(); iter.hasNext(); ) {
MethodDecl m = (MethodDecl)iter.next();
if(m.isAbstract()) {
c.add(m);
}
}
return c;
}
/**
* @apilevel internal
*/
protected boolean hasAbstract_computed = false;
/**
* @apilevel internal
*/
protected boolean hasAbstract_value;
/**
* @attribute syn
* @aspect Modifiers
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/Modifiers.jrag:66
*/
@SuppressWarnings({"unchecked", "cast"})
public boolean hasAbstract() {
if(hasAbstract_computed) {
return hasAbstract_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
hasAbstract_value = hasAbstract_compute();
if(isFinal && num == state().boundariesCrossed) hasAbstract_computed = true;
return hasAbstract_value;
}
/**
* @apilevel internal
*/
private boolean hasAbstract_compute() { return !unimplementedMethods().isEmpty(); }
protected java.util.Map castingConversionTo_TypeDecl_values;
/**
* @attribute syn
* @aspect AutoBoxing
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/AutoBoxing.jrag:134
*/
@SuppressWarnings({"unchecked", "cast"})
public boolean castingConversionTo(TypeDecl type) {
Object _parameters = type;
if(castingConversionTo_TypeDecl_values == null) castingConversionTo_TypeDecl_values = new java.util.HashMap(4);
if(castingConversionTo_TypeDecl_values.containsKey(_parameters)) {
return ((Boolean)castingConversionTo_TypeDecl_values.get(_parameters)).booleanValue();
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
boolean castingConversionTo_TypeDecl_value = castingConversionTo_compute(type);
if(isFinal && num == state().boundariesCrossed) castingConversionTo_TypeDecl_values.put(_parameters, Boolean.valueOf(castingConversionTo_TypeDecl_value));
return castingConversionTo_TypeDecl_value;
}
/**
* @apilevel internal
*/
private boolean castingConversionTo_compute(TypeDecl type) {
if(refined_Generics_ClassDecl_castingConversionTo_TypeDecl(type))
return true;
boolean canUnboxThis = !unboxed().isUnknown();
boolean canUnboxType = !type.unboxed().isUnknown();
if(canUnboxThis && !canUnboxType)
return unboxed().wideningConversionTo(type);
return false;
/*
else if(unboxingConversionTo(type))
return true;
return false;
*/
}
/**
* @attribute syn
* @aspect TypeAnalysis
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:209
*/
public boolean isClassDecl() {
ASTNode$State state = state();
try { return true; }
finally {
}
}
/**
* @apilevel internal
*/
protected boolean isString_computed = false;
/**
* @apilevel internal
*/
protected boolean isString_value;
/**
* @attribute syn
* @aspect TypeAnalysis
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:225
*/
@SuppressWarnings({"unchecked", "cast"})
public boolean isString() {
if(isString_computed) {
return isString_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
isString_value = isString_compute();
if(isFinal && num == state().boundariesCrossed) isString_computed = true;
return isString_value;
}
/**
* @apilevel internal
*/
private boolean isString_compute() { return fullName().equals("java.lang.String"); }
/**
* @apilevel internal
*/
protected boolean isObject_computed = false;
/**
* @apilevel internal
*/
protected boolean isObject_value;
/**
* @attribute syn
* @aspect TypeAnalysis
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:228
*/
@SuppressWarnings({"unchecked", "cast"})
public boolean isObject() {
if(isObject_computed) {
return isObject_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
isObject_value = isObject_compute();
if(isFinal && num == state().boundariesCrossed) isObject_computed = true;
return isObject_value;
}
/**
* @apilevel internal
*/
private boolean isObject_compute() { return name().equals("Object") && packageName().equals("java.lang"); }
protected java.util.Map instanceOf_TypeDecl_values;
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:387
*/
@SuppressWarnings({"unchecked", "cast"})
public boolean instanceOf(TypeDecl type) {
Object _parameters = type;
if(instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new java.util.HashMap(4);
if(instanceOf_TypeDecl_values.containsKey(_parameters)) {
return ((Boolean)instanceOf_TypeDecl_values.get(_parameters)).booleanValue();
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
boolean instanceOf_TypeDecl_value = instanceOf_compute(type);
if(isFinal && num == state().boundariesCrossed) instanceOf_TypeDecl_values.put(_parameters, Boolean.valueOf(instanceOf_TypeDecl_value));
return instanceOf_TypeDecl_value;
}
/**
* @apilevel internal
*/
private boolean instanceOf_compute(TypeDecl type) { return subtype(type); }
/**
* @attribute syn
* @aspect TypeWideningAndIdentity
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:423
*/
public boolean isSupertypeOfClassDecl(ClassDecl type) {
ASTNode$State state = state();
try {
if(super.isSupertypeOfClassDecl(type))
return true;
return type.hasSuperclass() && type.superclass() != null && type.superclass().instanceOf(this);
}
finally {
}
}
/**
* @attribute syn
* @aspect TypeWideningAndIdentity
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:440
*/
public boolean isSupertypeOfInterfaceDecl(InterfaceDecl type) {
ASTNode$State state = state();
try { return isObject(); }
finally {
}
}
/**
* @attribute syn
* @aspect TypeWideningAndIdentity
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:453
*/
public boolean isSupertypeOfArrayDecl(ArrayDecl type) {
ASTNode$State state = state();
try {
if(super.isSupertypeOfArrayDecl(type))
return true;
return type.hasSuperclass() && type.superclass() != null && type.superclass().instanceOf(this);
}
finally {
}
}
/**
* @attribute syn
* @aspect NestedTypes
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:534
*/
public boolean isInnerClass() {
ASTNode$State state = state();
try { return isNestedType() && !isStatic() && enclosingType().isClassDecl(); }
finally {
}
}
/**
* @apilevel internal
*/
protected int isCircular_visited = -1;
/**
* @apilevel internal
*/
protected boolean isCircular_computed = false;
/**
* @apilevel internal
*/
protected boolean isCircular_initialized = false;
/**
* @apilevel internal
*/
protected boolean isCircular_value;
/**
* @attribute syn
* @aspect Circularity
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:677
*/
@SuppressWarnings({"unchecked", "cast"})
public boolean isCircular() {
if(isCircular_computed) {
return isCircular_value;
}
ASTNode$State state = state();
if (!isCircular_initialized) {
isCircular_initialized = true;
isCircular_value = true;
}
if (!state.IN_CIRCLE) {
state.IN_CIRCLE = true;
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
do {
isCircular_visited = state.CIRCLE_INDEX;
state.CHANGE = false;
boolean new_isCircular_value = isCircular_compute();
if (new_isCircular_value!=isCircular_value)
state.CHANGE = true;
isCircular_value = new_isCircular_value;
state.CIRCLE_INDEX++;
} while (state.CHANGE);
if(isFinal && num == state().boundariesCrossed) {
isCircular_computed = true;
}
else {
state.RESET_CYCLE = true;
isCircular_compute();
state.RESET_CYCLE = false;
isCircular_computed = false;
isCircular_initialized = false;
}
state.IN_CIRCLE = false;
return isCircular_value;
}
if(isCircular_visited != state.CIRCLE_INDEX) {
isCircular_visited = state.CIRCLE_INDEX;
if (state.RESET_CYCLE) {
isCircular_computed = false;
isCircular_initialized = false;
isCircular_visited = -1;
return isCircular_value;
}
boolean new_isCircular_value = isCircular_compute();
if (new_isCircular_value!=isCircular_value)
state.CHANGE = true;
isCircular_value = new_isCircular_value;
return isCircular_value;
}
return isCircular_value;
}
/**
* @apilevel internal
*/
private boolean isCircular_compute() {
if(hasSuperClassAccess()) {
Access a = getSuperClassAccess().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 Annotations
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/Annotations.jrag:225
*/
public Annotation annotation(TypeDecl typeDecl) {
ASTNode$State state = state();
try {
Annotation a = super.annotation(typeDecl);
if(a != null) return a;
if(hasSuperclass()) {
// If the queried annotation is itself annotation with @Inherited then
// delegate the query to the superclass
if(typeDecl.annotation(lookupType("java.lang.annotation", "Inherited")) != null)
return superclass().annotation(typeDecl);
}
return null;
}
finally {
}
}
/**
* @apilevel internal
*/
protected boolean implementedInterfaces_computed = false;
/**
* @apilevel internal
*/
protected HashSet implementedInterfaces_value;
/**
* @attribute syn
* @aspect GenericsTypeCheck
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/Generics.jrag:400
*/
@SuppressWarnings({"unchecked", "cast"})
public HashSet implementedInterfaces() {
if(implementedInterfaces_computed) {
return implementedInterfaces_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
implementedInterfaces_value = implementedInterfaces_compute();
if(isFinal && num == state().boundariesCrossed) implementedInterfaces_computed = true;
return implementedInterfaces_value;
}
/**
* @apilevel internal
*/
private HashSet implementedInterfaces_compute() {
HashSet set = new HashSet();
if(hasSuperclass())
set.addAll(superclass().implementedInterfaces());
for(Iterator iter = interfacesIterator(); iter.hasNext(); ) {
InterfaceDecl decl = (InterfaceDecl)iter.next();
set.add(decl);
set.addAll(decl.implementedInterfaces());
}
return set;
}
protected java.util.Map subtype_TypeDecl_values;
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:407
*/
@SuppressWarnings({"unchecked", "cast"})
public boolean subtype(TypeDecl type) {
Object _parameters = type;
if(subtype_TypeDecl_values == null) subtype_TypeDecl_values = new java.util.HashMap(4);
ASTNode$State.CircularValue _value;
if(subtype_TypeDecl_values.containsKey(_parameters)) {
Object _o = subtype_TypeDecl_values.get(_parameters);
if(!(_o instanceof ASTNode$State.CircularValue)) {
return ((Boolean)_o).booleanValue();
}
else
_value = (ASTNode$State.CircularValue)_o;
}
else {
_value = new ASTNode$State.CircularValue();
subtype_TypeDecl_values.put(_parameters, _value);
_value.value = Boolean.valueOf(true);
}
ASTNode$State state = state();
if (!state.IN_CIRCLE) {
state.IN_CIRCLE = true;
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
boolean new_subtype_TypeDecl_value;
do {
_value.visited = new Integer(state.CIRCLE_INDEX);
state.CHANGE = false;
new_subtype_TypeDecl_value = subtype_compute(type);
if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) {
state.CHANGE = true;
_value.value = Boolean.valueOf(new_subtype_TypeDecl_value);
}
state.CIRCLE_INDEX++;
} while (state.CHANGE);
if(isFinal && num == state().boundariesCrossed) {
subtype_TypeDecl_values.put(_parameters, new_subtype_TypeDecl_value);
}
else {
subtype_TypeDecl_values.remove(_parameters);
state.RESET_CYCLE = true;
subtype_compute(type);
state.RESET_CYCLE = false;
}
state.IN_CIRCLE = false;
return new_subtype_TypeDecl_value;
}
if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) {
_value.visited = new Integer(state.CIRCLE_INDEX);
boolean new_subtype_TypeDecl_value = subtype_compute(type);
if (state.RESET_CYCLE) {
subtype_TypeDecl_values.remove(_parameters);
}
else if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) {
state.CHANGE = true;
_value.value = new_subtype_TypeDecl_value;
}
return new_subtype_TypeDecl_value;
}
return ((Boolean)_value.value).booleanValue();
}
/**
* @apilevel internal
*/
private boolean subtype_compute(TypeDecl type) { return type.supertypeClassDecl(this); }
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:421
*/
public boolean supertypeClassDecl(ClassDecl type) {
ASTNode$State state = state();
try { return super.supertypeClassDecl(type) ||
type.hasSuperclass() && type.superclass() != null && type.superclass().subtype(this); }
finally {
}
}
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:437
*/
public boolean supertypeInterfaceDecl(InterfaceDecl type) {
ASTNode$State state = state();
try { return isObject(); }
finally {
}
}
/**
* @attribute syn
* @aspect GenericsSubtype
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:450
*/
public boolean supertypeArrayDecl(ArrayDecl type) {
ASTNode$State state = state();
try {
if(super.supertypeArrayDecl(type))
return true;
return type.hasSuperclass() && type.superclass() != null && type.superclass().subtype(this);
}
finally {
}
}
/**
* @attribute syn
* @aspect InnerClasses
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Backend/InnerClasses.jrag:430
*/
public TypeDecl superEnclosing() {
ASTNode$State state = state();
try {
return superclass().erasure().enclosing();
}
finally {
}
}
/**
* @apilevel internal
*/
protected boolean sootClass_computed = false;
/**
* @apilevel internal
*/
protected SootClass sootClass_value;
/**
* @attribute syn
* @aspect IncrementalJimple
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/SootJastAddJ/IncrementalJimple.jrag:35
*/
@SuppressWarnings({"unchecked", "cast"})
public SootClass sootClass() {
if(sootClass_computed) {
return sootClass_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
sootClass_value = sootClass_compute();
if(isFinal && num == state().boundariesCrossed) sootClass_computed = true;
return sootClass_value;
}
/**
* @apilevel internal
*/
private SootClass sootClass_compute() {
if(!Scene.v().isIncrementalBuild()) {
return refined_EmitJimpleRefinements_ClassDecl_sootClass();
}
if(Scene.v().containsClass(jvmName())) {
Scene.v().removeClass(Scene.v().getSootClass(jvmName()));
}
SootClass sc = null;
if(options().verbose())
System.out.println("Creating from source " + jvmName());
sc = new SootClass(jvmName());
sc.setResolvingLevel(SootClass.DANGLING);
Scene.v().addClass(sc);
return sc;
}
/**
* @attribute syn
* @aspect AnnotationsCodegen
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/AnnotationsCodegen.jrag:322
*/
public String typeDescriptor() {
ASTNode$State state = state();
try { return "L" + jvmName().replace('.', '/') + ";"; }
finally {
}
}
/**
* @attribute syn
* @aspect GenericsCodegen
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/GenericsCodegen.jrag:333
*/
public SimpleSet bridgeCandidates(String signature) {
ASTNode$State state = state();
try {
SimpleSet set = ancestorMethods(signature);
for(Iterator iter = interfacesMethodsSignature(signature).iterator(); iter.hasNext(); )
set = set.add(iter.next());
return set;
}
finally {
}
}
/**
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/Modifiers.jrag:259
* @apilevel internal
*/
public boolean Define_boolean_mayBeFinal(ASTNode caller, ASTNode child) {
if(caller == getModifiersNoTransform()) {
return true;
}
else { return super.Define_boolean_mayBeFinal(caller, child);
}
}
/**
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/SyntacticClassification.jrag:74
* @apilevel internal
*/
public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) {
if(caller == getImplementsListNoTransform()) {
int childIndex = caller.getIndexOfChild(child);
return NameType.TYPE_NAME;
}
else if(caller == getSuperClassAccessOptNoTransform()) {
return NameType.TYPE_NAME;
}
else { return super.Define_NameType_nameType(caller, child);
}
}
/**
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:579
* @apilevel internal
*/
public TypeDecl Define_TypeDecl_hostType(ASTNode caller, ASTNode child) {
if(caller == getImplementsListNoTransform()) {
int childIndex = caller.getIndexOfChild(child);
return hostType();
}
else if(caller == getSuperClassAccessOptNoTransform()) {
return hostType();
}
else { return super.Define_TypeDecl_hostType(caller, child);
}
}
/**
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/Annotations.jrag:276
* @apilevel internal
*/
public boolean Define_boolean_withinSuppressWarnings(ASTNode caller, ASTNode child, String s) {
if(caller == getImplementsListNoTransform()) {
int childIndex = caller.getIndexOfChild(child);
return hasAnnotationSuppressWarnings(s) || withinSuppressWarnings(s);
}
else if(caller == getSuperClassAccessOptNoTransform()) {
return hasAnnotationSuppressWarnings(s) || withinSuppressWarnings(s);
}
else { return super.Define_boolean_withinSuppressWarnings(caller, child, s);
}
}
/**
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/Annotations.jrag:377
* @apilevel internal
*/
public boolean Define_boolean_withinDeprecatedAnnotation(ASTNode caller, ASTNode child) {
if(caller == getImplementsListNoTransform()) {
int childIndex = caller.getIndexOfChild(child);
return isDeprecated() || withinDeprecatedAnnotation();
}
else if(caller == getSuperClassAccessOptNoTransform()) {
return isDeprecated() || withinDeprecatedAnnotation();
}
else { return super.Define_boolean_withinDeprecatedAnnotation(caller, child);
}
}
/**
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/Generics.jrag:269
* @apilevel internal
*/
public boolean Define_boolean_inExtendsOrImplements(ASTNode caller, ASTNode child) {
if(caller == getImplementsListNoTransform()) {
int i = caller.getIndexOfChild(child);
return true;
}
else if(caller == getSuperClassAccessOptNoTransform()) {
return true;
}
else { return getParent().Define_boolean_inExtendsOrImplements(this, caller);
}
}
/**
* @apilevel internal
*/
public ASTNode rewriteTo() {
return super.rewriteTo();
}
}