pass the component class index

This commit is contained in:
Volker Berlin 2020-06-20 11:54:51 +02:00
parent 0433a4d0d4
commit 852bb25158
2 changed files with 21 additions and 1 deletions

View File

@ -803,6 +803,15 @@ public class TypeManager {
return classIndex;
}
/**
* The running index of the component/array class/type for class meta data, instanceof and interface calls.
*
* @return the unique index or -1 id not an array
*/
protected int getComponentClassIndex() {
return -1;
}
/**
* Get the fields of this struct
* @return the fields
@ -885,7 +894,7 @@ public class TypeManager {
header.writeInt32( classNameIdx ); // string id of the className
// header position TYPE_DESCRIPTION_ARRAY_TYPE
header.writeInt32( -1 );
header.writeInt32( getComponentClassIndex() );
data.writeTo( dataStream );
}

View File

@ -27,6 +27,8 @@ public class ArrayType extends StructType {
private AnyType arrayType;
private int componentClassIndex;
/**
* Create a new array type
*
@ -41,6 +43,7 @@ public class ArrayType extends StructType {
//TODO name
super( "[", classIndex );
this.arrayType = arrayType;
this.componentClassIndex = componentClassIndex;
}
/**
@ -51,6 +54,14 @@ public class ArrayType extends StructType {
return arrayType;
}
/**
* {@inheritDoc}
*/
@Override
protected int getComponentClassIndex() {
return componentClassIndex;
}
/**
* {@inheritDoc}
*/