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 CheckCompilationUnit

java.lang.Object
  extended byjavafe.tc.CheckCompilationUnit

public class CheckCompilationUnit
extends java.lang.Object

This module is responsible for handling CompilationUnit-level type checks.

In practice, these are mostly checks that the set of import declarations is legal.


Field Summary
private static ASTDecoration checkedField
          A new field for CompilationUnits: iff it is non-null then we have already checked that CompilationUnit.
 
Constructor Summary
CheckCompilationUnit()
           
 
Method Summary
static void checkCompilationUnit(CompilationUnit cu)
          Check a CompilationUnit.
private static void checkImports(CompilationUnit cu)
          Check a CompilationUnit to make sure that each import is individually well formed.
private static void checkPublic(CompilationUnit cu)
          Check a CompilationUnit to make sure that the only type that may be declared public in it is the one with the same name as the file it occurs in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

checkedField

private static ASTDecoration checkedField
A new field for CompilationUnits: iff it is non-null then we have already checked that CompilationUnit.

Constructor Detail

CheckCompilationUnit

public CheckCompilationUnit()
Method Detail

checkCompilationUnit

public static void checkCompilationUnit(CompilationUnit cu)
Check a CompilationUnit.

If this method is called multiple times on the same CompilationUnit, it has no effect the second and later times.

Precondition: cu must have already been loaded by OutsideEnv.

Any resulting errors or warnings are reported via ErrorSet.


checkPublic

private static void checkPublic(CompilationUnit cu)
Check a CompilationUnit to make sure that the only type that may be declared public in it is the one with the same name as the file it occurs in. Violations result in warnings only.


checkImports

private static void checkImports(CompilationUnit cu)
Check a CompilationUnit to make sure that each import is individually well formed.

In particular,

  • Type in single import must exist
  • Single imports from other packages must be public (not implemented)
  • Packages in all imports must be "accessible" (disabled)

This routine does not check legality of pairs of import statements or import statements and the types declared in the rest of the CompilationUnit.


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