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


Java ResolvedJavaMethod.getAnnotation方法代码示例

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


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

示例1: checkMethod

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
private static void checkMethod(ResolvedJavaMethod method) {
    if (method.getAnnotation(Snippet.class) == null) {
        Annotation[][] parameterAnnotations = method.getParameterAnnotations();
        for (int i = 0; i < parameterAnnotations.length; i++) {
            for (Annotation a : parameterAnnotations[i]) {
                Class<? extends Annotation> annotationType = a.annotationType();
                if (annotationType == ConstantParameter.class || annotationType == VarargsParameter.class || annotationType == NonNullParameter.class) {
                    VerificationError verificationError = new VerificationError("Parameter %d of %s is annotated with %s but the method is not annotated with %s", i, method,
                                    annotationType.getSimpleName(),
                                    Snippet.class.getSimpleName());
                    throw verificationError;
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:CheckGraalInvariants.java

示例2: getAnnotation

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
/**
 * A helper for {@link ResolvedJavaMethod#getAnnotation(Class)} that handles the absence of
 * annotations on bridge methods where the bridged method has annotations.
 */
public static <T extends Annotation> T getAnnotation(Class<T> annotationClass, ResolvedJavaMethod method) {
    T a = method.getAnnotation(annotationClass);
    if (a == null && method.isBridge()) {
        ResolvedJavaMethod bridged = getBridgedMethod(method);
        if (bridged != null) {
            a = bridged.getAnnotation(annotationClass);
        }
    }
    return a;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:BridgeMethodUtils.java

示例3: getNodeCountAnnotations

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
private static List<NodeCount> getNodeCountAnnotations(StructuredGraph graph) {
    ResolvedJavaMethod method = graph.method();
    AnchorSnippet snippet = method.getAnnotation(AnchorSnippet.class);
    if (snippet != null) {
        return Arrays.asList(snippet.value());
    }

    NodeCount single = method.getAnnotation(NodeCount.class);
    if (single != null) {
        return Collections.singletonList(single);
    }

    return Collections.emptyList();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:ControlFlowAnchorDirectiveTest.java

示例4: raiseInvalidFrameStateError

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
protected void raiseInvalidFrameStateError(FrameState state) throws GraalGraphError {
    // This is a hard error since an incorrect state could crash hotspot
    NodeSourcePosition sourcePosition = state.getNodeSourcePosition();
    List<String> context = new ArrayList<>();
    ResolvedJavaMethod replacementMethodWithProblematicSideEffect = null;
    if (sourcePosition != null) {
        NodeSourcePosition pos = sourcePosition;
        while (pos != null) {
            StringBuilder sb = new StringBuilder("parsing ");
            ResolvedJavaMethod method = pos.getMethod();
            MetaUtil.appendLocation(sb, method, pos.getBCI());
            if (method.getAnnotation(MethodSubstitution.class) != null ||
                            method.getAnnotation(Snippet.class) != null) {
                replacementMethodWithProblematicSideEffect = method;
            }
            context.add(sb.toString());
            pos = pos.getCaller();
        }
    }
    String message = "Invalid frame state " + state;
    if (replacementMethodWithProblematicSideEffect != null) {
        message += " associated with a side effect in " + replacementMethodWithProblematicSideEffect.format("%H.%n(%p)") + " at a position that cannot be deoptimized to";
    }
    GraalGraphError error = new GraalGraphError(message);
    for (String c : context) {
        error.addContext(c);
    }
    throw error;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:HotSpotDebugInfoBuilder.java

示例5: getAnnotationTest

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
@Test
@TestAnnotation(value = 1000L)
public void getAnnotationTest() throws NoSuchMethodException {
    ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("getAnnotationTest"));
    TestAnnotation annotation = method.getAnnotation(TestAnnotation.class);
    assertNotNull(annotation);
    assertEquals(1000L, annotation.value());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:TestResolvedJavaMethod.java

示例6: hasGeneratedInvocationPluginAnnotation

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
protected boolean hasGeneratedInvocationPluginAnnotation(ResolvedJavaMethod method) {
    return method.getAnnotation(Node.NodeIntrinsic.class) != null || method.getAnnotation(Fold.class) != null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ReplacementsImpl.java

示例7: hasGenericInvocationPluginAnnotation

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
protected boolean hasGenericInvocationPluginAnnotation(ResolvedJavaMethod method) {
    return method.getAnnotation(Word.Operation.class) != null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ReplacementsImpl.java

示例8: hasGenericInvocationPluginAnnotation

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
@Override
protected boolean hasGenericInvocationPluginAnnotation(ResolvedJavaMethod method) {
    return method.getAnnotation(HotSpotOperation.class) != null || super.hasGenericInvocationPluginAnnotation(method);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:HotSpotReplacementsImpl.java

示例9: isSignaturePolymorphic

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
private static boolean isSignaturePolymorphic(ResolvedJavaMethod method) {
    return method.getAnnotation(SIGNATURE_POLYMORPHIC_CLASS) != null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:TestResolvedJavaType.java


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