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
flagsFields 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.voidemitCoerceFromObject(CodeAttr code) Compile (in given method) cast from Object to this Type.voidemitIsInstance(Variable incoming, Compilation comp, Target target) Emit code for incoming instanceof this_type.voidemitTestIf(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.intisCompatibleWithValue(Type valueType) If this is the target type, is a given source type compatible?static TypetoString()Methods inherited from class gnu.bytecode.ObjectType
coerceFromObject, compare, getContextClass, getContextClassLoader, getField, getInterfaces, getInternalName, getMethod, getMethods, getMethods, getReflectClass, getSuperclass, isExisting, isInstance, setExistingMethods 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, swappedCompareResultMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.reflect.Type
getTypeName
-
Field Details
-
implementationType
-
-
Constructor Details
-
MappedArrayType
-
-
Method Details
-
maybe
-
getComponentType
-
getImplementationType
Description copied from class:TypeReturn 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:
getImplementationTypein interfaceTypeValue- Overrides:
getImplementationTypein classType
-
getRealType
Description copied from class:TypeIf this is a type alias, get the aliased type. This is semi-deprecated.- Overrides:
getRealTypein classType
-
emitTestIf
Description copied from interface:TypeValueEmit 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:
emitTestIfin 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:TypeIf this is the target type, is a given source type compatible?- Overrides:
isCompatibleWithValuein 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:TypeValueReturn converted expression or null.- Specified by:
convertValuein interfaceTypeValue
-
getConstructor
Description copied from interface:TypeValueGet 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:
getConstructorin interfaceTypeValue
-
emitIsInstance
Description copied from interface:TypeValueEmit code for incoming instanceof this_type. The implementation can useInstanceOf .emitIsInstancewhich is a conveniece method that callsemitTestIf.- Specified by:
emitIsInstancein 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:
encodeTypein interfaceTypeValue
-
emitCoerceFromObject
Description copied from class:ObjectTypeCompile (in given method) cast from Object to this Type.- Overrides:
emitCoerceFromObjectin classObjectType
-