java.lang.Object
nice.tools.code.Types
- public final class Types
- extends java.lang.Object
Conversion between Nice and bytecode types.
- Version:
- $Date: 2003/12/03 21:50:41 $
|
Constructor Summary |
Types()
|
|
Method Summary |
static mlsub.typing.Polytype |
addSure(mlsub.typing.Polytype type)
Transforms \forall T:K.U into \forall T:K.sure |
static mlsub.typing.Monotype |
codomain(mlsub.typing.Polytype type)
|
static gnu.expr.Expression |
defaultValue(mlsub.typing.Monotype m)
Default values |
static mlsub.typing.Monotype[] |
domain(mlsub.typing.Monotype type)
|
static mlsub.typing.Monotype[] |
domain(mlsub.typing.Polytype type)
|
static mlsub.typing.Monotype |
equivalent(mlsub.typing.Monotype m)
|
static gnu.bytecode.Type |
equivalentObjectType(gnu.bytecode.Type t)
Manipulating bytecode types |
static gnu.bytecode.Type |
get(mlsub.typing.Monotype m)
|
static gnu.bytecode.Type |
get(mlsub.typing.TypeConstructor tc)
|
private static mlsub.typing.Monotype |
getMonotype(java.lang.String name)
|
private static mlsub.typing.Monotype |
getMonotype(gnu.bytecode.Type javaType,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables)
|
private static mlsub.typing.Monotype |
getMonotype(gnu.bytecode.Type javaType,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables,
boolean arraySure)
|
static boolean |
isMaybe(mlsub.typing.Monotype m)
Manipulations on nice types |
static boolean |
isPrimitive(mlsub.typing.TypeConstructor tc)
|
static boolean |
isSure(mlsub.typing.Monotype m)
|
static boolean |
isVoid(mlsub.typing.Monotype m)
Predicates |
static boolean |
isVoid(mlsub.typing.Polytype t)
|
static gnu.bytecode.Type |
javaType(mlsub.typing.Monotype m)
Return the bytecode type used to represent objects of this type. |
static gnu.bytecode.Type[] |
javaType(mlsub.typing.Monotype[] ms)
|
static gnu.bytecode.Type |
javaType(mlsub.typing.Polytype t)
|
static gnu.bytecode.Type |
javaType(mlsub.typing.TypeConstructor tc)
|
private static gnu.bytecode.Type |
javaTypeOrNull(mlsub.typing.Monotype m)
|
static gnu.bytecode.Type |
lowestCommonSupertype(mlsub.typing.Monotype[] types)
|
(package private) static gnu.bytecode.Type |
lowestCommonSupertype(gnu.bytecode.Type[] types)
|
static void |
makeMarkedType(mlsub.typing.MonotypeVar m)
|
static mlsub.typing.Monotype |
monotype(gnu.bytecode.Type javaType)
|
static mlsub.typing.Monotype[] |
monotype(gnu.bytecode.Type[] javaTypes,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables)
|
static mlsub.typing.Monotype |
monotype(gnu.bytecode.Type javaType,
boolean sure)
|
static mlsub.typing.Monotype |
monotype(gnu.bytecode.Type javaType,
boolean sure,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables)
|
static mlsub.typing.Monotype |
monotype(gnu.bytecode.Type javaType,
boolean sure,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables,
boolean arraySure)
Special version for use in Import.java,
it always checks whether nullness info may be added. |
static mlsub.typing.Monotype |
monotype(gnu.bytecode.Type javaType,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables)
|
private static gnu.bytecode.Type |
rawJavaType(mlsub.typing.Monotype m)
|
static mlsub.typing.Monotype |
rawType(mlsub.typing.Monotype m)
return the type with nullness markers removed |
static mlsub.typing.Monotype |
rawType(mlsub.typing.MonotypeConstructor mc)
return the type with nullness markers removed |
static void |
reset()
Reset the state for a new compilation. |
private static void |
set(mlsub.typing.Monotype m,
gnu.bytecode.Type type)
|
static void |
set(mlsub.typing.TypeConstructor tc,
gnu.bytecode.Type type)
|
static void |
setBytecodeType(mlsub.typing.Monotype m)
Prepare m to be given a precise bytecode type if possible. |
static void |
setBytecodeType(mlsub.typing.Monotype[] ms)
Iter setBytecodeType. |
static void |
setBytecodeType(mlsub.typing.Polytype t)
|
static void |
setMarkedKind(mlsub.typing.Monotype m)
|
static gnu.bytecode.Type |
type(bossa.syntax.LocatedString name)
Converting string to gnu.bytecode.Type |
static gnu.bytecode.Type |
type(java.lang.String s,
bossa.util.Location loc)
|
static mlsub.typing.TypeConstructor |
typeConstructor(gnu.bytecode.Type javaType)
Converting a bytecode type (coming from reflection for instance)
into a Nice type. |
static gnu.bytecode.Type |
typeRepresentationToBytecode(java.lang.String type,
bossa.util.Location loc)
The type is not necessarily fully qulified. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
tcToGBType
private static java.util.HashMap tcToGBType
- Mapping TCs to gnu.bytecode.Types
zeroInt
private static gnu.expr.Expression zeroInt
zeroFloat
private static gnu.expr.Expression zeroFloat
zeroChar
private static gnu.expr.Expression zeroChar
Types
public Types()
set
public static void set(mlsub.typing.TypeConstructor tc,
gnu.bytecode.Type type)
set
private static void set(mlsub.typing.Monotype m,
gnu.bytecode.Type type)
get
public static gnu.bytecode.Type get(mlsub.typing.TypeConstructor tc)
get
public static gnu.bytecode.Type get(mlsub.typing.Monotype m)
javaType
public static gnu.bytecode.Type javaType(mlsub.typing.TypeConstructor tc)
setBytecodeType
public static void setBytecodeType(mlsub.typing.Monotype m)
- Prepare m to be given a precise bytecode type if possible.
Be careful:
Type components of m must be valid.
That is, englobing constraints must be asserted.
setBytecodeType
public static void setBytecodeType(mlsub.typing.Monotype[] ms)
- Iter setBytecodeType.
setBytecodeType
public static void setBytecodeType(mlsub.typing.Polytype t)
javaType
public static gnu.bytecode.Type javaType(mlsub.typing.Monotype m)
- Return the bytecode type used to represent objects of this type.
You might want use the
setBytecodeType(mlsub.typing.Monotype) 55
method before to make result more precise.
javaTypeOrNull
private static gnu.bytecode.Type javaTypeOrNull(mlsub.typing.Monotype m)
rawJavaType
private static gnu.bytecode.Type rawJavaType(mlsub.typing.Monotype m)
javaType
public static gnu.bytecode.Type[] javaType(mlsub.typing.Monotype[] ms)
javaType
public static gnu.bytecode.Type javaType(mlsub.typing.Polytype t)
lowestCommonSupertype
public static gnu.bytecode.Type lowestCommonSupertype(mlsub.typing.Monotype[] types)
lowestCommonSupertype
static gnu.bytecode.Type lowestCommonSupertype(gnu.bytecode.Type[] types)
typeConstructor
public static mlsub.typing.TypeConstructor typeConstructor(gnu.bytecode.Type javaType)
throws Types.NotIntroducedClassException
- Converting a bytecode type (coming from reflection for instance)
into a Nice type.
Used for automatic declaration of java methods.
monotype
public static mlsub.typing.Monotype[] monotype(gnu.bytecode.Type[] javaTypes,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables)
throws Types.ParametricClassException,
Types.NotIntroducedClassException
monotype
public static mlsub.typing.Monotype monotype(gnu.bytecode.Type javaType,
boolean sure)
throws Types.ParametricClassException,
Types.NotIntroducedClassException
monotype
public static mlsub.typing.Monotype monotype(gnu.bytecode.Type javaType,
boolean sure,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables)
throws Types.ParametricClassException,
Types.NotIntroducedClassException
monotype
public static mlsub.typing.Monotype monotype(gnu.bytecode.Type javaType)
throws Types.ParametricClassException,
Types.NotIntroducedClassException
monotype
public static mlsub.typing.Monotype monotype(gnu.bytecode.Type javaType,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables)
throws Types.ParametricClassException,
Types.NotIntroducedClassException
monotype
public static mlsub.typing.Monotype monotype(gnu.bytecode.Type javaType,
boolean sure,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables,
boolean arraySure)
throws Types.ParametricClassException,
Types.NotIntroducedClassException
- Special version for use in Import.java,
it always checks whether nullness info may be added.
And can handle arrays different(not yet implemented)
getMonotype
private static mlsub.typing.Monotype getMonotype(gnu.bytecode.Type javaType,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables)
throws Types.ParametricClassException,
Types.NotIntroducedClassException
getMonotype
private static mlsub.typing.Monotype getMonotype(gnu.bytecode.Type javaType,
gnu.bytecode.TypeVariable[] typeVariables,
mlsub.typing.TypeSymbol[] niceTypeVariables,
boolean arraySure)
throws Types.ParametricClassException,
Types.NotIntroducedClassException
getMonotype
private static mlsub.typing.Monotype getMonotype(java.lang.String name)
throws Types.ParametricClassException,
Types.NotIntroducedClassException
type
public static final gnu.bytecode.Type type(bossa.syntax.LocatedString name)
- Converting string to gnu.bytecode.Type
type
public static final gnu.bytecode.Type type(java.lang.String s,
bossa.util.Location loc)
typeRepresentationToBytecode
public static final gnu.bytecode.Type typeRepresentationToBytecode(java.lang.String type,
bossa.util.Location loc)
- The type is not necessarily fully qulified.
equivalentObjectType
public static gnu.bytecode.Type equivalentObjectType(gnu.bytecode.Type t)
- Manipulating bytecode types
defaultValue
public static gnu.expr.Expression defaultValue(mlsub.typing.Monotype m)
- Default values
isVoid
public static boolean isVoid(mlsub.typing.Monotype m)
- Predicates
isVoid
public static boolean isVoid(mlsub.typing.Polytype t)
isPrimitive
public static boolean isPrimitive(mlsub.typing.TypeConstructor tc)
isMaybe
public static boolean isMaybe(mlsub.typing.Monotype m)
- Manipulations on nice types
isSure
public static boolean isSure(mlsub.typing.Monotype m)
equivalent
public static mlsub.typing.Monotype equivalent(mlsub.typing.Monotype m)
setMarkedKind
public static void setMarkedKind(mlsub.typing.Monotype m)
makeMarkedType
public static void makeMarkedType(mlsub.typing.MonotypeVar m)
rawType
public static mlsub.typing.Monotype rawType(mlsub.typing.Monotype m)
- return the type with nullness markers removed
rawType
public static mlsub.typing.Monotype rawType(mlsub.typing.MonotypeConstructor mc)
- return the type with nullness markers removed
domain
public static mlsub.typing.Monotype[] domain(mlsub.typing.Monotype type)
domain
public static mlsub.typing.Monotype[] domain(mlsub.typing.Polytype type)
codomain
public static mlsub.typing.Monotype codomain(mlsub.typing.Polytype type)
addSure
public static mlsub.typing.Polytype addSure(mlsub.typing.Polytype type)
- Transforms \forall T:K.U into \forall T:K.sure
reset
public static void reset()
- Reset the state for a new compilation.