Search in sources :

Example 6 with TypeReference

use of org.apache.tapestry5.internal.plastic.asm.TypeReference in project tapestry-5 by apache.

the class CheckMethodAdapter method visitLocalVariableAnnotation.

@Override
public AnnotationVisitor visitLocalVariableAnnotation(final int typeRef, final TypePath typePath, final Label[] start, final Label[] end, final int[] index, final String descriptor, final boolean visible) {
    checkVisitCodeCalled();
    checkVisitMaxsNotCalled();
    int sort = new TypeReference(typeRef).getSort();
    if (sort != TypeReference.LOCAL_VARIABLE && sort != TypeReference.RESOURCE_VARIABLE) {
        throw new IllegalArgumentException(INVALID_TYPE_REFERENCE + Integer.toHexString(sort));
    }
    CheckClassAdapter.checkTypeRef(typeRef);
    checkDescriptor(version, descriptor, false);
    if (start == null || end == null || index == null || end.length != start.length || index.length != start.length) {
        throw new IllegalArgumentException("Invalid start, end and index arrays (must be non null and of identical length");
    }
    for (int i = 0; i < start.length; ++i) {
        checkLabel(start[i], true, START_LABEL);
        checkLabel(end[i], true, END_LABEL);
        checkUnsignedShort(index[i], INVALID_LOCAL_VARIABLE_INDEX);
        int startInsnIndex = labelInsnIndices.get(start[i]).intValue();
        int endInsnIndex = labelInsnIndices.get(end[i]).intValue();
        if (endInsnIndex < startInsnIndex) {
            throw new IllegalArgumentException("Invalid start and end labels (end must be greater than start)");
        }
    }
    return super.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, descriptor, visible);
}
Also used : TypeReference(org.apache.tapestry5.internal.plastic.asm.TypeReference)

Example 7 with TypeReference

use of org.apache.tapestry5.internal.plastic.asm.TypeReference in project tapestry-5 by apache.

the class CheckRecordComponentAdapter method visitTypeAnnotation.

@Override
public AnnotationVisitor visitTypeAnnotation(final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
    checkVisitEndNotCalled();
    int sort = new TypeReference(typeRef).getSort();
    if (sort != TypeReference.FIELD) {
        throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort));
    }
    CheckClassAdapter.checkTypeRef(typeRef);
    CheckMethodAdapter.checkDescriptor(Opcodes.V1_5, descriptor, false);
    return new CheckAnnotationAdapter(super.visitTypeAnnotation(typeRef, typePath, descriptor, visible));
}
Also used : TypeReference(org.apache.tapestry5.internal.plastic.asm.TypeReference)

Aggregations

TypeReference (org.apache.tapestry5.internal.plastic.asm.TypeReference)7