polyglot.types
Class LoadedClassResolver

java.lang.Object
  extended by polyglot.types.ClassResolver
      extended by polyglot.types.LoadedClassResolver
All Implemented Interfaces:
Resolver, TopLevelResolver
Direct Known Subclasses:
SourceClassResolver

public class LoadedClassResolver
extends ClassResolver
implements TopLevelResolver

Loads class information from class files, or serialized class infomation from within class files. It does not load from source files.


Field Summary
protected static int COMPATIBLE
           
protected static int MINOR_NOT_COMPATIBLE
           
protected static int NOT_COMPATIBLE
           
 
Constructor Summary
LoadedClassResolver(TypeSystem ts, java.lang.String classpath, ClassFileLoader loader, Version version, boolean allowRawClasses)
          Create a loaded class resolver.
 
Method Summary
protected  int checkCompilerVersion(java.lang.String clazzVersion)
          Compare the encoded type's version against the loader's version.
 Named find(java.lang.String name)
          Find a type by name.
protected  ClassType getEncodedType(ClassFile clazz, java.lang.String name)
          Extract an encoded type from a class file.
protected  ClassFile loadFile(java.lang.String name)
          Load a class file for class name.
 boolean packageExists(java.lang.String name)
          Check if a package exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_COMPATIBLE

protected static final int NOT_COMPATIBLE
See Also:
Constant Field Values

MINOR_NOT_COMPATIBLE

protected static final int MINOR_NOT_COMPATIBLE
See Also:
Constant Field Values

COMPATIBLE

protected static final int COMPATIBLE
See Also:
Constant Field Values
Constructor Detail

LoadedClassResolver

public LoadedClassResolver(TypeSystem ts,
                           java.lang.String classpath,
                           ClassFileLoader loader,
                           Version version,
                           boolean allowRawClasses)
Create a loaded class resolver.

Parameters:
ts - The type system
classpath - The class path
loader - The class file loader to use.
version - The version of classes to load.
allowRawClasses - allow class files without encoded type information
Method Detail

packageExists

public boolean packageExists(java.lang.String name)
Description copied from interface: TopLevelResolver
Check if a package exists.

Specified by:
packageExists in interface TopLevelResolver

loadFile

protected ClassFile loadFile(java.lang.String name)
Load a class file for class name.


find

public Named find(java.lang.String name)
           throws SemanticException
Find a type by name.

Specified by:
find in interface Resolver
Specified by:
find in class ClassResolver
Throws:
SemanticException

getEncodedType

protected ClassType getEncodedType(ClassFile clazz,
                                   java.lang.String name)
                            throws SemanticException
Extract an encoded type from a class file.

Throws:
SemanticException

checkCompilerVersion

protected int checkCompilerVersion(java.lang.String clazzVersion)
Compare the encoded type's version against the loader's version.