| java.lang.Object edu.rice.cs.drjava.model.repl.DynamicJavaAdapter edu.rice.cs.drjava.model.repl.JavaDebugInterpreter
JavaDebugInterpreter | public class JavaDebugInterpreter extends DynamicJavaAdapter (Code) | | This class is an extension to DynamicJavaAdapter that allows us to process expressions involving the "this"
keyword correctly in the current debug interpreter context. This allows users to debug outer classes and their
fields using the usual Java syntax of outerclass.this. This is done by holding on to the class name of "this"
and by translating references to outer instance classes to field accesses in the form "this.this$N.this$N-1...".
This class is loaded in the Interpreter JVM, not the Main JVM.
(Do not use DrJava's config framework here.)
version: $Id: JavaDebugInterpreter.java 4255 2007-08-28 19:17:37Z mgricken $ |
Method Summary | |
protected QualifiedName | _convertThisToName(ThisExpression node) Helper method to convert a ThisExpression to a QualifiedName. | protected Expression | _convertThisToObjectFieldAccess(ThisExpression node) Helper method to convert a ThisExpression to a FieldAccess. | protected ObjectFieldAccess | _getObjectFieldAccessForField(String field, Context context) Given a field, looks at enclosing classes until it finds one that contains the field. | protected ObjectMethodCall | _getObjectMethodCallForFunction(MethodCall method, Context context) Given a method, looks at enclosing classes until it finds
one that contains the method. | protected ReferenceType | _getReferenceTypeForField(String field, Context context) Given the name of an not fully qualified outer class, return the fully qualified
ReferenceType that corresponds to that class. | protected StaticFieldAccess | _getStaticFieldAccessForField(String field, Context context) Given a field in a static context, looks at enclosing classes until it
finds one that contains the field. | protected StaticMethodCall | _getStaticMethodCallForFunction(MethodCall method, Context context) Given a method in a static context, looks at enclosing classes until it
finds one that contains the method. | protected ThisExpression | buildUnqualifiedThis() Builds a ThisExpression that has no class name. | public GlobalContext | makeGlobalContext(TreeInterpreter i) | public NameVisitor | makeNameVisitor(Context nameContext) Factory method to make a new NameChecker that tries to find the
right scope for QualifiedNames. | public IdentityVisitor | makeTranslationVisitor() | public AbstractTypeChecker | makeTypeChecker(Context context) Factory method to make a new TypeChecker that treats "this" as a variable. | public Node | processTree(Node node) Processes the tree before evaluating it. | protected void | setClassName(String className) Sets the class name of "this", parsing out the package name. | protected int | verifyClassName(String className) Checks if the className passed in is a valid className. | protected Expression | visitThis(ThisExpression node) Converts the ThisExpression to a QualifiedName
if it has no class name or an ObjectFieldAccess
if it does. |
_name | final protected String _name(Code) | | This interpreter's name.
|
_thisClassName | protected String _thisClassName(Code) | | The class name of the "this" object for the currently suspended thread.
|
_thisPackageName | protected String _thisPackageName(Code) | | The name of the package containing _this, if any.
|
_translationVisitor | protected IdentityVisitor _translationVisitor(Code) | | Extends IdentityVisitor to convert all instances of ThisExpressions in the tree to either QualifiedName or an
ObjectFieldAccess
|
JavaDebugInterpreter | public JavaDebugInterpreter(String name, String className)(Code) | | Creates a new debug interpreter.
Parameters: name - the name of the interpreter Parameters: className - the class name of the current context of "this" |
_convertThisToName | protected QualifiedName _convertThisToName(ThisExpression node)(Code) | | Helper method to convert a ThisExpression to a QualifiedName. Allows us to redefine "this" in a debug interpreter.
Parameters: node - ThisExpression corresponding QualifiedName |
_convertThisToObjectFieldAccess | protected Expression _convertThisToObjectFieldAccess(ThisExpression node)(Code) | | Helper method to convert a ThisExpression to a FieldAccess.
Allows us to access fields of outer classes in a debug interpreter.
Parameters: node - ThisExpression corresponding FieldAccess |
_getObjectFieldAccessForField | protected ObjectFieldAccess _getObjectFieldAccessForField(String field, Context context)(Code) | | Given a field, looks at enclosing classes until it finds one that contains the field. It returns the
ObjectFieldAccess that represents the field.
Parameters: field - the name of the field Parameters: context - the context the ObjectFieldAccess that represents the field or null if it cannot find the field in any enclosingclass. |
_getObjectMethodCallForFunction | protected ObjectMethodCall _getObjectMethodCallForFunction(MethodCall method, Context context)(Code) | | Given a method, looks at enclosing classes until it finds
one that contains the method. It returns the ObjectMethodCall
that represents the method.
Parameters: method - the method Parameters: context - the context the ObjectMethodCall that represents the method or nullif it cannot find the method in any enclosing class. |
_getReferenceTypeForField | protected ReferenceType _getReferenceTypeForField(String field, Context context)(Code) | | Given the name of an not fully qualified outer class, return the fully qualified
ReferenceType that corresponds to that class. This is called when the user
references a static field of an outer class.
Parameters: field - the name of the not fully qualified outer class Parameters: context - the context the ReferenceType that represents the field(in this case,really a class) or null if it cannot load the corresponding class in theclass loader. |
_getStaticFieldAccessForField | protected StaticFieldAccess _getStaticFieldAccessForField(String field, Context context)(Code) | | Given a field in a static context, looks at enclosing classes until it
finds one that contains the field. It returns the StaticFieldAccess
that represents the field.
Parameters: field - the name of the field Parameters: context - the context the StaticFieldAccess that represents the field or nullif it cannot find the field in any enclosing class. |
_getStaticMethodCallForFunction | protected StaticMethodCall _getStaticMethodCallForFunction(MethodCall method, Context context)(Code) | | Given a method in a static context, looks at enclosing classes until it
finds one that contains the method. It returns the StaticMethodCall
that represents the method.
Parameters: method - the method Parameters: context - the context the StaticMethodCall that represents the method or nullif it cannot find the method in any enclosing class. |
buildUnqualifiedThis | protected ThisExpression buildUnqualifiedThis()(Code) | | Builds a ThisExpression that has no class name.
an unqualified ThisExpression |
makeGlobalContext | public GlobalContext makeGlobalContext(TreeInterpreter i)(Code) | | |
makeNameVisitor | public NameVisitor makeNameVisitor(Context nameContext)(Code) | | Factory method to make a new NameChecker that tries to find the
right scope for QualifiedNames.
Parameters: nameContext - Context for the NameVisitor the visitor |
makeTranslationVisitor | public IdentityVisitor makeTranslationVisitor()(Code) | | Makes an anonymous IdentityVisitor that overrides
visit for a ThisExpresssion to convert it to
either a QualifiedName or an ObjectFieldAccess
|
makeTypeChecker | public AbstractTypeChecker makeTypeChecker(Context context)(Code) | | Factory method to make a new TypeChecker that treats "this" as a variable.
Parameters: context - the context visitor the visitor |
processTree | public Node processTree(Node node)(Code) | | Processes the tree before evaluating it. The translation visitor visits each node in the tree for the given
statement or expression and converts the necessary nodes.
Parameters: node - Tree to process |
setClassName | protected void setClassName(String className)(Code) | | Sets the class name of "this", parsing out the package name.
|
verifyClassName | protected int verifyClassName(String className)(Code) | | Checks if the className passed in is a valid className.
Parameters: className - the className of the ThisExpression the number of outer classes to walk out to |
visitThis | protected Expression visitThis(ThisExpression node)(Code) | | Converts the ThisExpression to a QualifiedName
if it has no class name or an ObjectFieldAccess
if it does.
Parameters: node - the expression to visit the converted form of the node |
Methods inherited from edu.rice.cs.drjava.model.repl.DynamicJavaAdapter | public void addBuildDirectoryClassPath(File path)(Code)(Java Doc) public void addExternalFilesClassPath(File path)(Code)(Java Doc) public void addExtraClassPath(File path)(Code)(Java Doc) public void addProjectClassPath(File path)(Code)(Java Doc) public void addProjectFilesClassPath(File path)(Code)(Java Doc) public void defineConstant(String name, Object value)(Code)(Java Doc) public void defineConstant(String name, boolean value)(Code)(Java Doc) public void defineConstant(String name, byte value)(Code)(Java Doc) public void defineConstant(String name, char value)(Code)(Java Doc) public void defineConstant(String name, double value)(Code)(Java Doc) public void defineConstant(String name, float value)(Code)(Java Doc) public void defineConstant(String name, int value)(Code)(Java Doc) public void defineConstant(String name, long value)(Code)(Java Doc) public void defineConstant(String name, short value)(Code)(Java Doc) public void defineVariable(String name, Object value, Class> type)(Code)(Java Doc) public void defineVariable(String name, Object value)(Code)(Java Doc) public void defineVariable(String name, boolean value)(Code)(Java Doc) public void defineVariable(String name, byte value)(Code)(Java Doc) public void defineVariable(String name, char value)(Code)(Java Doc) public void defineVariable(String name, double value)(Code)(Java Doc) public void defineVariable(String name, float value)(Code)(Java Doc) public void defineVariable(String name, int value)(Code)(Java Doc) public void defineVariable(String name, long value)(Code)(Java Doc) public void defineVariable(String name, short value)(Code)(Java Doc) public boolean getPrivateAccessible()(Code)(Java Doc) public Object getVariable(String name)(Code)(Java Doc) public Class> getVariableClass(String name)(Code)(Java Doc) public Object interpret(String s) throws ExceptionReturnedException(Code)(Java Doc) public EvaluationVisitor makeEvaluationVisitor(Context context)(Code)(Java Doc) public GlobalContext makeGlobalContext(TreeInterpreter i)(Code)(Java Doc) public NameVisitor makeNameVisitor(Context nameContext)(Code)(Java Doc) public List<Node> parse(String input)(Code)(Java Doc) public Node processTree(Node node)(Code)(Java Doc) public void setPackageScope(String packageName)(Code)(Java Doc) public void setPrivateAccessible(boolean accessible)(Code)(Java Doc)
|
|
|