Clover coverage report - DynamicJava Test Coverage (dynamicjava-20110903-r5436)
Coverage timestamp: Sat Sep 3 2011 03:02:20 CDT
file stats: LOC: 235   Methods: 37
NCLOC: 118   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DelegatingContext.java - 59.5% 59.5% 59.5%
coverage coverage
 1    package edu.rice.cs.dynamicjava.interpreter;
 2   
 3    import edu.rice.cs.plt.iter.IterUtil;
 4   
 5    import edu.rice.cs.dynamicjava.symbol.*;
 6    import edu.rice.cs.dynamicjava.symbol.type.Type;
 7    import edu.rice.cs.dynamicjava.symbol.type.ClassType;
 8    import edu.rice.cs.dynamicjava.symbol.type.VariableType;
 9   
 10    import static edu.rice.cs.plt.debug.DebugUtil.debug;
 11   
 12    /** An abstract context that delegates to an enclosing context by default. */
 13    public abstract class DelegatingContext implements TypeContext {
 14   
 15    private TypeContext _next;
 16   
 17  2901 protected DelegatingContext(TypeContext next) {
 18  2901 _next = next;
 19    }
 20   
 21    /** Create a copy of this context with the given context enclosing it. */
 22    protected abstract TypeContext duplicate(TypeContext next);
 23   
 24   
 25    /* PACKAGE AND IMPORT MANAGEMENT */
 26   
 27    /** Set the current package to the given package name */
 28  0 public TypeContext setPackage(String name) {
 29  0 return duplicate(_next.setPackage(name));
 30    }
 31   
 32    /** Import on demand all top-level classes in the given package */
 33  9 public TypeContext importTopLevelClasses(String pkg) {
 34  9 return duplicate(_next.importTopLevelClasses(pkg));
 35    }
 36   
 37    /** Import on demand all member classes of the given class */
 38  0 public TypeContext importMemberClasses(DJClass outer) {
 39  0 return duplicate(_next.importMemberClasses(outer));
 40    }
 41   
 42    /** Import on demand all static members of the given class */
 43  0 public TypeContext importStaticMembers(DJClass c) {
 44  0 return duplicate(_next.importStaticMembers(c));
 45    }
 46   
 47    /** Import the given top-level class */
 48  0 public TypeContext importTopLevelClass(DJClass c) {
 49  0 return duplicate(_next.importTopLevelClass(c));
 50    }
 51   
 52    /** Import the member class(es) of {@code outer} with the given name */
 53  0 public TypeContext importMemberClass(DJClass outer, String name) {
 54  0 return duplicate(_next.importMemberClass(outer, name));
 55    }
 56   
 57    /** Import the field(s) of {@code c} with the given name */
 58  0 public TypeContext importField(DJClass c, String name) {
 59  0 return duplicate(_next.importField(c, name));
 60    }
 61   
 62    /** Import the method(s) of {@code c} with the given name */
 63  0 public TypeContext importMethod(DJClass c, String name) {
 64  0 return duplicate(_next.importMethod(c, name));
 65    }
 66   
 67   
 68    /* TYPES: TOP-LEVEL CLASSES, MEMBER CLASSES, AND TYPE VARIABLES */
 69   
 70    /** Test whether {@code name} is an in-scope top-level class, member class, or type variable */
 71  131 public boolean typeExists(String name, TypeSystem ts) {
 72  131 return _next.typeExists(name, ts);
 73    }
 74   
 75    /** Test whether {@code name} is an in-scope top-level class */
 76  2056 public boolean topLevelClassExists(String name, TypeSystem ts) {
 77  2056 return _next.topLevelClassExists(name, ts);
 78    }
 79   
 80    /** Return the top-level class with the given name, or {@code null} if it does not exist. */
 81  11589 public DJClass getTopLevelClass(String name, TypeSystem ts) throws AmbiguousNameException {
 82  11589 return _next.getTopLevelClass(name, ts);
 83    }
 84   
 85    /** Test whether {@code name} is an in-scope member class */
 86  0 public boolean memberClassExists(String name, TypeSystem ts) {
 87  0 return _next.memberClassExists(name, ts);
 88    }
 89   
 90    /**
 91    * Return the most inner type containing a class with the given name, or {@code null}
 92    * if there is no such type.
 93    */
 94  4072 public ClassType typeContainingMemberClass(String name, TypeSystem ts) throws AmbiguousNameException {
 95  4072 return _next.typeContainingMemberClass(name, ts);
 96    }
 97   
 98    /** Test whether {@code name} is an in-scope type variable. */
 99  0 public boolean typeVariableExists(String name, TypeSystem ts) {
 100  0 return _next.typeVariableExists(name, ts);
 101    }
 102   
 103    /** Return the type variable with the given name, or {@code null} if it does not exist. */
 104  2137 public VariableType getTypeVariable(String name, TypeSystem ts) {
 105  2137 return _next.getTypeVariable(name, ts);
 106    }
 107   
 108   
 109    /* VARIABLES: FIELDS AND LOCAL VARIABLES */
 110   
 111    /** Test whether {@code name} is an in-scope field or local variable */
 112  265 public boolean variableExists(String name, TypeSystem ts) {
 113  265 return _next.variableExists(name, ts);
 114    }
 115   
 116    /** Test whether {@code name} is an in-scope field */
 117  377 public boolean fieldExists(String name, TypeSystem ts) {
 118  377 return _next.fieldExists(name, ts);
 119    }
 120   
 121    /**
 122    * Return the most inner type containing a field with the given name, or {@code null}
 123    * if there is no such type.
 124    */
 125  354 public ClassType typeContainingField(String name, TypeSystem ts) throws AmbiguousNameException {
 126  354 return _next.typeContainingField(name, ts);
 127    }
 128   
 129    /** Test whether {@code name} is an in-scope local variable */
 130  1362 public boolean localVariableExists(String name, TypeSystem ts) {
 131  1362 return _next.localVariableExists(name, ts);
 132    }
 133   
 134    /** Return the variable object for the given name, or {@code null} if it does not exist. */
 135  985 public LocalVariable getLocalVariable(String name, TypeSystem ts) {
 136  985 return _next.getLocalVariable(name, ts);
 137    }
 138   
 139   
 140    /* FUNCTIONS: METHODS AND LOCAL FUNCTIONS */
 141   
 142    /** Test whether {@code name} is an in-scope method or local function */
 143  0 public boolean functionExists(String name, TypeSystem ts) {
 144  0 return _next.functionExists(name, ts);
 145    }
 146   
 147    /** Test whether {@code name} is an in-scope method */
 148  0 public boolean methodExists(String name, TypeSystem ts) {
 149  0 return _next.methodExists(name, ts);
 150    }
 151   
 152    /**
 153    * Return the most inner type containing a method with the given name, or {@code null}
 154    * if there is no such type.
 155    */
 156  0 public Type typeContainingMethod(String name, TypeSystem ts) {
 157  0 return _next.typeContainingMethod(name, ts);
 158    }
 159   
 160    /** Test whether {@code name} is an in-scope local function */
 161  274 public boolean localFunctionExists(String name, TypeSystem ts) {
 162  274 return _next.localFunctionExists(name, ts);
 163    }
 164   
 165    /**
 166    * List all local functions that match the given name (empty if there are none). Overridden for
 167    * convenience, delegating to a trivial instance of
 168    * {@link #getLocalFunctions(String, TypeSystem, Iterable)}.
 169    */
 170  108 public final Iterable<LocalFunction> getLocalFunctions(String name, TypeSystem ts) {
 171  108 return getLocalFunctions(name, ts, IterUtil.<LocalFunction>empty());
 172    }
 173   
 174  382 public Iterable<LocalFunction> getLocalFunctions(String name, TypeSystem ts, Iterable<LocalFunction> partial) {
 175  382 return _next.getLocalFunctions(name, ts, partial);
 176    }
 177   
 178   
 179    /* MISC CONTEXTUAL INFORMATION */
 180   
 181  4485 public Access.Module accessModule() {
 182  4485 return _next.accessModule();
 183    }
 184   
 185    /** Return a full name for a class with the given name declared here. */
 186  158 public String makeClassName(String n) {
 187  158 return _next.makeClassName(n);
 188    }
 189   
 190    /** Return a full name for an anonymous class declared here. */
 191  0 public String makeAnonymousClassName() {
 192  0 return _next.makeAnonymousClassName();
 193    }
 194   
 195    /**
 196    * Return the class of {@code this} in the current context, or {@code null}
 197    * if there is no such value (for example, in a static context).
 198    */
 199  138 public DJClass getThis() {
 200  138 return _next.getThis();
 201    }
 202   
 203    /**
 204    * Return the class of {@code className.this} in the current context, or {@code null}
 205    * if there is no such value (for example, in a static context).
 206    */
 207  0 public DJClass getThis(String className) {
 208  0 return _next.getThis(className);
 209    }
 210   
 211  520 public DJClass getThis(Type expected, TypeSystem ts) { return _next.getThis(expected, ts); }
 212   
 213  0 public DJClass initializingClass() { return _next.initializingClass(); }
 214   
 215    /**
 216    * The expected type of a {@code return} statement in the given context, or {@code null}
 217    * if {@code return} statements should not appear here.
 218    */
 219  109 public Type getReturnType() {
 220  109 return _next.getReturnType();
 221    }
 222   
 223    /**
 224    * The types that are allowed to be thrown in the current context. If there is no
 225    * such declaration, the list will be empty.
 226    */
 227  1722 public Iterable<Type> getDeclaredThrownTypes() {
 228  1722 return _next.getDeclaredThrownTypes();
 229    }
 230   
 231  86 public ClassLoader getClassLoader() {
 232  86 return _next.getClassLoader();
 233    }
 234   
 235    }