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

javafe.tc
Class SLResolution

java.lang.Object
  extended byjavafe.tc.SLResolution

public class SLResolution
extends java.lang.Object

This class is responsible for transitioning TypeSigs to the LINKSRESOLVED state from an earlier state.

So transitioning sig involves the following: (1) Ensuring that sig's CompilationUnit is checked. (See CheckCompilationUnit) (2) Resolving all sig's supertype names (see Env.resolveTypeName); these are the names mentioned in sig's TypeDecl's extends and implements clauses (if any). (3) Handling missing extends clauses for classes appropriately (E.g., inserting a reference to java.lang.Object, or null if (4)) (4) If sig is java.lang.Object, then we always set its superClass field to null. We check to make sure that the user did not try to make us extend a class other than us. (5) Transitioning all of sig's direct supertypes (the types resolved above) to at least the LINKSRESOLVED state. (6) Detecting loops in the inheritance/enclosing graph that would otherwise cause (5) to hang. It is a fatal error if we cannot resolve a supertype name or if we detect a cycle. Notes: - Checking whether sig's direct supertypes are accessible from sig is now done by the "prepping" stage. (This is necessary because access checking requires calling isSubTypeOf.) - No TypeSig is ever advanced beyond LINKSRESOLVED by this process. This fact depends on the control flow elsewhere in the javafe.tc package. In particular, Env.resolveTypeName obeys this requirement. - Exactly which TypeSigs will be moved to at least the LINKSRESOLVED stage is tricky to compute in advance because TypeName resolution may itself require enclosing TypeSigs to be transitioned to at least the LINKSRESOLVED stage. - In general, we try to transition to smallest number of TypeSigs we can to maximize the number of legal programs. (results in fewer cycles detected.)

See Also:
TypeSig, Env, CheckCompilationUnit

Constructor Summary
SLResolution()
           
 
Method Summary
static TypeSig handleSuperTypeName(TypeSig sig, TypeName superName)
          Handle a super type name.
static void transition(TypeSig sig)
          Transition sig to the supertype-links-resolved state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SLResolution

public SLResolution()
Method Detail

transition

public static void transition(TypeSig sig)
Transition sig to the supertype-links-resolved state.

See the SLResolution type's overall comments for details of what this involves.

A fatal error may be reported if we cannot resolve a supertype name, or detect a cycle in the type hierarchy.


handleSuperTypeName

public static TypeSig handleSuperTypeName(TypeSig sig,
                                          TypeName superName)
Handle a super type name.

We resolve the typename (a fatal error results if we cannot) then transition the resulting type to at least the LINKSRESOLVED stage. We return the TypeSig for the supertype.

sig is the TypeSig that superName names a supertype for.

Exception: if sig is java.lang.Object, then we do not try and transition its superclass.


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