Package gnu.kawa.reflect
Class MappedArrayType
java.lang.Object
gnu.bytecode.Type
gnu.bytecode.ObjectType
gnu.kawa.reflect.MappedArrayType
An array type where elements are copied from a sequence.
A MappedArrayType[T] is implemented using a T (native) array.
It is compatible with a sequence whose elements are compatible with T.
Each element is copied (with coercion) from the sequence into the array.
-
Nested Class Summary
Nested classes/interfaces inherited from class gnu.bytecode.Type
Type.NeverReturns
-
Field Summary
FieldsFields inherited from class gnu.bytecode.ObjectType
flags
Fields inherited from class gnu.bytecode.Type
boolean_ctype, boolean_type, booleanType, booleanValue_method, byte_type, byteType, char_type, charType, clone_method, double_type, doubleType, doubleValue_method, errorType, float_type, floatType, floatValue_method, int_type, intType, intValue_method, java_lang_Class_type, javalangannotationAnnotationType, javalangBooleanType, javalangCharacterType, javalangClassType, javalanginvokeMethodHandleType, javalangNumberType, javalangObjectType, javalangStringType, javalangThrowableType, long_type, longType, longValue_method, neverReturnsType, nullType, number_type, objectType, pointer_type, reflectClass, short_type, shortType, string_type, throwable_type, toString_method, tostring_type, toStringType, typeArray0, void_type, voidType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertValue
(Expression value) Return converted expression or null.void
emitCoerceFromObject
(CodeAttr code) Compile (in given method) cast from Object to this Type.void
emitIsInstance
(Variable incoming, Compilation comp, Target target) Emit code for incoming instanceof this_type.void
emitTestIf
(Variable incoming, Declaration decl, Compilation comp) Emit code for if (incoming instanceof this_type) decl = incoming ....encodeType
(Language language) Get the constructor function for this type.Return Java-level implementation type.getName()
If this is a type alias, get the aliased type.int
isCompatibleWithValue
(Type valueType) If this is the target type, is a given source type compatible?static Type
toString()
Methods inherited from class gnu.bytecode.ObjectType
coerceFromObject, compare, getContextClass, getContextClassLoader, getField, getInterfaces, getInternalName, getMethod, getMethods, getMethods, getReflectClass, getSuperclass, isExisting, isInstance, setExisting
Methods inherited from class gnu.bytecode.Type
coerceToObject, emitCoerceToObject, emitConvertFromPrimitive, emitIsInstance, getGenericSignature, getMaybeGenericSignature, getRawType, getSignature, getSize, getSizeInWords, getType, hashCode, isCompatibleWithValue, isInterface, isMoreSpecific, isSame, isSubtype, isValidJavaTypeName, isVoid, lookupType, lowestCommonSharedType, lowestCommonSuperType, make, make, printSignature, promote, promoteIfUnsigned, registerTypeForClass, setGenericSignature, setName, setReflectClass, setSignature, signatureLength, signatureLength, signatureToName, signatureToPrimitive, signatureToType, signatureToType, swappedCompareResult
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.reflect.Type
getTypeName
-
Field Details
-
implementationType
-
-
Constructor Details
-
MappedArrayType
-
-
Method Details
-
maybe
-
getComponentType
-
getImplementationType
Description copied from class:Type
Return Java-level implementation type. The type used to implement types not natively understood by the JVM or the Java language. Usually, the identity function. However, a language might handle union types or template types or type expressions calculated at run time. In that case return the type used at the Java level, and known at compile time.- Specified by:
getImplementationType
in interfaceTypeValue
- Overrides:
getImplementationType
in classType
-
getRealType
Description copied from class:Type
If this is a type alias, get the aliased type. This is semi-deprecated.- Overrides:
getRealType
in classType
-
emitTestIf
Description copied from interface:TypeValue
Emit code for if (incoming instanceof this_type) decl = incoming .... This method is designed for typeswitch applications, where this call is the first part of a conditional, so it must be followed by calls to emitElse and emitFi.- Specified by:
emitTestIf
in interfaceTypeValue
- Parameters:
incoming
- Contains the value we are testing to see if it has the type of this. If null, use top-of-stack. May not be null if decl is non-null.decl
- If non-null, assign value after coercion to Declaration.comp
- The compilation state.
-
toString
-
getName
-
isCompatibleWithValue
Description copied from class:Type
If this is the target type, is a given source type compatible?- Overrides:
isCompatibleWithValue
in classType
- Returns:
- -1 if not compatible; 0 if need to check at run-time; 1 if compatible; 2 if compatible and no conversion or cast needed. We also return 0 for some "narrowing" conversions even if we know they will always succeed, so as to make such conversions less preferred when doing method overloading.
-
convertValue
Description copied from interface:TypeValue
Return converted expression or null.- Specified by:
convertValue
in interfaceTypeValue
-
getConstructor
Description copied from interface:TypeValue
Get the constructor function for this type. Returns null if there is no contructor function. Also returns null if this extends ClassType or ArrayType and standard Java constructors (<init>
methods) should be used.- Specified by:
getConstructor
in interfaceTypeValue
-
emitIsInstance
Description copied from interface:TypeValue
Emit code for incoming instanceof this_type. The implementation can useInstanceOf .emitIsInstance
which is a conveniece method that callsemitTestIf
.- Specified by:
emitIsInstance
in interfaceTypeValue
- Parameters:
incoming
- Contains the value we are testing to see if it has the the type of 'this'. If null, use top-of-stack.comp
- The compilation state.target
- Where to leave the result.
-
encodeType
- Specified by:
encodeType
in interfaceTypeValue
-
emitCoerceFromObject
Description copied from class:ObjectType
Compile (in given method) cast from Object to this Type.- Overrides:
emitCoerceFromObject
in classObjectType
-