polyglot.ext.jl.types
Class ReferenceType_c

java.lang.Object
  extended by polyglot.ext.jl.types.TypeObject_c
      extended by polyglot.ext.jl.types.Type_c
          extended by polyglot.ext.jl.types.ReferenceType_c
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Qualifier, ReferenceType, Type, TypeObject, Copy
Direct Known Subclasses:
ArrayType_c, ClassType_c

public abstract class ReferenceType_c
extends Type_c
implements ReferenceType

A ReferenceType represents a reference type -- a type on which contains methods and fields and is a subtype of Object.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class polyglot.ext.jl.types.TypeObject_c
position, ts
 
Constructor Summary
protected ReferenceType_c()
           
  ReferenceType_c(TypeSystem ts)
           
  ReferenceType_c(TypeSystem ts, Position pos)
           
 
Method Summary
 boolean descendsFromImpl(Type ancestor)
          Return true if this type descends from ancestor.
abstract  java.util.List fields()
          Returns a list of FieldInstances for all the fields declared in this.
 boolean hasMethod(MethodInstance mi)
          Return true if t has a method mi
 boolean hasMethodImpl(MethodInstance mi)
          Return true if t has a method mi
abstract  java.util.List interfaces()
          Returns a list of the types of this class's interfaces.
 boolean isCastValidImpl(Type toType)
          Requires: all type arguments are canonical.
 boolean isImplicitCastValidImpl(Type toType)
          Return true if a value of this type can be assigned to a variable of type toType.
 boolean isReference()
          Return true if a reference type.
abstract  java.util.List methods()
          Returns a list of MethodInstances for all the methods declared in this.
 java.util.List methods(java.lang.String name, java.util.List argTypes)
          Return the methods named name with the given formal parameter types, if any.
 java.util.List methodsNamed(java.lang.String name)
          Return the methods named name, if any.
abstract  Type superType()
          Returns the supertype of this class.
 ReferenceType toReference()
          Returns a non-null iff isReference() returns true.
 
Methods inherited from class polyglot.ext.jl.types.Type_c
arrayOf, arrayOf, descendsFrom, isArray, isBoolean, isByte, isCanonical, isCastValid, isChar, isClass, isComparable, isDouble, isFloat, isImplicitCastValid, isInt, isIntOrLess, isLong, isLongOrLess, isNull, isNumeric, isPackage, isPrimitive, isShort, isSubtype, isSubtypeImpl, isThrowable, isType, isUncheckedException, isVoid, numericConversionValid, numericConversionValid, numericConversionValidImpl, numericConversionValidImpl, toArray, toClass, toNull, toPackage, toPrimitive, toString, toType, translate
 
Methods inherited from class polyglot.ext.jl.types.TypeObject_c
copy, equals, equalsImpl, hashCode, position, typeSystem
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface polyglot.types.ReferenceType
fieldNamed
 
Methods inherited from interface polyglot.types.Type
arrayOf, arrayOf, descendsFrom, isArray, isBoolean, isByte, isCastValid, isChar, isClass, isComparable, isDouble, isFloat, isImplicitCastValid, isInt, isIntOrLess, isLong, isLongOrLess, isNull, isNumeric, isPrimitive, isShort, isSubtype, isSubtypeImpl, isThrowable, isUncheckedException, isVoid, numericConversionValid, numericConversionValid, numericConversionValidImpl, numericConversionValidImpl, toArray, toClass, toNull, toPrimitive, toString, translate
 
Methods inherited from interface polyglot.types.Qualifier
isPackage, isType, toPackage, toType
 
Methods inherited from interface polyglot.types.TypeObject
equalsImpl, isCanonical, position, typeSystem
 
Methods inherited from interface polyglot.util.Copy
copy
 

Constructor Detail

ReferenceType_c

protected ReferenceType_c()

ReferenceType_c

public ReferenceType_c(TypeSystem ts)

ReferenceType_c

public ReferenceType_c(TypeSystem ts,
                       Position pos)
Method Detail

isReference

public boolean isReference()
Description copied from interface: Type
Return true if a reference type.

Specified by:
isReference in interface Type
Overrides:
isReference in class Type_c

toReference

public ReferenceType toReference()
Description copied from class: Type_c
Returns a non-null iff isReference() returns true.

Specified by:
toReference in interface Type
Overrides:
toReference in class Type_c

methods

public abstract java.util.List methods()
Returns a list of MethodInstances for all the methods declared in this. It does not return methods declared in supertypes.

Specified by:
methods in interface ReferenceType
Returns:
A list of MethodInstance.
See Also:
MethodInstance

fields

public abstract java.util.List fields()
Returns a list of FieldInstances for all the fields declared in this. It does not return fields declared in supertypes.

Specified by:
fields in interface ReferenceType
Returns:
A list of FieldInstance.
See Also:
FieldInstance

superType

public abstract Type superType()
Returns the supertype of this class. For every class except Object, this is non-null.

Specified by:
superType in interface ReferenceType

interfaces

public abstract java.util.List interfaces()
Returns a list of the types of this class's interfaces.

Specified by:
interfaces in interface ReferenceType
Returns:
A list of Type.
See Also:
Type

hasMethod

public final boolean hasMethod(MethodInstance mi)
Return true if t has a method mi

Specified by:
hasMethod in interface ReferenceType

hasMethodImpl

public boolean hasMethodImpl(MethodInstance mi)
Return true if t has a method mi

Specified by:
hasMethodImpl in interface ReferenceType

descendsFromImpl

public boolean descendsFromImpl(Type ancestor)
Description copied from class: Type_c
Return true if this type descends from ancestor.

Specified by:
descendsFromImpl in interface Type
Overrides:
descendsFromImpl in class Type_c

isImplicitCastValidImpl

public boolean isImplicitCastValidImpl(Type toType)
Description copied from class: Type_c
Return true if a value of this type can be assigned to a variable of type toType.

Specified by:
isImplicitCastValidImpl in interface Type
Overrides:
isImplicitCastValidImpl in class Type_c

methodsNamed

public java.util.List methodsNamed(java.lang.String name)
Description copied from interface: ReferenceType
Return the methods named name, if any.

Specified by:
methodsNamed in interface ReferenceType
Parameters:
name - Name of the method to search for.
Returns:
A list of MethodInstance.
See Also:
MethodInstance

methods

public java.util.List methods(java.lang.String name,
                              java.util.List argTypes)
Description copied from interface: ReferenceType
Return the methods named name with the given formal parameter types, if any.

Specified by:
methods in interface ReferenceType
Parameters:
name - Name of the method to search for.
argTypes - A list of Type.
Returns:
A list of MethodInstance.
See Also:
Type, MethodInstance

isCastValidImpl

public boolean isCastValidImpl(Type toType)
Requires: all type arguments are canonical. ToType is not a NullType. Returns true iff a cast from this to toType is valid; in other words, some non-null members of this are also members of toType.

Specified by:
isCastValidImpl in interface Type
Overrides:
isCastValidImpl in class Type_c