ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

escjava.tc
Class GhostEnv

java.lang.Object
  extended byjavafe.tc.Env
      extended byjavafe.tc.EnvForTypeSig
          extended byescjava.tc.GhostEnv

public class GhostEnv
extends EnvForTypeSig

This class overrides EnvForTypeSig so that it "sees" ghost and model fields if FlowInsensitiveChecks.inAnnotation is true.


Field Summary
 
Fields inherited from class javafe.tc.EnvForTypeSig
parent, peer, staticContext
 
Fields inherited from class javafe.tc.Env
prefixSize, typeEnv, whereDecoration
 
Constructor Summary
GhostEnv(Env parent, TypeSig peer, boolean staticContext)
           
 
Method Summary
 Env asStaticContext()
          Returns a new Env that acts the same as us, except that its current instance (if any) is not accessible.
 void display()
          Display information about an Env to System.out.
 FieldDeclVec getFields(boolean allFields)
           
 FieldDecl getGhostField(java.lang.String n, FieldDecl excluded)
          Attempts to find a ghost or model field that belongs to us (including supertypes) with name n that is not equal to excluded, which may be null.
protected  boolean hasField(Identifier id)
          Override to make ghost fields visible if FlowInsensitiveChecks.inAnnotation is true.
static boolean isGhostField(FieldDecl field)
          Determines if a field is a ghost (not model or Java) field
static boolean isStatic(FieldDecl d)
           
 
Methods inherited from class javafe.tc.EnvForTypeSig
getEnclosingClass, getEnclosingInstance, hasMethod, isDuplicate, isStaticContext, locateFieldOrLocal, locateMethod, lookupSimpleTypeName
 
Methods inherited from class javafe.tc.Env
canAccessInstance, disambiguateExprName, disambiguateMethodName, disambiguateTypeOrFieldName, findTypeNamePrefix, getInferredThisExpr, getInnermostInstance, getObjectDesignator, lookupEnclosingInstance, lookupTypeName, processTypeNameAnnotations, resolveType, resolveTypeName, whereDeclared
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GhostEnv

public GhostEnv(Env parent,
                TypeSig peer,
                boolean staticContext)
Method Detail

asStaticContext

public Env asStaticContext()
Returns a new Env that acts the same as us, except that its current instance (if any) is not accessible.

Overrides:
asStaticContext in class EnvForTypeSig
Note:
This routine is somewhat inefficient and should be avoided unless an unknown environment needs to be coerced in this way.

display

public void display()
Display information about an Env to System.out. This function is intended only for debugging use.

Overrides:
display in class EnvForTypeSig

getGhostField

public FieldDecl getGhostField(java.lang.String n,
                               FieldDecl excluded)
Attempts to find a ghost or model field that belongs to us (including supertypes) with name n that is not equal to excluded, which may be null.

Parameters:
n - the name of the ghost field to get.
excluded - a field declaration to avoid.
Returns:
the ghost field declaration if successful, otherwise null.

isStatic

public static boolean isStatic(FieldDecl d)

isGhostField

public static boolean isGhostField(FieldDecl field)
Determines if a field is a ghost (not model or Java) field

Returns:
true if the FieldDecl field a ghost field (and not a model or Java field).

hasField

protected boolean hasField(Identifier id)
Override to make ghost fields visible if FlowInsensitiveChecks.inAnnotation is true.

Overrides:
hasField in class EnvForTypeSig

getFields

public FieldDeclVec getFields(boolean allFields)
Overrides:
getFields in class EnvForTypeSig

ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage