|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectDaikonVariableInfo
public abstract class DaikonVariableInfo
Each DaikonVariableInfo object is a node in the tree structure of the variables in the target application. The tree structure is built in the DeclWriter and traversed in the DTraceWriter. There is such a tree structure associated with every program point. This architecture makes it possible to avoid the issue of "traversal pattern duplication" in which both the DeclWriter and DTraceWriter must traverse the target application's variables identically. In general, the variable a will be the parent of the variables a.b and a.c in the tree, where b and c are fields in a's class. Each node can have any non-negative number of child nodes. DaikonVariableInfo is an abstract class. Its subtypes are designed to represent specific types of variables, such as arguments, arrays, etc.
| Field Summary | |
|---|---|
List<DaikonVariableInfo> |
children
The child nodes |
static String |
class_suffix
Suffix for "typeOf" variables that represent a class, eg, "foo.getClass()". |
protected static String |
classClassName
|
protected String |
compareInfoString
|
protected boolean |
declShouldPrint
True iff the DeclWriter should print this variable |
static boolean |
dkconfig_constant_infer
Enable experimental techniques on static constants. |
protected boolean |
dtraceShouldPrint
True iff the DTraceWriter should print this variable |
protected boolean |
dtraceShouldPrintChildren
True iff the DTraceWriter should print the children of this variable |
protected boolean |
isArray
True iff this variable is an array |
protected static Set<String> |
ppt_statics
Set of fully qualified static variable names for this ppt. |
protected String |
repTypeName
|
static boolean |
std_visibility
If false, use standard dfej behavior (any field in an instrumented class is visible) If true, use standard java behavior (if the field is in a class in a different package, it is only visible if public, etc.) |
protected static String |
stringClassName
|
protected String |
typeName
The three strings needed for the .decls info, in addition to the variable name are typeName, repTypeName, and compareInfoString. |
| Constructor Summary | |
|---|---|
DaikonVariableInfo(String theName)
Constructs a non-array type DaikonVariableInfo object |
|
DaikonVariableInfo(String theName,
boolean arr)
Constructs a DaikonVariableInfo object |
|
| Method Summary | |
|---|---|
protected void |
addChild(DaikonVariableInfo info)
Add a child to this node. |
protected void |
addChildNodes(ClassInfo cinfo,
Class<?> type,
String theName,
String offset,
int depthRemaining)
Explores the tree one level deeper (see DaikonVariableInfo). |
protected void |
addClassVars(ClassInfo cinfo,
boolean dontPrintInstanceVars,
Class<?> type,
String offset,
int depth)
Adds class variables (i.e., the fields) for the given type and attach new nodes as children of this node. |
protected DaikonVariableInfo |
addDeclVar(ClassInfo cinfo,
Class<?> type,
String name,
String offset,
int depth,
int argNum,
int param_offset)
Adds the decl info for a single parameter as a child of this node. |
protected DaikonVariableInfo |
addDeclVar(Field field,
String offset,
StringBuffer buf)
Adds the decl info for a single class variable (a field) as a child of this node. |
protected void |
addParameters(ClassInfo cinfo,
Member method,
List<String> argnames,
String offset,
int depth)
Add the parameters of the given method to this node. |
protected DaikonVariableInfo |
addPureMethodDecl(ClassInfo curClass,
MethodInfo minfo,
String offset,
int depth,
StringBuffer buf)
Adds the decl info for a pure method. |
DaikonVariableInfo |
array_child()
Returns the direct child that is an array, null if one does not exist |
protected void |
checkForDerivedVariables(Class<?> type,
String theName,
String offset)
Checks for "derived" Chicory variables: .class, .tostring, and java.util.List implementors and adds appropriate children to this node. |
protected void |
checkForListDecl(Class<?> type,
String theName,
String offset)
Determines if type implements list and prints associated decls, if necessary |
protected void |
checkForRuntimeClass(Class<?> type,
String theName,
String offset)
Checks the given type to see if it requires a .class addition to the decls file. |
int |
compareTo(DaikonVariableInfo dv)
Compares based on the name of the variable |
boolean |
declShouldPrint()
Return true iff the DeclWriter should print this node. |
boolean |
dTraceShouldPrint()
Return true iff the DTraceWriter should print this node. |
boolean |
dTraceShouldPrintChildren()
|
String |
get_const_val()
Returns the constant value of the variable. |
String |
get_relative_name()
Returns the name of this variable relative to its enclosing variable. |
EnumSet<VarFlags> |
get_var_flags()
Returns the variable flags for this variable. |
abstract VarKind |
get_var_kind()
Returns the kind of the variable (array, field, function, etc) |
String |
getCompareString()
Returns the comparability information for this variable. |
String |
getDTraceValueString(Object val)
Returns a String representation of this object suitable for a .dtrace file |
abstract Object |
getMyValFromParentVal(Object parentVal)
Given an object value corresponding to the parent of this DaikonVariableInfo variable, return the value (of the corresponding value in the target application) of this DaikonVariableInfo variable. |
String |
getName()
Returns the name of this variable. |
static String |
getRepName(Class<?> type,
boolean asArray)
Given a type, gets the representation type to be used in Daikon. |
String |
getRepTypeName()
Returns the representation type name of this variable. |
String |
getRepTypeNameOnly()
Return the rep type name without the constant value |
String |
getTypeName()
Returns the declared type name of this variable. |
String |
getTypeNameOnly()
Return the type name without aux information |
protected String |
getValueStringOfList(List<Object> theValues)
Returns a string representation of the values of a list of values as if it were an array. |
protected String |
getValueStringOfObjectWithMod(Object theValue,
boolean hashArray)
Gets the value of an object and concatenates the associated "modified" integer. |
static boolean |
implementsList(Class<?> type)
Returns true iff type implements the List interface. |
boolean |
isArray()
Returns whether or not this variable is an array |
static boolean |
isFieldVisible(Class<?> current,
Field field)
Returns whether or not the specified field is visible from the Class current. |
boolean |
isHashcode()
Returns whether or not this variable has a rep type of hashcode |
boolean |
isHashcodeArray()
|
boolean |
isInt()
Returns whether or not the declared type of this variable is int |
boolean |
isStatic()
Returns true iff the variable is static. |
Iterator<DaikonVariableInfo> |
iterator()
Return an iterator over all the node's children. |
protected static boolean |
shouldAddRuntimeClass(Class<?> type)
Determines if type needs a corresponding .class runtime class variable |
static String |
stdClassName(Class<?> type)
Returns the class name of the specified class in 'Java' format (i.e., as the class would have been declared in Java source code) |
static boolean |
systemClass(Class<?> type)
Returns whether or not the fields of the specified class should be included, based on whether the Class type is a system class or not. |
String |
toString()
Returns a string representation of this node. |
List<DaikonVariableInfo> |
tree_as_list()
Returns the complete tree of variables as a list |
String |
treeString()
Returns a string representative of this node and its children |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static boolean dkconfig_constant_infer
public List<DaikonVariableInfo> children
protected final boolean isArray
protected static final String classClassName
protected static final String stringClassName
public static final String class_suffix
protected String typeName
protected String repTypeName
protected String compareInfoString
protected boolean declShouldPrint
protected boolean dtraceShouldPrint
protected boolean dtraceShouldPrintChildren
public static boolean std_visibility
protected static Set<String> ppt_statics
| Constructor Detail |
|---|
public DaikonVariableInfo(String theName)
theName - The name of the variable
public DaikonVariableInfo(String theName,
boolean arr)
theName - The variable's namearr - True iff the variable is an array| Method Detail |
|---|
public String getName()
protected void addChild(DaikonVariableInfo info)
info - The child object, must be non-null. The child's
fields name, typeName, repTypeName, and compareInofString
should also be non-null.public String toString()
toString in class Objectpublic String treeString()
public Iterator<DaikonVariableInfo> iterator()
iterator in interface Iterable<DaikonVariableInfo>public List<DaikonVariableInfo> tree_as_list()
public abstract Object getMyValFromParentVal(Object parentVal)
parentVal - The parent object. Can be null for static fields.
(Are there any other circumstances where it can be null?)public String getDTraceValueString(Object val)
val - The object whose value to print
protected String getValueStringOfObjectWithMod(Object theValue,
boolean hashArray)
protected String getValueStringOfList(List<Object> theValues)
theValues - The values to print out
protected void addParameters(ClassInfo cinfo,
Member method,
List<String> argnames,
String offset,
int depth)
protected void addClassVars(ClassInfo cinfo,
boolean dontPrintInstanceVars,
Class<?> type,
String offset,
int depth)
protected DaikonVariableInfo addDeclVar(ClassInfo cinfo,
Class<?> type,
String name,
String offset,
int depth,
int argNum,
int param_offset)
protected DaikonVariableInfo addPureMethodDecl(ClassInfo curClass,
MethodInfo minfo,
String offset,
int depth,
StringBuffer buf)
protected DaikonVariableInfo addDeclVar(Field field,
String offset,
StringBuffer buf)
public static String stdClassName(Class<?> type)
public static String getRepName(Class<?> type,
boolean asArray)
type - The type of the variableasArray - Whether the variable is being output as an array (true) or as
a pointer (false).
protected static boolean shouldAddRuntimeClass(Class<?> type)
type - The variable's Type
public static boolean isFieldVisible(Class<?> current,
Field field)
protected void checkForDerivedVariables(Class<?> type,
String theName,
String offset)
protected void checkForListDecl(Class<?> type,
String theName,
String offset)
protected void checkForRuntimeClass(Class<?> type,
String theName,
String offset)
public static boolean implementsList(Class<?> type)
type -
protected void addChildNodes(ClassInfo cinfo,
Class<?> type,
String theName,
String offset,
int depthRemaining)
DaikonVariableInfo). This method adds child nodes to this node.
For example: "recurse" on a hashcode array object to print the
actual array of values or recurse on hashcode variable to print
its fields. Also accounts for derived variables (.class,
.tostring) and "recurses" on arrays (that is, adds a variable
to print out the arrays's elements as opposed to just the
hashcode of the array).
theName - The name of the variable currently being examined,
such as "ballCount"offset - The representation of the variables we have
previously examined. For examples, offset could
be "this." in which case offset + name would be
"this.ballCount."public static boolean systemClass(Class<?> type)
public String getTypeName()
public String getTypeNameOnly()
public String getRepTypeName()
public String getRepTypeNameOnly()
public String get_const_val()
public String getCompareString()
public boolean declShouldPrint()
public boolean dTraceShouldPrint()
public boolean dTraceShouldPrintChildren()
public int compareTo(DaikonVariableInfo dv)
compareTo in interface Comparable<DaikonVariableInfo>public boolean isArray()
public DaikonVariableInfo array_child()
public boolean isHashcode()
public boolean isHashcodeArray()
public boolean isInt()
public abstract VarKind get_var_kind()
public String get_relative_name()
public EnumSet<VarFlags> get_var_flags()
public boolean isStatic()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||