soot.JastAddJ.SuperAccess Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of soot Show documentation
Show all versions of soot Show documentation
A Java Optimization Framework
/* 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 SuperAccess : {@link Access} ::= <ID:String>;
* @ast node
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/java.ast:28
*/
public class SuperAccess extends Access implements Cloneable {
/**
* @apilevel low-level
*/
public void flushCache() {
super.flushCache();
decl_computed = false;
decl_value = null;
type_computed = false;
type_value = null;
}
/**
* @apilevel internal
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/**
* @apilevel internal
*/
@SuppressWarnings({"unchecked", "cast"})
public SuperAccess clone() throws CloneNotSupportedException {
SuperAccess node = (SuperAccess)super.clone();
node.decl_computed = false;
node.decl_value = null;
node.type_computed = false;
node.type_value = null;
node.in$Circle(false);
node.is$Final(false);
return node;
}
/**
* @apilevel internal
*/
@SuppressWarnings({"unchecked", "cast"})
public SuperAccess copy() {
try {
SuperAccess node = (SuperAccess) 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 SuperAccess fullCopy() {
SuperAccess tree = (SuperAccess) 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 PrettyPrint
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:506
*/
public void toString(StringBuffer s) {
s.append("super");
}
/**
* @ast method
* @aspect TypeHierarchyCheck
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeHierarchyCheck.jrag:87
*/
public void nameCheck() {
if(isQualified()) {
if(!hostType().isInnerTypeOf(decl()) && hostType() != decl())
error("qualified super must name an enclosing type");
if(inStaticContext()) {
error("*** Qualified super may not occur in static context");
}
}
// 8.8.5.1
if(inExplicitConstructorInvocation() && hostType().instanceOf(decl().hostType()) )
error("super may not be accessed in an explicit constructor invocation");
// 8.4.3.2
if(inStaticContext())
error("super may not be accessed in a static context");
}
/**
* @ast method
* @aspect Expressions
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/Expressions.jrag:424
*/
public soot.Value eval(Body b) {
return emitThis(b, decl());
}
/**
* @ast method
*
*/
public SuperAccess() {
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() {
}
/**
* @ast method
*
*/
public SuperAccess(String p0) {
setID(p0);
}
/**
* @ast method
*
*/
public SuperAccess(beaver.Symbol p0) {
setID(p0);
}
/**
* @apilevel low-level
* @ast method
*
*/
protected int numChildren() {
return 0;
}
/**
* @apilevel internal
* @ast method
*
*/
public boolean mayHaveRewrite() {
return false;
}
/**
* 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;
}
/**
* @apilevel internal
* @ast method
*
*/
/**
* @apilevel internal
*/
protected String tokenString_ID;
/**
* @ast method
*
*/
public int IDstart;
/**
* @ast method
*
*/
public int IDend;
/**
* 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 : "";
}
/**
* @ast method
* @aspect TypeScopePropagation
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupType.jrag:251
*/
private TypeDecl refined_TypeScopePropagation_SuperAccess_decl()
{ return isQualified() ? qualifier().type() : hostType(); }
/**
* @attribute syn
* @aspect TypeScopePropagation
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/LookupType.jrag:249
*/
public SimpleSet decls() {
ASTNode$State state = state();
try { return SimpleSet.emptySet; }
finally {
}
}
/**
* @apilevel internal
*/
protected boolean decl_computed = false;
/**
* @apilevel internal
*/
protected TypeDecl decl_value;
/**
* @attribute syn
* @aspect GenericsTypeAnalysis
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/Generics.jrag:326
*/
@SuppressWarnings({"unchecked", "cast"})
public TypeDecl decl() {
if(decl_computed) {
return decl_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
decl_value = decl_compute();
if(isFinal && num == state().boundariesCrossed) decl_computed = true;
return decl_value;
}
/**
* @apilevel internal
*/
private TypeDecl decl_compute() {
TypeDecl typeDecl = refined_TypeScopePropagation_SuperAccess_decl();
if(typeDecl instanceof ParTypeDecl)
typeDecl = ((ParTypeDecl)typeDecl).genericDecl();
return typeDecl;
}
/**
* @attribute syn
* @aspect AccessTypes
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/ResolveAmbiguousNames.jrag:25
*/
public boolean isSuperAccess() {
ASTNode$State state = state();
try { return true; }
finally {
}
}
/**
* @attribute syn
* @aspect SyntacticClassification
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/SyntacticClassification.jrag:56
*/
public NameType predNameType() {
ASTNode$State state = state();
try { return NameType.TYPE_NAME; }
finally {
}
}
/**
* @apilevel internal
*/
protected boolean type_computed = false;
/**
* @apilevel internal
*/
protected TypeDecl type_value;
/**
* @attribute syn
* @aspect TypeAnalysis
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:288
*/
@SuppressWarnings({"unchecked", "cast"})
public TypeDecl type() {
if(type_computed) {
return type_value;
}
ASTNode$State state = state();
int num = state.boundariesCrossed;
boolean isFinal = this.is$Final();
type_value = type_compute();
if(isFinal && num == state().boundariesCrossed) type_computed = true;
return type_value;
}
/**
* @apilevel internal
*/
private TypeDecl type_compute() {
TypeDecl typeDecl = decl();
if(!typeDecl.isClassDecl())
return unknownType();
ClassDecl classDecl = (ClassDecl)typeDecl;
if(!classDecl.hasSuperclass())
return unknownType();
return classDecl.superclass();
}
/**
* @attribute inh
* @aspect TypeHierarchyCheck
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeHierarchyCheck.jrag:124
*/
@SuppressWarnings({"unchecked", "cast"})
public boolean inExplicitConstructorInvocation() {
ASTNode$State state = state();
boolean inExplicitConstructorInvocation_value = getParent().Define_boolean_inExplicitConstructorInvocation(this, null);
return inExplicitConstructorInvocation_value;
}
/**
* @apilevel internal
*/
public ASTNode rewriteTo() {
return super.rewriteTo();
}
}