public interface TypeSystem
TypeSystem
defines the types of the language and
how they are related.Modifier and Type | Field and Description |
---|---|
static boolean |
SERIALIZE_MEMBERS_WITH_CONTAINER |
Modifier and Type | Method and Description |
---|---|
Flags |
Abstract() |
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)
Return an array of
type |
ArrayType |
arrayOf(Type type,
int dims)
Return a
dims -array of type |
ClassType |
ArrayStoreException()
java.lang.ArrayStoreException |
PrimitiveType |
Boolean()
boolean |
PrimitiveType |
Byte()
byte |
boolean |
callValid(ProcedureInstance mi,
java.util.List<? extends Type> 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 its superclasses declare. |
void |
checkConstructorFlags(Flags f)
Assert if the flags
f are legal constructor flags. |
void |
checkCycles(ReferenceType t)
Assert that
t has no cycles in the super type+nested class
graph starting at t . |
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 |
checkInterfaceFieldFlags(ClassType ct)
Assert that if
ct is an interface, its fields' flags is a subset
of public, static, final. |
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 |
boolean |
classAccessible(ClassType targetClass,
ClassType contextClass)
True if the class
targetClass accessible from the body of class
contextClass . |
boolean |
classAccessible(ClassType targetClass,
Context context)
Checks whether
targetClass can be accessed from context . |
boolean |
classAccessibleFromPackage(ClassType ct,
Package pkg)
Checks whether a top-level or member class can be accessed from the
package
pkg . |
ClassType |
ClassCastException()
java.lang.ClassCastException |
Resolver |
classContextResolver(ClassType ct) |
Resolver |
classContextResolver(ClassType ct,
ClassType accessor)
Get a resolver for looking up a type in a class context.
|
ClassFileLazyClassInitializer |
classFileLazyClassInitializer(ClassFile clazz)
Constructs a new ClassFileLazyClassInitializer for the given class file.
|
ClassType |
Cloneable()
java.lang.Cloneable |
ConstructorInstance |
constructorInstance(Position pos,
ClassType container,
Flags flags,
java.util.List<? extends Type> argTypes,
java.util.List<? extends Type> excTypes)
Create a constructor instance.
|
AccessControlResolver |
createClassContextResolver(ClassType ct) |
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 print_after)
Create a new unique Flags object.
|
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.
|
AccessControlResolver |
createPackageContextResolver(Package pkg) |
LazyClassInitializer |
defaultClassInitializer()
The default lazy class initializer.
|
ConstructorInstance |
defaultConstructor(Position pos,
ClassType container)
Create a default constructor instance.
|
java.util.List<java.lang.String> |
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,
but child descends from ancestor.
|
LazyClassInitializer |
deserializedClassInitializer()
The lazy class initializer for deserialized classes.
|
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 |
ExtensionInfo |
extensionInfo()
Return the language extension this type system is for.
|
FieldInstance |
fieldInstance(Position pos,
ReferenceType container,
Flags flags,
Type type,
java.lang.String name)
Create a field instance.
|
Flags |
Final() |
ConstructorInstance |
findConstructor(ClassType container,
java.util.List<? extends Type> argTypes,
ClassType currClass)
Deprecated.
|
ConstructorInstance |
findConstructor(ClassType container,
java.util.List<? extends Type> argTypes,
ClassType currClass,
boolean fromClient)
Find a constructor.
|
ConstructorInstance |
findConstructor(ClassType container,
java.util.List<? extends Type> argTypes,
Context c)
Deprecated.
|
FieldInstance |
findField(ReferenceType container,
java.lang.String name)
Deprecated.
|
FieldInstance |
findField(ReferenceType container,
java.lang.String name,
ClassType currClass)
Deprecated.
|
FieldInstance |
findField(ReferenceType container,
java.lang.String name,
ClassType currClass,
boolean fromClient)
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.
|
MethodInstance |
findImplementingMethod(ClassType ct,
MethodInstance mi)
Find a potentially suitable implementation of the method
mi
in the class ct or a supertype thereof. |
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.
|
MethodInstance |
findMethod(ReferenceType container,
java.lang.String name,
java.util.List<? extends Type> argTypes,
ClassType currClass)
Deprecated.
|
MethodInstance |
findMethod(ReferenceType container,
java.lang.String name,
java.util.List<? extends Type> argTypes,
ClassType currClass,
boolean fromClient)
Requires: all type arguments are canonical.
|
MethodInstance |
findMethod(ReferenceType container,
java.lang.String name,
java.util.List<? extends Type> argTypes,
Context c)
Deprecated.
|
Flags |
flagsForBits(int bits)
Given the JVM encoding of a set of flags, returns the Flags object
for that encoding.
|
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<? extends TypeObject> |
getTypeEncoderRootSet(TypeObject o)
Return the set of objects that should be serialized into the
type information for the given TypeObject.
|
boolean |
hasAccessibleMethodNamed(ReferenceType t,
java.lang.String name,
ClassType currClass)
Returns true iff
t has a method with name name
either defined in t or inherited into it that is accessible from currClass. |
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<? extends Type> formalTypes)
Returns true iff
pi has exactly the formal arguments
formalTypes . |
boolean |
hasMethod(ReferenceType t,
MethodInstance mi)
Returns true iff
t has the method mi . |
boolean |
hasMethodNamed(ReferenceType container,
java.lang.String name)
Returns true iff
container has a method with name name
either defined in container or inherited into it. |
java.util.List<MethodInstance> |
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.
|
void |
initialize(TopLevelResolver resolver,
ExtensionInfo extInfo)
Initialize the type system with the compiler and its internal constants
(which depend on the resolver).
|
InitializerInstance |
initializerInstance(Position pos,
ClassType container,
Flags flags)
Create an initializer instance.
|
PrimitiveType |
Int()
int |
Flags |
Interface() |
java.util.List<? extends Type> |
interfaces(ReferenceType type)
Returns an immutable list of all the interface types which type
implements.
|
boolean |
isAccessible(MemberInstance mi,
ClassType contextClass)
Checks whether a class member can be accessed from code that is
declared in the class
contextClass . |
boolean |
isAccessible(MemberInstance mi,
ClassType contextClass,
boolean fromClient)
Checks whether a class member can be accessed from code that is
declared in the class
contextClass . |
boolean |
isAccessible(MemberInstance mi,
Context context)
Checks whether a class member can be accessed from
context . |
boolean |
isAccessible(MemberInstance mi,
ReferenceType container,
ClassType contextClass)
Checks whether a class member mi, which is declared in container or
an ancestor of container, can be accessed from code that is declared
in class
contextClass , accessing it via the type container. |
boolean |
isAccessible(MemberInstance mi,
ReferenceType container,
ReferenceType contextType,
boolean fromClient)
Checks whether a member mi, which is declared in container or
an ancestor of container, can be accessed from code that is declared
in type
context . |
boolean |
isCanonical(Type type)
Returns true iff
type is a canonical
(fully qualified) type. |
boolean |
isCastValid(Type fromType,
Type toType)
Requires: all type arguments are canonical, and toType is not a NullType.
|
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 |
isInherited(MemberInstance mi,
ReferenceType type)
Returns whether member
mi is inherited by reference type type . |
boolean |
isMember(MemberInstance mi,
ReferenceType type)
Returns whether member
mi is a member of reference type
type , either by definition or by inheritance. |
boolean |
isSameMethod(MethodInstance m1,
MethodInstance m2)
Returns true iff
m1 is the same method as m2 . |
boolean |
isSubtype(Type child,
Type ancestor)
Returns true iff child descends from ancestor or child == ancestor.
|
boolean |
isThrowable(Type type)
Returns true iff an object of type
type may be thrown. |
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.
|
Flags |
legalAbstractMethodFlags()
All flags allowed for an abstract method.
|
Flags |
legalAccessFlags()
All possible access flags.
|
Flags |
legalConstructorFlags()
All flags allowed for a constructor.
|
Flags |
legalFieldFlags()
All flags allowed for a field.
|
Flags |
legalInitializerFlags()
All flags allowed for an initializer block.
|
Flags |
legalInterfaceFieldFlags()
All flags allowed for a field declared in an interface.
|
Flags |
legalLocalClassFlags()
All flags allowed for a local class.
|
Flags |
legalLocalFlags()
All flags allowed for a local variable.
|
Flags |
legalMemberClassFlags()
All flags allowed for a member class.
|
Flags |
legalMethodFlags()
All flags allowed for a method.
|
Flags |
legalTopLevelClassFlags()
All flags allowed for a top-level class.
|
TopLevelResolver |
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 mi,
java.lang.String name,
java.util.List<? extends Type> 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<? extends Type> argTypes,
java.util.List<? extends Type> excTypes)
Create a method instance.
|
boolean |
moreSpecific(ProcedureInstance m1,
ProcedureInstance m2)
Returns true iff
m1 is more specific than m2 . |
Flags |
Native() |
Flags |
NoFlags() |
NullType |
Null()
The type of
null . |
ClassType |
NullPointerException()
java.lang.NullPointerException |
boolean |
numericConversionValid(Type t,
long value)
Deprecated.
Use
numericConversionValid(Type, Object) instead. |
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<MethodInstance> |
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(Package pkg) |
Resolver |
packageContextResolver(Package pkg,
ClassType accessor)
Get a resolver for looking up a type in a package.
|
Resolver |
packageContextResolver(Resolver cr,
Package pkg)
Deprecated.
|
boolean |
packageEquals(Package type1,
Package type2)
Returns true iff type1 and type2 are equivalent.
|
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.
|
CachingResolver |
parsedResolver()
Deprecated.
|
java.lang.Object |
placeHolder(TypeObject o)
Get a place-holder for serializing a type object.
|
java.lang.Object |
placeHolder(TypeObject o,
java.util.Set<? extends TypeObject> 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.
|
Flags |
Protected() |
Flags |
Public() |
void |
restoreSystemResolver(SystemResolver r)
Set the system resolver to
r . |
ClassType |
RuntimeException()
java.lang.RuntimeException |
SystemResolver |
saveSystemResolver()
Create and install a duplicate of the system resolver and return the original.
|
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 immediate supertype of type, or null if type has no
supertype.
|
Flags |
Synchronized() |
SystemResolver |
systemResolver()
Returns the system resolver.
|
ClassType |
Throwable()
java.lang.Throwable |
boolean |
throwsSubset(ProcedureInstance p1,
ProcedureInstance p2)
Returns true iff
p1 throws fewer exceptions than p2 . |
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.
|
boolean |
typeEquals(Type type1,
Type type2)
Returns true iff type1 and type2 are equivalent.
|
Type |
typeForName(java.lang.String name)
Get the type with the following name.
|
java.util.Collection<Type> |
uncheckedExceptions()
Returns a collection 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 . |
static final boolean SERIALIZE_MEMBERS_WITH_CONTAINER
void initialize(TopLevelResolver resolver, ExtensionInfo extInfo) throws SemanticException
resolver
- The resolver to use for loading types from class files
or other source files.extInfo
- The ExtensionInfo the TypeSystem is being created for.SemanticException
ExtensionInfo extensionInfo()
SystemResolver systemResolver()
@Deprecated CachingResolver parsedResolver()
SystemResolver saveSystemResolver()
void restoreSystemResolver(SystemResolver r)
r
.TopLevelResolver loadedResolver()
ClassFileLazyClassInitializer classFileLazyClassInitializer(ClassFile clazz)
ImportTable importTable(java.lang.String sourceName, Package pkg)
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.ImportTable importTable(Package pkg)
pkg
- The package of the source file in which to import.java.util.List<java.lang.String> defaultPackageImports()
boolean packageExists(java.lang.String name)
name
exists.Named forName(java.lang.String name) throws SemanticException
name
- The name of the type object to look for.SemanticException
- when object is not found.Type typeForName(java.lang.String name) throws SemanticException
name
- The name to create the type for.SemanticException
- when type is not found.InitializerInstance initializerInstance(Position pos, ClassType container, Flags flags)
pos
- Position of the initializer.container
- Containing class of the initializer.flags
- The initializer's flags.ConstructorInstance constructorInstance(Position pos, ClassType container, Flags flags, java.util.List<? extends Type> argTypes, java.util.List<? extends Type> excTypes)
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.MethodInstance methodInstance(Position pos, ReferenceType container, Flags flags, Type returnType, java.lang.String name, java.util.List<? extends Type> argTypes, java.util.List<? extends Type> excTypes)
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.FieldInstance fieldInstance(Position pos, ReferenceType container, Flags flags, Type type, java.lang.String name)
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.LocalInstance localInstance(Position pos, Flags flags, Type type, java.lang.String name)
pos
- Position of the local variable.flags
- The local variable's flags.type
- The local variable's type.name
- The local variable's name.ConstructorInstance defaultConstructor(Position pos, ClassType container)
pos
- Position of the constructor.container
- Containing class of the constructor.UnknownType unknownType(Position pos)
UnknownPackage unknownPackage(Position pos)
UnknownQualifier unknownQualifier(Position pos)
boolean isSubtype(Type child, Type ancestor)
descendsFrom(child, ancestor) || equals(child, ancestor)
boolean descendsFrom(Type child, Type ancestor)
boolean isCastValid(Type fromType, Type toType)
boolean isImplicitCastValid(Type fromType, Type toType)
boolean equals(TypeObject type1, TypeObject type2)
boolean typeEquals(Type type1, Type type2)
boolean packageEquals(Package type1, Package type2)
@Deprecated boolean numericConversionValid(Type t, long value)
numericConversionValid(Type, Object)
instead.value
can be implicitly cast to primitive type
t
.boolean numericConversionValid(Type t, java.lang.Object value)
value
can be implicitly cast to
primitive type t
.Type leastCommonAncestor(Type type1, Type type2) throws SemanticException
type1
and type2
.SemanticException
- if the LCA does not existboolean isCanonical(Type type)
type
is a canonical
(fully qualified) type.boolean isAccessible(MemberInstance mi, Context context)
context
.boolean isAccessible(MemberInstance mi, ClassType contextClass)
contextClass
.boolean isAccessible(MemberInstance mi, ClassType contextClass, boolean fromClient)
contextClass
.boolean isAccessible(MemberInstance mi, ReferenceType container, ClassType contextClass)
contextClass
, accessing it via the type container.boolean isAccessible(MemberInstance mi, ReferenceType container, ReferenceType contextType, boolean fromClient)
context
. fromClient indicates whether this member is
being access from a client (true) or by inheritance (false).boolean classAccessible(ClassType targetClass, Context context)
targetClass
can be accessed from context
.boolean classAccessible(ClassType targetClass, ClassType contextClass)
targetClass
accessible from the body of class
contextClass
.boolean classAccessibleFromPackage(ClassType ct, Package pkg)
pkg
. Returns false for local and anonymous classes.boolean isEnclosed(ClassType inner, ClassType outer)
boolean hasEnclosingInstance(ClassType inner, ClassType encl)
inner
has an
enclosing instance of class encl
.boolean isMember(MemberInstance mi, ReferenceType type)
mi
is a member of reference type
type
, either by definition or by inheritance.boolean isInherited(MemberInstance mi, ReferenceType type)
mi
is inherited by reference type type
.
See JLS 2nd edition section 6.4.boolean canCoerceToString(Type t, Context c)
"" + o
would be allowed.boolean isThrowable(Type type)
type
may be thrown.boolean isUncheckedException(Type type)
uncheckedExceptions()
.java.util.Collection<Type> uncheckedExceptions()
Throwable
types that need not be declared
in method and constructor signatures.PrimitiveType promote(Type t) throws SemanticException
SemanticException
- if the type cannot be promoted.PrimitiveType promote(Type t1, Type t2) throws SemanticException
SemanticException
- if the types cannot be promoted.@Deprecated FieldInstance findField(ReferenceType container, java.lang.String name, Context c) throws SemanticException
SemanticException
@Deprecated FieldInstance findField(ReferenceType container, java.lang.String name, ClassType currClass) throws SemanticException
SemanticException
FieldInstance findField(ReferenceType container, java.lang.String name, ClassType currClass, boolean fromClient) throws SemanticException
name
defined
in type container
or a supertype, and visible from
currClass
. currClass
may be null.SemanticException
- if the field cannot be found or is
inaccessible.@Deprecated FieldInstance findField(ReferenceType container, java.lang.String name) throws SemanticException
name
defined
in type container
or a supertype.SemanticException
- if the field cannot be found or is
inaccessible.@Deprecated MethodInstance findMethod(ReferenceType container, java.lang.String name, java.util.List<? extends Type> argTypes, Context c) throws SemanticException
SemanticException
@Deprecated MethodInstance findMethod(ReferenceType container, java.lang.String name, java.util.List<? extends Type> argTypes, ClassType currClass) throws SemanticException
SemanticException
MethodInstance findMethod(ReferenceType container, java.lang.String name, java.util.List<? extends Type> argTypes, ClassType currClass, boolean fromClient) throws SemanticException
name
defined in type
container
and visible from class curClass
.
We need to pass the class from which the method
is being found because the method we find depends on whether the method
is accessible from that class.SemanticException
- if the method cannot be found or is
inaccessible.@Deprecated ConstructorInstance findConstructor(ClassType container, java.util.List<? extends Type> argTypes, Context c) throws SemanticException
SemanticException
@Deprecated ConstructorInstance findConstructor(ClassType container, java.util.List<? extends Type> argTypes, ClassType currClass) throws SemanticException
SemanticException
ConstructorInstance findConstructor(ClassType container, java.util.List<? extends Type> argTypes, ClassType currClass, boolean fromClient) throws SemanticException
fromClient
- indicates whether the constructor is being accessed
from a client or by inheritanceSemanticException
- if the constructor cannot be found or is
inaccessible.ClassType findMemberClass(ClassType container, java.lang.String name, ClassType currClass) throws SemanticException
SemanticException
- if the class cannot be found or is
inaccessible.@Deprecated ClassType findMemberClass(ClassType container, java.lang.String name, Context c) throws SemanticException
SemanticException
ClassType findMemberClass(ClassType container, java.lang.String name) throws SemanticException
SemanticException
- if the class cannot be found or is
inaccessible.Type superType(ReferenceType type)
java.util.List<? extends Type> interfaces(ReferenceType type)
boolean throwsSubset(ProcedureInstance p1, ProcedureInstance p2)
p1
throws fewer exceptions than p2
.boolean hasMethod(ReferenceType t, MethodInstance mi)
t
has the method mi
.boolean hasMethodNamed(ReferenceType container, java.lang.String name)
container
has a method with name name
either defined in container
or inherited into it.boolean hasAccessibleMethodNamed(ReferenceType t, java.lang.String name, ClassType currClass)
t
has a method with name name
either defined in t
or inherited into it that is accessible from currClass.boolean isSameMethod(MethodInstance m1, MethodInstance m2)
m1
is the same method as m2
.boolean moreSpecific(ProcedureInstance m1, ProcedureInstance m2)
m1
is more specific than m2
.boolean hasFormals(ProcedureInstance pi, java.util.List<? extends Type> formalTypes)
pi
has exactly the formal arguments
formalTypes
.NullType Null()
null
.PrimitiveType Void()
void
PrimitiveType Boolean()
boolean
PrimitiveType Char()
char
PrimitiveType Byte()
byte
PrimitiveType Short()
short
PrimitiveType Int()
int
PrimitiveType Long()
long
PrimitiveType Float()
float
PrimitiveType Double()
double
ClassType Object()
java.lang.Object
ClassType String()
java.lang.String
ClassType Class()
java.lang.Class
ClassType Throwable()
java.lang.Throwable
ClassType Error()
java.lang.Error
ClassType Exception()
java.lang.Exception
ClassType RuntimeException()
java.lang.RuntimeException
ClassType Cloneable()
java.lang.Cloneable
ClassType Serializable()
java.io.Serializable
ClassType NullPointerException()
java.lang.NullPointerException
ClassType ClassCastException()
java.lang.ClassCastException
ClassType OutOfBoundsException()
java.lang.ArrayIndexOutOfBoundsException
ClassType ArrayStoreException()
java.lang.ArrayStoreException
ClassType ArithmeticException()
java.lang.ArithmeticException
Package packageForName(java.lang.String name) throws SemanticException
SemanticException
Package packageForName(Package prefix, java.lang.String name) throws SemanticException
SemanticException
Package createPackage(java.lang.String name)
Package createPackage(Package prefix, java.lang.String name)
Context createContext()
Resolver packageContextResolver(Package pkg, ClassType accessor)
AccessControlResolver createPackageContextResolver(Package pkg)
@Deprecated Resolver packageContextResolver(Resolver cr, Package pkg)
Resolver classContextResolver(ClassType ct, ClassType accessor)
AccessControlResolver createClassContextResolver(ClassType ct)
LazyClassInitializer defaultClassInitializer()
LazyClassInitializer deserializedClassInitializer()
ParsedClassType createClassType(LazyClassInitializer init)
ParsedClassType createClassType()
ParsedClassType createClassType(LazyClassInitializer init, Source fromSource)
ParsedClassType createClassType(Source fromSource)
java.util.Set<? extends TypeObject> getTypeEncoderRootSet(TypeObject o)
java.lang.String getTransformedClassName(ClassType ct)
java.lang.Object placeHolder(TypeObject o, java.util.Set<? extends TypeObject> roots)
o
- The object to get the place-holder for.roots
- The root objects for the serialization. Place holders
are not created for these.java.lang.Object placeHolder(TypeObject o)
o
- The object to get the place-holder for.java.lang.String translatePrimitive(Resolver c, PrimitiveType t)
java.lang.String translateClass(Resolver c, ClassType t)
java.lang.String wrapperTypeString(PrimitiveType t)
t
.boolean methodCallValid(MethodInstance mi, java.lang.String name, java.util.List<? extends Type> argTypes)
mi
can be called with name name
and actual parameters of types actualTypes
.boolean callValid(ProcedureInstance mi, java.util.List<? extends Type> argTypes)
pi
can be called with
actual parameters of types actualTypes
.java.util.List<MethodInstance> overrides(MethodInstance mi)
mi
(potentially) overrides, in
order from this class (that is, including this
) to super
classes.boolean canOverride(MethodInstance mi, MethodInstance mj)
mi
can override mj
.void checkOverride(MethodInstance mi, MethodInstance mj) throws SemanticException
mi
cannot override
mj
.SemanticException
java.util.List<MethodInstance> implemented(MethodInstance mi)
mi
implements, in no
specified order.PrimitiveType primitiveForName(java.lang.String name) throws SemanticException
SemanticException
Flags legalAccessFlags()
Flags legalLocalFlags()
Flags legalFieldFlags()
Flags legalConstructorFlags()
Flags legalInitializerFlags()
Flags legalMethodFlags()
Flags legalAbstractMethodFlags()
Flags legalTopLevelClassFlags()
Flags legalMemberClassFlags()
Flags legalLocalClassFlags()
Flags legalInterfaceFieldFlags()
void checkMethodFlags(Flags f) throws SemanticException
f
are legal method flags.SemanticException
void checkLocalFlags(Flags f) throws SemanticException
f
are legal local variable flags.SemanticException
void checkFieldFlags(Flags f) throws SemanticException
f
are legal field flags.SemanticException
void checkConstructorFlags(Flags f) throws SemanticException
f
are legal constructor flags.SemanticException
void checkInitializerFlags(Flags f) throws SemanticException
f
are legal initializer flags.SemanticException
void checkTopLevelClassFlags(Flags f) throws SemanticException
f
are legal top-level class flags.SemanticException
void checkMemberClassFlags(Flags f) throws SemanticException
f
are legal member class flags.SemanticException
void checkLocalClassFlags(Flags f) throws SemanticException
f
are legal local class flags.SemanticException
void checkAccessFlags(Flags f) throws SemanticException
f
are legal access flags.SemanticException
void checkCycles(ReferenceType t) throws SemanticException
t
has no cycles in the super type+nested class
graph starting at t
.SemanticException
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 its superclasses declare.SemanticException
void checkInterfaceFieldFlags(ClassType ct) throws SemanticException
ct
is an interface, its fields' flags is a subset
of public, static, final.SemanticException
MethodInstance findImplementingMethod(ClassType ct, MethodInstance mi)
mi
in the class ct
or a supertype thereof. Since we are
looking for implementations, ct
cannot be an interface.
The first potentially satisfying method is returned, that is, the method
that is visible from ct
, with the correct signature, in
the most precise class in the class hierarchy starting from
ct
.ct
or a supertype thereof, null if none exists.Type staticTarget(Type t)
t
, modified as necessary to make it a legal
static target.Flags flagsForBits(int bits)
Flags createNewFlag(java.lang.String name, Flags print_after)
name
- the name of the flagprint_after
- print the new flag after these flagsFlags NoFlags()
Flags Public()
Flags Protected()
Flags Private()
Flags Static()
Flags Final()
Flags Synchronized()
Flags Transient()
Flags Native()
Flags Interface()
Flags Abstract()
Flags Volatile()
Flags StrictFP()