|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object polyglot.ext.jl.types.TypeSystem_c
public class TypeSystem_c
TypeSystem_c Overview: A TypeSystem_c is a universe of types, including all Java types.
Nested Class Summary | |
---|---|
protected class |
TypeSystem_c.MostSpecificComparator
Class to handle the comparisons; dispatches to moreSpecific method. |
Field Summary | |
---|---|
protected Flags |
ACCESS_FLAGS
All possible access flags. |
protected PrimitiveType |
BOOLEAN_
|
protected PrimitiveType |
BYTE_
|
protected PrimitiveType |
CHAR_
|
protected ClassType |
CLASS_
|
protected Flags |
CONSTRUCTOR_FLAGS
All flags allowed for a constructor. |
protected LazyClassInitializer |
defaultClassInit
|
protected PrimitiveType |
DOUBLE_
|
protected Flags |
FIELD_FLAGS
All flags allowed for a field. |
protected java.util.Map |
flagsForName
|
protected PrimitiveType |
FLOAT_
|
protected Flags |
INITIALIZER_FLAGS
All flags allowed for an initializer block. |
protected PrimitiveType |
INT_
|
protected LoadedClassResolver |
loadedResolver
|
protected Flags |
LOCAL_CLASS_FLAGS
All flags allowed for a local class. |
protected Flags |
LOCAL_FLAGS
All flags allowed for a local variable. |
protected PrimitiveType |
LONG_
|
protected Flags |
MEMBER_CLASS_FLAGS
All flags allowed for a member class. |
protected Flags |
METHOD_FLAGS
All flags allowed for a method. |
protected NullType |
NULL_
|
protected ClassType |
OBJECT_
|
protected TableResolver |
parsedResolver
|
protected PrimitiveType |
SHORT_
|
protected ClassType |
STRING_
|
protected TopLevelResolver |
systemResolver
|
protected ClassType |
THROWABLE_
|
protected Flags |
TOP_LEVEL_CLASS_FLAGS
All flags allowed for a top-level class. |
protected UnknownPackage |
unknownPackage
|
protected UnknownQualifier |
unknownQualifier
|
protected UnknownType |
unknownType
|
protected PrimitiveType |
VOID_
|
Constructor Summary | |
---|---|
TypeSystem_c()
|
Method Summary | |
---|---|
Flags |
Abstract()
|
protected java.util.List |
abstractSuperInterfaces(ReferenceType rt)
Utility method to gather all the superclasses and interfaces of ct that may contain abstract methods that must be
implemented by ct . |
protected boolean |
accessibleFromPackage(Flags flags,
Package pkg1,
Package pkg2)
Return true if a member (in an accessible container) or a top-level class with access flags flags
in package pkg1 is accessible from package
pkg2 . |
ClassType |
ArithmeticException()
java.lang.ArithmeticException |
ArrayType |
arrayOf(Position pos,
Type type)
Return an array of type |
ArrayType |
arrayOf(Position pos,
Type type,
int dims)
Return a dims -array of type |
ArrayType |
arrayOf(Type type)
Returns a type identical to |
ArrayType |
arrayOf(Type type,
int dims)
Return a dims -array of type |
ClassType |
ArrayStoreException()
java.lang.ArrayStoreException |
protected ArrayType |
arrayType(Position pos,
Type type)
Factory method for ArrayTypes. |
protected void |
assert_(java.util.Collection l)
|
protected void |
assert_(TypeObject o)
|
PrimitiveType |
Boolean()
boolean |
PrimitiveType |
Byte()
byte |
boolean |
callValid(ProcedureInstance prototype,
java.util.List argTypes)
Return true if pi can be called with
actual parameters of types actualTypes . |
boolean |
canCoerceToString(Type t,
Context c)
Returns true iff the type t can be coerced to a String in the given Context. |
boolean |
canOverride(MethodInstance mi,
MethodInstance mj)
Return true if mi can override mj . |
PrimitiveType |
Char()
char |
void |
checkAccessFlags(Flags f)
Assert if the flags f are legal access flags. |
void |
checkClassConformance(ClassType ct)
Assert that ct implements all abstract methods required;
that is, if it is a concrete class, then it must implement all
interfaces and abstract methods that it or it's superclasses declare, and if
it is an abstract class then any methods that it overrides are overridden
correctly. |
void |
checkConstructorFlags(Flags f)
Assert if the flags f are legal constructor flags. |
void |
checkCycles(ReferenceType goal)
Assert that t has no cycles in the super type+nested class
graph starting at t . |
protected void |
checkCycles(ReferenceType curr,
ReferenceType goal)
|
void |
checkFieldFlags(Flags f)
Assert if the flags f are legal field flags. |
void |
checkInitializerFlags(Flags f)
Assert if the flags f are legal initializer flags. |
void |
checkLocalClassFlags(Flags f)
Assert if the flags f are legal local class flags. |
void |
checkLocalFlags(Flags f)
Assert if the flags f are legal local variable flags. |
void |
checkMemberClassFlags(Flags f)
Assert if the flags f are legal member class flags. |
void |
checkMethodFlags(Flags f)
Assert if the flags f are legal method flags. |
void |
checkOverride(MethodInstance mi,
MethodInstance mj)
Throw a SemanticException if mi cannot override
mj . |
void |
checkTopLevelClassFlags(Flags f)
Assert if the flags f are legal top-level class flags. |
ClassType |
Class()
java.lang.Class |
protected boolean |
classAccessible(ClassType targetClass,
ClassType contextClass)
True if the class targetClass accessible from the body of class contextClass. |
boolean |
classAccessible(ClassType targetClass,
Context context)
True if the class targetClass accessible from the context. |
boolean |
classAccessibleFromPackage(ClassType targetClass,
Package pkg)
True if the class targetClass accessible from the package pkg. |
ClassType |
ClassCastException()
java.lang.ClassCastException |
Resolver |
classContextResolver(ClassType type)
Get a resolver for looking up a type in a class context. |
ClassType |
Cloneable()
java.lang.Cloneable |
ConstructorInstance |
constructorInstance(Position pos,
ClassType container,
Flags flags,
java.util.List argTypes,
java.util.List excTypes)
Create a constructor instance. |
ParsedClassType |
createClassType()
Create a new empty class. |
ParsedClassType |
createClassType(LazyClassInitializer init)
Create a new empty class. |
ParsedClassType |
createClassType(LazyClassInitializer init,
Source fromSource)
Create a new empty class. |
ParsedClassType |
createClassType(Source fromSource)
Create a new empty class. |
Context |
createContext()
Create a new context object for looking up variables, types, etc. |
Flags |
createNewFlag(java.lang.String name,
Flags after)
Create a new unique Flags object. |
protected NullType |
createNull()
|
Package |
createPackage(Package prefix,
java.lang.String name)
Return a package by name with the given outer package. |
Package |
createPackage(java.lang.String name)
Return a package by name. |
protected PrimitiveType |
createPrimitive(PrimitiveType.Kind kind)
|
LazyClassInitializer |
defaultClassInitializer()
The default lazy class initializer. |
ConstructorInstance |
defaultConstructor(Position pos,
ClassType container)
Create a default constructor instance. |
java.util.List |
defaultPackageImports()
Return a list of the packages names that will be imported by default. |
boolean |
descendsFrom(Type child,
Type ancestor)
Returns true iff child and ancestor are distinct reference types, and child descends from ancestor. |
PrimitiveType |
Double()
double |
boolean |
equals(TypeObject type1,
TypeObject type2)
Returns true iff type1 and type2 represent the same type object. |
ClassType |
Error()
java.lang.Error |
ClassType |
Exception()
java.lang.Exception |
FieldInstance |
fieldInstance(Position pos,
ReferenceType container,
Flags flags,
Type type,
java.lang.String name)
Create a field instance. |
Flags |
Final()
|
protected java.util.List |
findAcceptableConstructors(ClassType container,
java.util.List argTypes,
ClassType currClass)
Populates the list acceptable with those MethodInstances which are Applicable and Accessible as defined by JLS 15.11.2.1 |
protected java.util.List |
findAcceptableMethods(ReferenceType container,
java.lang.String name,
java.util.List argTypes,
ClassType currClass)
Populates the list acceptable with those MethodInstances which are Applicable and Accessible as defined by JLS 15.11.2.1 |
ConstructorInstance |
findConstructor(ClassType container,
java.util.List argTypes,
ClassType currClass)
Find a constructor. |
ConstructorInstance |
findConstructor(ClassType container,
java.util.List argTypes,
Context c)
Deprecated. |
FieldInstance |
findField(ReferenceType container,
java.lang.String name)
Returns the FieldInstance for the field name defined
in type container or a supertype. |
FieldInstance |
findField(ReferenceType container,
java.lang.String name,
ClassType currClass)
Returns the FieldInstance for the field name defined
in type container or a supertype, and visible from
currClass . |
FieldInstance |
findField(ReferenceType container,
java.lang.String name,
Context c)
Deprecated. |
protected java.util.Set |
findFields(ReferenceType container,
java.lang.String name)
Returns a set of fields named name defined
in type container or a supertype. |
ClassType |
findMemberClass(ClassType container,
java.lang.String name)
Find a member class. |
ClassType |
findMemberClass(ClassType container,
java.lang.String name,
ClassType currClass)
Find a member class. |
ClassType |
findMemberClass(ClassType container,
java.lang.String name,
Context c)
Deprecated. |
java.util.Set |
findMemberClasses(ClassType container,
java.lang.String name)
|
MethodInstance |
findMethod(ReferenceType container,
java.lang.String name,
java.util.List argTypes,
ClassType currClass)
Requires: all type arguments are canonical. |
MethodInstance |
findMethod(ReferenceType container,
java.lang.String name,
java.util.List argTypes,
Context c)
Deprecated. |
protected java.util.Collection |
findMostSpecificProcedures(java.util.List acceptable,
ReferenceType container,
java.util.List argTypes,
ClassType currClass)
|
protected ProcedureInstance |
findProcedure(java.util.List acceptable,
ReferenceType container,
java.util.List argTypes,
ClassType currClass)
|
Flags |
flagsForBits(int bits)
Given the JVM encoding of a set of flags, returns the Flags object for that encoding. |
Flags |
flagsForName(java.lang.String name)
|
PrimitiveType |
Float()
float |
Named |
forName(java.lang.String name)
Get the named type object with the following name. |
java.lang.String |
getTransformedClassName(ClassType ct)
Get the transformed class name of a class. |
java.util.Set |
getTypeEncoderRootSet(Type t)
Return the set of objects that should be serialized into the type information for the given ClassType. |
boolean |
hasEnclosingInstance(ClassType inner,
ClassType encl)
Returns whether an object of the inner class inner has an
enclosing instance of class encl . |
boolean |
hasFormals(ProcedureInstance pi,
java.util.List formalTypes)
Return true if t overrides mi |
boolean |
hasMethod(ReferenceType t,
MethodInstance mi)
Return true if t overrides mi |
boolean |
hasMethodNamed(ReferenceType container,
java.lang.String name)
Returns the list of methods with the given name defined or inherited into container, checking if the methods are accessible from the body of currClass |
java.util.List |
implemented(MethodInstance mi)
Get the list of methods mi implements, in no
specified order. |
ImportTable |
importTable(Package pkg)
Create an import table for the source file. |
ImportTable |
importTable(java.lang.String sourceName,
Package pkg)
Create an import table for the source file. |
protected void |
initFlags()
|
void |
initialize(LoadedClassResolver loadedResolver,
ExtensionInfo extInfo)
Initializes the type system and its internal constants (which depend on the resolver). |
InitializerInstance |
initializerInstance(Position pos,
ClassType container,
Flags flags)
Create an initailizer instance. |
protected void |
initTypes()
|
PrimitiveType |
Int()
int |
Flags |
Interface()
|
java.util.List |
interfaces(ReferenceType type)
Returns an immutable list of all the interface types which type implements. |
protected boolean |
isAccessible(MemberInstance mi,
ClassType contextClass)
Checks whether the member mi can be accessed from code that is declared in the class contextClass. |
boolean |
isAccessible(MemberInstance mi,
Context context)
Checks whether the member mi can be accessed from Context "context". |
boolean |
isCanonical(Type type)
Returns true iff |
boolean |
isCastValid(Type fromType,
Type toType)
Requires: all type arguments are canonical. |
boolean |
isEnclosed(ClassType inner,
ClassType outer)
Returns whether inner is enclosed within outer |
boolean |
isImplicitCastValid(Type fromType,
Type toType)
Requires: all type arguments are canonical. |
boolean |
isSameMethod(MethodInstance m1,
MethodInstance m2)
Returns true iff |
boolean |
isSubtype(Type t1,
Type t2)
Returns true iff child descends from ancestor or child == ancestor. |
boolean |
isThrowable(Type type)
Returns true iff an object of type |
boolean |
isUncheckedException(Type type)
Returns a true iff the type or a supertype is in the list returned by uncheckedExceptions(). |
Type |
leastCommonAncestor(Type type1,
Type type2)
Requires: all type arguments are canonical. |
protected static java.lang.String |
listToString(java.util.List l)
|
protected ClassType |
load(java.lang.String name)
|
LoadedClassResolver |
loadedResolver()
Return the type system's loaded resolver. |
LocalInstance |
localInstance(Position pos,
Flags flags,
Type type,
java.lang.String name)
Create a local variable instance. |
PrimitiveType |
Long()
long |
boolean |
methodCallValid(MethodInstance prototype,
java.lang.String name,
java.util.List argTypes)
Return true if mi can be called with name name
and actual parameters of types actualTypes . |
MethodInstance |
methodInstance(Position pos,
ReferenceType container,
Flags flags,
Type returnType,
java.lang.String name,
java.util.List argTypes,
java.util.List excTypes)
Create a method instance. |
boolean |
moreSpecific(ProcedureInstance p1,
ProcedureInstance p2)
Returns whether method 1 is more specific than method 2, where more specific is defined as JLS 15.11.2.2 |
Flags |
Native()
|
Flags |
NoFlags()
|
NullType |
Null()
The type of null . |
ClassType |
NullPointerException()
java.lang.NullPointerException |
boolean |
numericConversionValid(Type t,
long value)
Returns true if value can be implicitly cast to Primitive
type t . |
boolean |
numericConversionValid(Type t,
java.lang.Object value)
Returns true if value can be implicitly cast to Primitive
type t . |
ClassType |
Object()
java.lang.Object |
ClassType |
OutOfBoundsException()
java.lang.ArrayIndexOutOfBoundsException |
java.util.List |
overrides(MethodInstance mi)
Get the list of methods mi (potentially) overrides, in
order from this class (that is, including this ) to super
classes. |
Resolver |
packageContextResolver(Resolver cr,
Package p)
Get a resolver for looking up a type in a package. |
boolean |
packageExists(java.lang.String name)
Returns true if the package named name exists. |
Package |
packageForName(Package prefix,
java.lang.String name)
Return a package by name with the given outer package. |
Package |
packageForName(java.lang.String name)
Return a package by name. |
TableResolver |
parsedResolver()
Return the type system's table resolver. |
java.lang.Object |
placeHolder(TypeObject o)
Get a place-holder for serializing a type object. |
java.lang.Object |
placeHolder(TypeObject o,
java.util.Set roots)
Get a place-holder for serializing a type object. |
PrimitiveType |
primitiveForName(java.lang.String name)
Return the primitive with the given name. |
Flags |
Private()
|
PrimitiveType |
promote(Type t)
Unary promotion for numeric types. |
PrimitiveType |
promote(Type t1,
Type t2)
Binary promotion for numeric types. |
protected PrimitiveType |
promoteNumeric(PrimitiveType t)
|
protected PrimitiveType |
promoteNumeric(PrimitiveType t1,
PrimitiveType t2)
|
Flags |
Protected()
|
Flags |
Public()
|
ClassType |
RuntimeException()
java.lang.RuntimeException |
ClassType |
Serializable()
java.io.Serializable |
PrimitiveType |
Short()
short |
Flags |
Static()
|
Type |
staticTarget(Type t)
Returns t, modified as necessary to make it a legal static target. |
Flags |
StrictFP()
|
ClassType |
String()
java.lang.String |
Type |
superType(ReferenceType type)
Returns the supertype of type, or null if type has no supertype. |
Flags |
Synchronized()
|
TopLevelResolver |
systemResolver()
Returns the system resolver. |
ClassType |
Throwable()
java.lang.Throwable |
boolean |
throwsSubset(ProcedureInstance p1,
ProcedureInstance p2)
Returns true iff |
java.lang.String |
toString()
|
Flags |
Transient()
|
java.lang.String |
translateArray(Resolver c,
ArrayType t)
Translate an array type. |
java.lang.String |
translateClass(Resolver c,
ClassType t)
Translate a top-level class type. |
java.lang.String |
translatePackage(Resolver c,
Package p)
Translate a package. |
java.lang.String |
translatePrimitive(Resolver c,
PrimitiveType t)
Translate a primitive type. |
Type |
typeForClass(java.lang.Class clazz)
Returns a canonical type corresponding to the Java Class object theClass. |
Type |
typeForName(java.lang.String name)
Get the type with the following name. |
java.util.Collection |
uncheckedExceptions()
Returns a list of the Throwable types that need not be declared in method and constructor signatures. |
UnknownPackage |
unknownPackage(Position pos)
Get an unknown package. |
UnknownQualifier |
unknownQualifier(Position pos)
Get an unknown type qualifier. |
UnknownType |
unknownType(Position pos)
Get an unknown type. |
PrimitiveType |
Void()
void |
Flags |
Volatile()
|
java.lang.String |
wrapperTypeString(PrimitiveType t)
Return the boxed version of t . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected TopLevelResolver systemResolver
protected TableResolver parsedResolver
protected LoadedClassResolver loadedResolver
protected java.util.Map flagsForName
protected ClassType OBJECT_
protected ClassType CLASS_
protected ClassType STRING_
protected ClassType THROWABLE_
protected final NullType NULL_
protected final PrimitiveType VOID_
protected final PrimitiveType BOOLEAN_
protected final PrimitiveType CHAR_
protected final PrimitiveType BYTE_
protected final PrimitiveType SHORT_
protected final PrimitiveType INT_
protected final PrimitiveType LONG_
protected final PrimitiveType FLOAT_
protected final PrimitiveType DOUBLE_
protected UnknownType unknownType
protected UnknownPackage unknownPackage
protected UnknownQualifier unknownQualifier
protected LazyClassInitializer defaultClassInit
protected final Flags ACCESS_FLAGS
protected final Flags LOCAL_FLAGS
protected final Flags FIELD_FLAGS
protected final Flags CONSTRUCTOR_FLAGS
protected final Flags INITIALIZER_FLAGS
protected final Flags METHOD_FLAGS
protected final Flags TOP_LEVEL_CLASS_FLAGS
protected final Flags MEMBER_CLASS_FLAGS
protected final Flags LOCAL_CLASS_FLAGS
Constructor Detail |
---|
public TypeSystem_c()
Method Detail |
---|
public void initialize(LoadedClassResolver loadedResolver, ExtensionInfo extInfo) throws SemanticException
initialize
in interface TypeSystem
loadedResolver
- The resolver to use for loading types from class files
or other source files.extInfo
- The ExtensionInfo the TypeSystem is being created for.
SemanticException
protected void initTypes() throws SemanticException
SemanticException
public TopLevelResolver systemResolver()
TypeSystem
systemResolver
in interface TypeSystem
public TableResolver parsedResolver()
TypeSystem
parsedResolver
in interface TypeSystem
public LoadedClassResolver loadedResolver()
TypeSystem
loadedResolver
in interface TypeSystem
public ImportTable importTable(java.lang.String sourceName, Package pkg)
TypeSystem
importTable
in interface TypeSystem
sourceName
- Name of the source file to import into. This is used
mainly for error messages and for debugging.pkg
- The package of the source file in which to import.public ImportTable importTable(Package pkg)
TypeSystem
importTable
in interface TypeSystem
pkg
- The package of the source file in which to import.public boolean packageExists(java.lang.String name)
name
exists.
packageExists
in interface TypeSystem
protected void assert_(java.util.Collection l)
protected void assert_(TypeObject o)
public java.lang.String wrapperTypeString(PrimitiveType t)
TypeSystem
t
.
wrapperTypeString
in interface TypeSystem
public Context createContext()
TypeSystem
createContext
in interface TypeSystem
public Resolver packageContextResolver(Resolver cr, Package p)
TypeSystem
packageContextResolver
in interface TypeSystem
public Resolver classContextResolver(ClassType type)
TypeSystem
classContextResolver
in interface TypeSystem
public FieldInstance fieldInstance(Position pos, ReferenceType container, Flags flags, Type type, java.lang.String name)
TypeSystem
fieldInstance
in interface TypeSystem
pos
- Position of the field.container
- Containing type of the field.flags
- The field's flags.type
- The field's type.name
- The field's name.public LocalInstance localInstance(Position pos, Flags flags, Type type, java.lang.String name)
TypeSystem
localInstance
in interface TypeSystem
pos
- Position of the local variable.flags
- The local variable's flags.type
- The local variable's type.name
- The local variable's name.public ConstructorInstance defaultConstructor(Position pos, ClassType container)
TypeSystem
defaultConstructor
in interface TypeSystem
pos
- Position of the constructor.container
- Containing class of the constructor.public ConstructorInstance constructorInstance(Position pos, ClassType container, Flags flags, java.util.List argTypes, java.util.List excTypes)
TypeSystem
constructorInstance
in interface TypeSystem
pos
- Position of the constructor.container
- Containing class of the constructor.flags
- The constructor's flags.argTypes
- The constructor's formal parameter types.excTypes
- The constructor's exception throw types.public InitializerInstance initializerInstance(Position pos, ClassType container, Flags flags)
TypeSystem
initializerInstance
in interface TypeSystem
pos
- Position of the initializer.container
- Containing class of the initializer.flags
- The initializer's flags.public MethodInstance methodInstance(Position pos, ReferenceType container, Flags flags, Type returnType, java.lang.String name, java.util.List argTypes, java.util.List excTypes)
TypeSystem
methodInstance
in interface TypeSystem
pos
- Position of the method.container
- Containing type of the method.flags
- The method's flags.returnType
- The method's return type.name
- The method's name.argTypes
- The method's formal parameter types.excTypes
- The method's exception throw types.public boolean descendsFrom(Type child, Type ancestor)
descendsFrom
in interface TypeSystem
public boolean isCastValid(Type fromType, Type toType)
isCastValid
in interface TypeSystem
public boolean isImplicitCastValid(Type fromType, Type toType)
isImplicitCastValid
in interface TypeSystem
public boolean equals(TypeObject type1, TypeObject type2)
equals
in interface TypeSystem
public boolean numericConversionValid(Type t, java.lang.Object value)
value
can be implicitly cast to Primitive
type t
.
numericConversionValid
in interface TypeSystem
public boolean numericConversionValid(Type t, long value)
value
can be implicitly cast to Primitive
type t
. This method should be removed. It is kept for
backward compatibility.
numericConversionValid
in interface TypeSystem
public boolean isCanonical(Type type)
isCanonical
in interface TypeSystem
public boolean isAccessible(MemberInstance mi, Context context)
isAccessible
in interface TypeSystem
protected boolean isAccessible(MemberInstance mi, ClassType contextClass)
public boolean classAccessible(ClassType targetClass, Context context)
classAccessible
in interface TypeSystem
protected boolean classAccessible(ClassType targetClass, ClassType contextClass)
public boolean classAccessibleFromPackage(ClassType targetClass, Package pkg)
classAccessibleFromPackage
in interface TypeSystem
protected boolean accessibleFromPackage(Flags flags, Package pkg1, Package pkg2)
flags
in package pkg1
is accessible from package
pkg2
.
public boolean isEnclosed(ClassType inner, ClassType outer)
TypeSystem
isEnclosed
in interface TypeSystem
public boolean hasEnclosingInstance(ClassType inner, ClassType encl)
TypeSystem
inner
has an
enclosing instance of class encl
.
hasEnclosingInstance
in interface TypeSystem
public void checkCycles(ReferenceType goal) throws SemanticException
TypeSystem
t
has no cycles in the super type+nested class
graph starting at t
.
checkCycles
in interface TypeSystem
SemanticException
protected void checkCycles(ReferenceType curr, ReferenceType goal) throws SemanticException
SemanticException
public boolean canCoerceToString(Type t, Context c)
canCoerceToString
in interface TypeSystem
public boolean isThrowable(Type type)
isThrowable
in interface TypeSystem
public boolean isUncheckedException(Type type)
isUncheckedException
in interface TypeSystem
public java.util.Collection uncheckedExceptions()
uncheckedExceptions
in interface TypeSystem
public boolean isSubtype(Type t1, Type t2)
TypeSystem
descendsFrom(child, ancestor) || equals(child, ancestor)
isSubtype
in interface TypeSystem
public FieldInstance findField(ReferenceType container, java.lang.String name, Context c) throws SemanticException
TypeSystem
findField
in interface TypeSystem
SemanticException
public FieldInstance findField(ReferenceType container, java.lang.String name, ClassType currClass) throws SemanticException
name
defined
in type container
or a supertype, and visible from
currClass
. If no such field is found, a SemanticException
is thrown. currClass
may be null.
findField
in interface TypeSystem
SemanticException
- if the field cannot be found or is
inaccessible.public FieldInstance findField(ReferenceType container, java.lang.String name) throws SemanticException
name
defined
in type container
or a supertype. If no such field is
found, a SemanticException is thrown.
findField
in interface TypeSystem
SemanticException
- if the field cannot be found or is
inaccessible.protected java.util.Set findFields(ReferenceType container, java.lang.String name)
name
defined
in type container
or a supertype. The list
returned may be empty.
public ClassType findMemberClass(ClassType container, java.lang.String name, Context c) throws SemanticException
TypeSystem
findMemberClass
in interface TypeSystem
SemanticException
public ClassType findMemberClass(ClassType container, java.lang.String name, ClassType currClass) throws SemanticException
TypeSystem
findMemberClass
in interface TypeSystem
SemanticException
- if the class cannot be found or is
inaccessible.public java.util.Set findMemberClasses(ClassType container, java.lang.String name) throws SemanticException
SemanticException
public ClassType findMemberClass(ClassType container, java.lang.String name) throws SemanticException
TypeSystem
findMemberClass
in interface TypeSystem
SemanticException
- if the class cannot be found or is
inaccessible.protected static java.lang.String listToString(java.util.List l)
public MethodInstance findMethod(ReferenceType container, java.lang.String name, java.util.List argTypes, Context c) throws SemanticException
TypeSystem
findMethod
in interface TypeSystem
SemanticException
public boolean hasMethodNamed(ReferenceType container, java.lang.String name)
hasMethodNamed
in interface TypeSystem
public MethodInstance findMethod(ReferenceType container, java.lang.String name, java.util.List argTypes, ClassType currClass) throws SemanticException
findMethod
in interface TypeSystem
SemanticException
- if the method cannot be found or is
inaccessible.public ConstructorInstance findConstructor(ClassType container, java.util.List argTypes, Context c) throws SemanticException
TypeSystem
findConstructor
in interface TypeSystem
SemanticException
public ConstructorInstance findConstructor(ClassType container, java.util.List argTypes, ClassType currClass) throws SemanticException
TypeSystem
findConstructor
in interface TypeSystem
SemanticException
- if the constructor cannot be found or is
inaccessible.protected ProcedureInstance findProcedure(java.util.List acceptable, ReferenceType container, java.util.List argTypes, ClassType currClass) throws SemanticException
SemanticException
protected java.util.Collection findMostSpecificProcedures(java.util.List acceptable, ReferenceType container, java.util.List argTypes, ClassType currClass) throws SemanticException
SemanticException
protected java.util.List findAcceptableMethods(ReferenceType container, java.lang.String name, java.util.List argTypes, ClassType currClass) throws SemanticException
SemanticException
protected java.util.List findAcceptableConstructors(ClassType container, java.util.List argTypes, ClassType currClass) throws SemanticException
SemanticException
public boolean moreSpecific(ProcedureInstance p1, ProcedureInstance p2)
moreSpecific
in interface TypeSystem
public Type superType(ReferenceType type)
superType
in interface TypeSystem
public java.util.List interfaces(ReferenceType type)
interfaces
in interface TypeSystem
public Type leastCommonAncestor(Type type1, Type type2) throws SemanticException
leastCommonAncestor
in interface TypeSystem
SemanticException
- if the LCA does not existpublic boolean throwsSubset(ProcedureInstance p1, ProcedureInstance p2)
throwsSubset
in interface TypeSystem
public boolean hasFormals(ProcedureInstance pi, java.util.List formalTypes)
hasFormals
in interface TypeSystem
public boolean hasMethod(ReferenceType t, MethodInstance mi)
hasMethod
in interface TypeSystem
public java.util.List overrides(MethodInstance mi)
TypeSystem
mi
(potentially) overrides, in
order from this class (that is, including this
) to super
classes.
overrides
in interface TypeSystem
public java.util.List implemented(MethodInstance mi)
TypeSystem
mi
implements, in no
specified order.
implemented
in interface TypeSystem
public boolean canOverride(MethodInstance mi, MethodInstance mj)
TypeSystem
mi
can override mj
.
canOverride
in interface TypeSystem
public void checkOverride(MethodInstance mi, MethodInstance mj) throws SemanticException
TypeSystem
mi
cannot override
mj
.
checkOverride
in interface TypeSystem
SemanticException
public boolean isSameMethod(MethodInstance m1, MethodInstance m2)
isSameMethod
in interface TypeSystem
public boolean methodCallValid(MethodInstance prototype, java.lang.String name, java.util.List argTypes)
TypeSystem
mi
can be called with name name
and actual parameters of types actualTypes
.
methodCallValid
in interface TypeSystem
public boolean callValid(ProcedureInstance prototype, java.util.List argTypes)
TypeSystem
pi
can be called with
actual parameters of types actualTypes
.
callValid
in interface TypeSystem
public NullType Null()
TypeSystem
null
.
Null
in interface TypeSystem
public PrimitiveType Void()
TypeSystem
void
Void
in interface TypeSystem
public PrimitiveType Boolean()
TypeSystem
boolean
Boolean
in interface TypeSystem
public PrimitiveType Char()
TypeSystem
char
Char
in interface TypeSystem
public PrimitiveType Byte()
TypeSystem
byte
Byte
in interface TypeSystem
public PrimitiveType Short()
TypeSystem
short
Short
in interface TypeSystem
public PrimitiveType Int()
TypeSystem
int
Int
in interface TypeSystem
public PrimitiveType Long()
TypeSystem
long
Long
in interface TypeSystem
public PrimitiveType Float()
TypeSystem
float
Float
in interface TypeSystem
public PrimitiveType Double()
TypeSystem
double
Double
in interface TypeSystem
protected ClassType load(java.lang.String name)
public Named forName(java.lang.String name) throws SemanticException
TypeSystem
forName
in interface TypeSystem
name
- The name of the type object to look for.
SemanticException
- when object is not found.public Type typeForName(java.lang.String name) throws SemanticException
TypeSystem
typeForName
in interface TypeSystem
name
- The name to create the type for.
SemanticException
- when type is not found.public ClassType Object()
TypeSystem
java.lang.Object
Object
in interface TypeSystem
public ClassType Class()
TypeSystem
java.lang.Class
Class
in interface TypeSystem
public ClassType String()
TypeSystem
java.lang.String
String
in interface TypeSystem
public ClassType Throwable()
TypeSystem
java.lang.Throwable
Throwable
in interface TypeSystem
public ClassType Error()
TypeSystem
java.lang.Error
Error
in interface TypeSystem
public ClassType Exception()
TypeSystem
java.lang.Exception
Exception
in interface TypeSystem
public ClassType RuntimeException()
TypeSystem
java.lang.RuntimeException
RuntimeException
in interface TypeSystem
public ClassType Cloneable()
TypeSystem
java.lang.Cloneable
Cloneable
in interface TypeSystem
public ClassType Serializable()
TypeSystem
java.io.Serializable
Serializable
in interface TypeSystem
public ClassType NullPointerException()
TypeSystem
java.lang.NullPointerException
NullPointerException
in interface TypeSystem
public ClassType ClassCastException()
TypeSystem
java.lang.ClassCastException
ClassCastException
in interface TypeSystem
public ClassType OutOfBoundsException()
TypeSystem
java.lang.ArrayIndexOutOfBoundsException
OutOfBoundsException
in interface TypeSystem
public ClassType ArrayStoreException()
TypeSystem
java.lang.ArrayStoreException
ArrayStoreException
in interface TypeSystem
public ClassType ArithmeticException()
TypeSystem
java.lang.ArithmeticException
ArithmeticException
in interface TypeSystem
protected NullType createNull()
protected PrimitiveType createPrimitive(PrimitiveType.Kind kind)
public java.lang.Object placeHolder(TypeObject o)
TypeSystem
placeHolder
in interface TypeSystem
o
- The object to get the place-holder for.public java.lang.Object placeHolder(TypeObject o, java.util.Set roots)
TypeSystem
placeHolder
in interface TypeSystem
o
- The object to get the place-holder for.roots
- The root objects for the serialization. Place holders
are not created for these.public UnknownType unknownType(Position pos)
TypeSystem
unknownType
in interface TypeSystem
public UnknownPackage unknownPackage(Position pos)
TypeSystem
unknownPackage
in interface TypeSystem
public UnknownQualifier unknownQualifier(Position pos)
TypeSystem
unknownQualifier
in interface TypeSystem
public Package packageForName(Package prefix, java.lang.String name) throws SemanticException
TypeSystem
packageForName
in interface TypeSystem
SemanticException
public Package packageForName(java.lang.String name) throws SemanticException
TypeSystem
packageForName
in interface TypeSystem
SemanticException
public Package createPackage(Package prefix, java.lang.String name)
TypeSystem
createPackage
in interface TypeSystem
public Package createPackage(java.lang.String name)
TypeSystem
createPackage
in interface TypeSystem
public ArrayType arrayOf(Type type)
arrayOf
in interface TypeSystem
public ArrayType arrayOf(Position pos, Type type)
TypeSystem
type
arrayOf
in interface TypeSystem
protected ArrayType arrayType(Position pos, Type type)
public ArrayType arrayOf(Type type, int dims)
TypeSystem
dims
-array of type
arrayOf
in interface TypeSystem
public ArrayType arrayOf(Position pos, Type type, int dims)
TypeSystem
dims
-array of type
arrayOf
in interface TypeSystem
public Type typeForClass(java.lang.Class clazz) throws SemanticException
SemanticException
public java.util.Set getTypeEncoderRootSet(Type t)
TypeSystem
getTypeEncoderRootSet
in interface TypeSystem
public java.lang.String getTransformedClassName(ClassType ct)
getTransformedClassName
in interface TypeSystem
public java.lang.String translatePackage(Resolver c, Package p)
TypeSystem
translatePackage
in interface TypeSystem
public java.lang.String translateArray(Resolver c, ArrayType t)
TypeSystem
translateArray
in interface TypeSystem
public java.lang.String translateClass(Resolver c, ClassType t)
TypeSystem
translateClass
in interface TypeSystem
public java.lang.String translatePrimitive(Resolver c, PrimitiveType t)
TypeSystem
translatePrimitive
in interface TypeSystem
public PrimitiveType primitiveForName(java.lang.String name) throws SemanticException
TypeSystem
primitiveForName
in interface TypeSystem
SemanticException
public LazyClassInitializer defaultClassInitializer()
TypeSystem
defaultClassInitializer
in interface TypeSystem
public final ParsedClassType createClassType()
TypeSystem
createClassType
in interface TypeSystem
public final ParsedClassType createClassType(Source fromSource)
TypeSystem
createClassType
in interface TypeSystem
public final ParsedClassType createClassType(LazyClassInitializer init)
TypeSystem
createClassType
in interface TypeSystem
public ParsedClassType createClassType(LazyClassInitializer init, Source fromSource)
TypeSystem
createClassType
in interface TypeSystem
public java.util.List defaultPackageImports()
TypeSystem
defaultPackageImports
in interface TypeSystem
public PrimitiveType promote(Type t1, Type t2) throws SemanticException
TypeSystem
promote
in interface TypeSystem
SemanticException
- if the types cannot be promoted.protected PrimitiveType promoteNumeric(PrimitiveType t1, PrimitiveType t2)
public PrimitiveType promote(Type t) throws SemanticException
TypeSystem
promote
in interface TypeSystem
SemanticException
- if the type cannot be promoted.protected PrimitiveType promoteNumeric(PrimitiveType t)
public void checkMethodFlags(Flags f) throws SemanticException
TypeSystem
f
are legal method flags.
checkMethodFlags
in interface TypeSystem
SemanticException
public void checkLocalFlags(Flags f) throws SemanticException
TypeSystem
f
are legal local variable flags.
checkLocalFlags
in interface TypeSystem
SemanticException
public void checkFieldFlags(Flags f) throws SemanticException
TypeSystem
f
are legal field flags.
checkFieldFlags
in interface TypeSystem
SemanticException
public void checkConstructorFlags(Flags f) throws SemanticException
TypeSystem
f
are legal constructor flags.
checkConstructorFlags
in interface TypeSystem
SemanticException
public void checkInitializerFlags(Flags f) throws SemanticException
TypeSystem
f
are legal initializer flags.
checkInitializerFlags
in interface TypeSystem
SemanticException
public void checkTopLevelClassFlags(Flags f) throws SemanticException
TypeSystem
f
are legal top-level class flags.
checkTopLevelClassFlags
in interface TypeSystem
SemanticException
public void checkMemberClassFlags(Flags f) throws SemanticException
TypeSystem
f
are legal member class flags.
checkMemberClassFlags
in interface TypeSystem
SemanticException
public void checkLocalClassFlags(Flags f) throws SemanticException
TypeSystem
f
are legal local class flags.
checkLocalClassFlags
in interface TypeSystem
SemanticException
public void checkAccessFlags(Flags f) throws SemanticException
TypeSystem
f
are legal access flags.
checkAccessFlags
in interface TypeSystem
SemanticException
protected java.util.List abstractSuperInterfaces(ReferenceType rt)
ct
that may contain abstract methods that must be
implemented by ct
. The list returned also contains
ct
.
public void checkClassConformance(ClassType ct) throws SemanticException
ct
implements all abstract methods required;
that is, if it is a concrete class, then it must implement all
interfaces and abstract methods that it or it's superclasses declare, and if
it is an abstract class then any methods that it overrides are overridden
correctly.
checkClassConformance
in interface TypeSystem
SemanticException
public Type staticTarget(Type t)
staticTarget
in interface TypeSystem
protected void initFlags()
public Flags createNewFlag(java.lang.String name, Flags after)
TypeSystem
createNewFlag
in interface TypeSystem
name
- the name of the flagafter
- print the new flag after these flagspublic Flags NoFlags()
NoFlags
in interface TypeSystem
public Flags Public()
Public
in interface TypeSystem
public Flags Private()
Private
in interface TypeSystem
public Flags Protected()
Protected
in interface TypeSystem
public Flags Static()
Static
in interface TypeSystem
public Flags Final()
Final
in interface TypeSystem
public Flags Synchronized()
Synchronized
in interface TypeSystem
public Flags Transient()
Transient
in interface TypeSystem
public Flags Native()
Native
in interface TypeSystem
public Flags Interface()
Interface
in interface TypeSystem
public Flags Abstract()
Abstract
in interface TypeSystem
public Flags Volatile()
Volatile
in interface TypeSystem
public Flags StrictFP()
StrictFP
in interface TypeSystem
public Flags flagsForBits(int bits)
TypeSystem
flagsForBits
in interface TypeSystem
public Flags flagsForName(java.lang.String name)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |