Put the given abstract type in the given ByteVector, using the JVMS verification_type_info format used in StackMapTable attributes. @param symbolTable the type table to use to lookup and store type Symbol. @param abstractType an abstract type, restricted to Frame#CONSTANT_KIND, {@li
(
final SymbolTable symbolTable, final int abstractType, final ByteVector output)
| 1399 | * 4.7.4</a> |
| 1400 | */ |
| 1401 | static void putAbstractType( |
| 1402 | final SymbolTable symbolTable, final int abstractType, final ByteVector output) { |
| 1403 | int arrayDimensions = (abstractType & Frame.DIM_MASK) >> DIM_SHIFT; |
| 1404 | if (arrayDimensions == 0) { |
| 1405 | int typeValue = abstractType & VALUE_MASK; |
| 1406 | switch (abstractType & KIND_MASK) { |
| 1407 | case CONSTANT_KIND: |
| 1408 | output.putByte(typeValue); |
| 1409 | break; |
| 1410 | case REFERENCE_KIND: |
| 1411 | output |
| 1412 | .putByte(ITEM_OBJECT) |
| 1413 | .putShort(symbolTable.addConstantClass(symbolTable.getType(typeValue).value).index); |
| 1414 | break; |
| 1415 | case UNINITIALIZED_KIND: |
| 1416 | output.putByte(ITEM_UNINITIALIZED).putShort((int) symbolTable.getType(typeValue).data); |
| 1417 | break; |
| 1418 | default: |
| 1419 | throw new AssertionError(); |
| 1420 | } |
| 1421 | } else { |
| 1422 | // Case of an array type, we need to build its descriptor first. |
| 1423 | StringBuilder typeDescriptor = new StringBuilder(); |
| 1424 | while (arrayDimensions-- > 0) { |
| 1425 | typeDescriptor.append('['); |
| 1426 | } |
| 1427 | if ((abstractType & KIND_MASK) == REFERENCE_KIND) { |
| 1428 | typeDescriptor |
| 1429 | .append('L') |
| 1430 | .append(symbolTable.getType(abstractType & VALUE_MASK).value) |
| 1431 | .append(';'); |
| 1432 | } else { |
| 1433 | switch (abstractType & VALUE_MASK) { |
| 1434 | case Frame.ITEM_ASM_BOOLEAN: |
| 1435 | typeDescriptor.append('Z'); |
| 1436 | break; |
| 1437 | case Frame.ITEM_ASM_BYTE: |
| 1438 | typeDescriptor.append('B'); |
| 1439 | break; |
| 1440 | case Frame.ITEM_ASM_CHAR: |
| 1441 | typeDescriptor.append('C'); |
| 1442 | break; |
| 1443 | case Frame.ITEM_ASM_SHORT: |
| 1444 | typeDescriptor.append('S'); |
| 1445 | break; |
| 1446 | case Frame.ITEM_INTEGER: |
| 1447 | typeDescriptor.append('I'); |
| 1448 | break; |
| 1449 | case Frame.ITEM_FLOAT: |
| 1450 | typeDescriptor.append('F'); |
| 1451 | break; |
| 1452 | case Frame.ITEM_LONG: |
| 1453 | typeDescriptor.append('J'); |
| 1454 | break; |
| 1455 | case Frame.ITEM_DOUBLE: |
| 1456 | typeDescriptor.append('D'); |
| 1457 | break; |
| 1458 | default: |
no test coverage detected