Package gw.internal.gosu.parser
Class TypeVariableType
- java.lang.Object
-
- gw.lang.reflect.AbstractType
-
- gw.internal.gosu.parser.TypeVariableType
-
- All Implemented Interfaces:
INonLoadableType,IType,ITypeVariableType,Serializable
public class TypeVariableType extends AbstractType implements ITypeVariableType
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface gw.lang.reflect.IType
EMPTY_ARRAY, EMPTY_TYPE_ARRAY, EMPTY_TYPE_LIST
-
-
Constructor Summary
Constructors Constructor Description TypeVariableType(ITypeVariableDefinition typeVarDef, boolean forFunction)TypeVariableType(IType ownersType, IGenericTypeVariable typeVar)
-
Method Summary
-
Methods inherited from class gw.lang.reflect.AbstractType
getLiteralMetaType, getMetaType, getTheRef
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.lang.reflect.IType
compile, getFunctionalInterface, getLiteralMetaType, getMetaType, getSourceFiles, isCompilable, isDynamic
-
-
-
-
Constructor Detail
-
TypeVariableType
public TypeVariableType(ITypeVariableDefinition typeVarDef, boolean forFunction)
-
TypeVariableType
public TypeVariableType(IType ownersType, IGenericTypeVariable typeVar)
-
-
Method Detail
-
getTypeVarDef
public ITypeVariableDefinition getTypeVarDef()
- Specified by:
getTypeVarDefin interfaceITypeVariableType
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayNamein interfaceIType
-
getRelativeName
public String getRelativeName()
- Specified by:
getRelativeNamein interfaceIType
-
getNameWithEnclosingType
public String getNameWithEnclosingType()
- Specified by:
getNameWithEnclosingTypein interfaceITypeVariableType
-
getNameWithBoundingType
public String getNameWithBoundingType()
-
getNamespace
public String getNamespace()
- Specified by:
getNamespacein interfaceIType
-
getTypeLoader
public ITypeLoader getTypeLoader()
- Specified by:
getTypeLoaderin interfaceIType
-
getBoundingType
public IType getBoundingType()
- Specified by:
getBoundingTypein interfaceITypeVariableType
-
isInterface
public boolean isInterface()
- Specified by:
isInterfacein interfaceIType
-
getInterfaces
public IType[] getInterfaces()
- Specified by:
getInterfacesin interfaceIType
-
getSupertype
public IType getSupertype()
- Specified by:
getSupertypein interfaceIType
-
getEnclosingType
public IType getEnclosingType()
- Specified by:
getEnclosingTypein interfaceIType
-
getGenericType
public IType getGenericType()
- Specified by:
getGenericTypein interfaceIType
-
isParameterizedType
public boolean isParameterizedType()
- Specified by:
isParameterizedTypein interfaceIType
-
isGenericType
public boolean isGenericType()
- Specified by:
isGenericTypein interfaceIType
-
getGenericTypeVariables
public GenericTypeVariable[] getGenericTypeVariables()
- Specified by:
getGenericTypeVariablesin interfaceIType
-
getParameterizedType
public IType getParameterizedType(IType... ofType)
- Specified by:
getParameterizedTypein interfaceIType
-
getTypeParameters
public IType[] getTypeParameters()
- Specified by:
getTypeParametersin interfaceIType
-
getAllTypesInHierarchy
public Set<IType> getAllTypesInHierarchy()
- Specified by:
getAllTypesInHierarchyin interfaceIType
-
isPrimitive
public boolean isPrimitive()
- Specified by:
isPrimitivein interfaceIType
-
getArrayType
public IType getArrayType()
- Specified by:
getArrayTypein interfaceIType
-
makeArrayInstance
public Object makeArrayInstance(int iLength)
- Specified by:
makeArrayInstancein interfaceIType
-
getArrayComponent
public Object getArrayComponent(Object array, int iIndex) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
- Specified by:
getArrayComponentin interfaceIType- Throws:
IllegalArgumentExceptionArrayIndexOutOfBoundsException
-
setArrayComponent
public void setArrayComponent(Object array, int iIndex, Object value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
- Specified by:
setArrayComponentin interfaceIType- Throws:
IllegalArgumentExceptionArrayIndexOutOfBoundsException
-
getArrayLength
public int getArrayLength(Object array) throws IllegalArgumentException
- Specified by:
getArrayLengthin interfaceIType- Throws:
IllegalArgumentException
-
getComponentType
public IType getComponentType()
- Specified by:
getComponentTypein interfaceIType
-
isAssignableFrom
public boolean isAssignableFrom(IType type)
A type variable type is assignable only to/from itself or a reference thereof.For example:
function foo
( t: T, s: S ) { t = s // illegal, T and S may not have the same type at runtime t = "hello" // illegal, T may not be a String var x: T = t // ok, x and t are both of type T } - Specified by:
isAssignableFromin interfaceIType
-
equals
public boolean equals(Object obj)
Ok, here's the deal. By all rights type variable types should have identity equality. That's not the case right now for at least these two reasons:- We compile in multiple phases (header, decl, def). Each phase recompiles the header, including type vars. Each time a new type var type is created for the type var definition. It's not too hard to re-use the prior type var type, but then there's this problem...
- If a subclass is generic and parameterizes its super with its type vars the super parameterizd type retains whatever the type var type from the first phase of the subclass' compilation. And, in studio, we don't refresh the type system, just the type we're editing. So the super class parameterized with the subclass' type vars and whatever else stemming from there that refs the type vars remains. So the subclass can be edited and refreshed a zillion time, but the super parameterized class will still have the type var from way back.
-
getTypeInfo
public ITypeInfo getTypeInfo()
- Specified by:
getTypeInfoin interfaceIType
-
unloadTypeInfo
public void unloadTypeInfo()
- Specified by:
unloadTypeInfoin interfaceIType
-
readResolve
public Object readResolve() throws ObjectStreamException
- Specified by:
readResolvein interfaceIType- Throws:
ObjectStreamException
-
getModifiers
public int getModifiers()
- Specified by:
getModifiersin interfaceIType
-
isAbstract
public boolean isAbstract()
- Specified by:
isAbstractin interfaceIType
-
isFunctionStatement
public boolean isFunctionStatement()
- Specified by:
isFunctionStatementin interfaceITypeVariableType
-
isDiscarded
public boolean isDiscarded()
- Specified by:
isDiscardedin interfaceIType
-
setDiscarded
public void setDiscarded(boolean bDiscarded)
- Specified by:
setDiscardedin interfaceIType
-
isCompoundType
public boolean isCompoundType()
- Specified by:
isCompoundTypein interfaceIType
-
getCompoundTypeComponents
public Set<IType> getCompoundTypeComponents()
- Specified by:
getCompoundTypeComponentsin interfaceIType
-
-