当前位置: 首页>>代码示例>>Java>>正文


Java TypeReference.CLASS_EXTENDS属性代码示例

本文整理汇总了Java中jdk.internal.org.objectweb.asm.TypeReference.CLASS_EXTENDS属性的典型用法代码示例。如果您正苦于以下问题:Java TypeReference.CLASS_EXTENDS属性的具体用法?Java TypeReference.CLASS_EXTENDS怎么用?Java TypeReference.CLASS_EXTENDS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在jdk.internal.org.objectweb.asm.TypeReference的用法示例。


在下文中一共展示了TypeReference.CLASS_EXTENDS属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitTypeAnnotation

@Override
public AnnotationVisitor visitTypeAnnotation(final int typeRef,
        final TypePath typePath, final String desc, final boolean visible) {
    checkState();
    int sort = typeRef >>> 24;
    if (sort != TypeReference.CLASS_TYPE_PARAMETER
            && sort != TypeReference.CLASS_TYPE_PARAMETER_BOUND
            && sort != TypeReference.CLASS_EXTENDS) {
        throw new IllegalArgumentException("Invalid type reference sort 0x"
                + Integer.toHexString(sort));
    }
    checkTypeRefAndPath(typeRef, typePath);
    CheckMethodAdapter.checkDesc(desc, false);
    return new CheckAnnotationAdapter(super.visitTypeAnnotation(typeRef,
            typePath, desc, visible));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:CheckClassAdapter.java

示例2: checkTypeRefAndPath

/**
 * Checks the reference to a type in a type annotation.
 *
 * @param typeRef
 *            a reference to an annotated type.
 * @param typePath
 *            the path to the annotated type argument, wildcard bound, array
 *            element type, or static inner type within 'typeRef'. May be
 *            <tt>null</tt> if the annotation targets 'typeRef' as a whole.
 */
static void checkTypeRefAndPath(int typeRef, TypePath typePath) {
    int mask = 0;
    switch (typeRef >>> 24) {
    case TypeReference.CLASS_TYPE_PARAMETER:
    case TypeReference.METHOD_TYPE_PARAMETER:
    case TypeReference.METHOD_FORMAL_PARAMETER:
        mask = 0xFFFF0000;
        break;
    case TypeReference.FIELD:
    case TypeReference.METHOD_RETURN:
    case TypeReference.METHOD_RECEIVER:
    case TypeReference.LOCAL_VARIABLE:
    case TypeReference.RESOURCE_VARIABLE:
    case TypeReference.INSTANCEOF:
    case TypeReference.NEW:
    case TypeReference.CONSTRUCTOR_REFERENCE:
    case TypeReference.METHOD_REFERENCE:
        mask = 0xFF000000;
        break;
    case TypeReference.CLASS_EXTENDS:
    case TypeReference.CLASS_TYPE_PARAMETER_BOUND:
    case TypeReference.METHOD_TYPE_PARAMETER_BOUND:
    case TypeReference.THROWS:
    case TypeReference.EXCEPTION_PARAMETER:
        mask = 0xFFFFFF00;
        break;
    case TypeReference.CAST:
    case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
    case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT:
    case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
    case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT:
        mask = 0xFF0000FF;
        break;
    default:
        throw new IllegalArgumentException("Invalid type reference sort 0x"
                + Integer.toHexString(typeRef >>> 24));
    }
    if ((typeRef & ~mask) != 0) {
        throw new IllegalArgumentException("Invalid type reference 0x"
                + Integer.toHexString(typeRef));
    }
    if (typePath != null) {
        for (int i = 0; i < typePath.getLength(); ++i) {
            int step = typePath.getStep(i);
            if (step != TypePath.ARRAY_ELEMENT
                    && step != TypePath.INNER_TYPE
                    && step != TypePath.TYPE_ARGUMENT
                    && step != TypePath.WILDCARD_BOUND) {
                throw new IllegalArgumentException(
                        "Invalid type path step " + i + " in " + typePath);
            }
            if (step != TypePath.TYPE_ARGUMENT
                    && typePath.getStepArgument(i) != 0) {
                throw new IllegalArgumentException(
                        "Invalid type path step argument for step " + i
                                + " in " + typePath);
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:70,代码来源:CheckClassAdapter.java


注:本文中的jdk.internal.org.objectweb.asm.TypeReference.CLASS_EXTENDS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。