本文整理匯總了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;
}
}
}
}
}
示例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;
}
示例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();
}
示例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;
}
示例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());
}
示例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;
}
示例7: hasGenericInvocationPluginAnnotation
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
protected boolean hasGenericInvocationPluginAnnotation(ResolvedJavaMethod method) {
return method.getAnnotation(Word.Operation.class) != null;
}
示例8: hasGenericInvocationPluginAnnotation
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
@Override
protected boolean hasGenericInvocationPluginAnnotation(ResolvedJavaMethod method) {
return method.getAnnotation(HotSpotOperation.class) != null || super.hasGenericInvocationPluginAnnotation(method);
}
示例9: isSignaturePolymorphic
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
private static boolean isSignaturePolymorphic(ResolvedJavaMethod method) {
return method.getAnnotation(SIGNATURE_POLYMORPHIC_CLASS) != null;
}