MCPcopy Index your code
hub / github.com/clojure/clojure / readTypeAnnotationTarget

Method readTypeAnnotationTarget

src/jvm/clojure/asm/ClassReader.java:2618–2688  ·  view source on GitHub ↗

Parses the header of a JVMS type_annotation structure to extract its target_type, target_info and target_path (the result is stored in the given context), and returns the start offset of the rest of the type_annotation structure. @param context information about the class being parsed. This is wher

(final Context context, final int typeAnnotationOffset)

Source from the content-addressed store, hash-verified

2616 * @return the start offset of the rest of the type_annotation structure.
2617 */
2618 private int readTypeAnnotationTarget(final Context context, final int typeAnnotationOffset) {
2619 int currentOffset = typeAnnotationOffset;
2620 // Parse and store the target_type structure.
2621 int targetType = readInt(typeAnnotationOffset);
2622 switch (targetType >>> 24) {
2623 case TypeReference.CLASS_TYPE_PARAMETER:
2624 case TypeReference.METHOD_TYPE_PARAMETER:
2625 case TypeReference.METHOD_FORMAL_PARAMETER:
2626 targetType &= 0xFFFF0000;
2627 currentOffset += 2;
2628 break;
2629 case TypeReference.FIELD:
2630 case TypeReference.METHOD_RETURN:
2631 case TypeReference.METHOD_RECEIVER:
2632 targetType &= 0xFF000000;
2633 currentOffset += 1;
2634 break;
2635 case TypeReference.LOCAL_VARIABLE:
2636 case TypeReference.RESOURCE_VARIABLE:
2637 targetType &= 0xFF000000;
2638 int tableLength = readUnsignedShort(currentOffset + 1);
2639 currentOffset += 3;
2640 context.currentLocalVariableAnnotationRangeStarts = new Label[tableLength];
2641 context.currentLocalVariableAnnotationRangeEnds = new Label[tableLength];
2642 context.currentLocalVariableAnnotationRangeIndices = new int[tableLength];
2643 for (int i = 0; i < tableLength; ++i) {
2644 int startPc = readUnsignedShort(currentOffset);
2645 int length = readUnsignedShort(currentOffset + 2);
2646 int index = readUnsignedShort(currentOffset + 4);
2647 currentOffset += 6;
2648 context.currentLocalVariableAnnotationRangeStarts[i] =
2649 createLabel(startPc, context.currentMethodLabels);
2650 context.currentLocalVariableAnnotationRangeEnds[i] =
2651 createLabel(startPc + length, context.currentMethodLabels);
2652 context.currentLocalVariableAnnotationRangeIndices[i] = index;
2653 }
2654 break;
2655 case TypeReference.CAST:
2656 case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
2657 case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT:
2658 case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
2659 case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT:
2660 targetType &= 0xFF0000FF;
2661 currentOffset += 4;
2662 break;
2663 case TypeReference.CLASS_EXTENDS:
2664 case TypeReference.CLASS_TYPE_PARAMETER_BOUND:
2665 case TypeReference.METHOD_TYPE_PARAMETER_BOUND:
2666 case TypeReference.THROWS:
2667 case TypeReference.EXCEPTION_PARAMETER:
2668 targetType &= 0xFFFFFF00;
2669 currentOffset += 3;
2670 break;
2671 case TypeReference.INSTANCEOF:
2672 case TypeReference.NEW:
2673 case TypeReference.CONSTRUCTOR_REFERENCE:
2674 case TypeReference.METHOD_REFERENCE:
2675 targetType &= 0xFF000000;

Callers 4

acceptMethod · 0.95
readFieldMethod · 0.95
readMethodMethod · 0.95
readCodeMethod · 0.95

Calls 4

readIntMethod · 0.95
readUnsignedShortMethod · 0.95
createLabelMethod · 0.95
readByteMethod · 0.95

Tested by

no test coverage detected