comparison jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaMethod.java @ 23376:ae27c683c128

Make ResolvedJava* types extend AnnotatedElement. Contributed-by: Vojin Jovanovic <vojin.jovanovic@oracle.com>
author Roland Schatz <roland.schatz@oracle.com>
date Fri, 06 May 2016 13:21:20 +0200
parents 1c4b6a7f1917
children 6542cd8da2da
comparison
equal deleted inserted replaced
23375:3f70efb8f473 23376:ae27c683c128
22 */ 22 */
23 package jdk.vm.ci.meta; 23 package jdk.vm.ci.meta;
24 24
25 import java.lang.annotation.Annotation; 25 import java.lang.annotation.Annotation;
26 import java.lang.invoke.MethodHandle; 26 import java.lang.invoke.MethodHandle;
27 import java.lang.reflect.AnnotatedElement;
27 import java.lang.reflect.Array; 28 import java.lang.reflect.Array;
28 import java.lang.reflect.Method; 29 import java.lang.reflect.Method;
29 import java.lang.reflect.Modifier; 30 import java.lang.reflect.Modifier;
30 import java.lang.reflect.Type; 31 import java.lang.reflect.Type;
31 32
32 /** 33 /**
33 * Represents a resolved Java method. Methods, like fields and types, are resolved through 34 * Represents a resolved Java method. Methods, like fields and types, are resolved through
34 * {@link ConstantPool constant pools}. 35 * {@link ConstantPool constant pools}.
35 */ 36 */
36 public interface ResolvedJavaMethod extends JavaMethod, InvokeTarget, ModifiersProvider { 37 public interface ResolvedJavaMethod extends JavaMethod, InvokeTarget, ModifiersProvider, AnnotatedElement {
37 38
38 /** 39 /**
39 * Returns the bytecode of this method, if the method has code. The returned byte array does not 40 * Returns the bytecode of this method, if the method has code. The returned byte array does not
40 * contain breakpoints or non-Java bytecodes. This may return null if the 41 * contain breakpoints or non-Java bytecodes. This may return null if the
41 * {@link #getDeclaringClass() holder} is not {@link ResolvedJavaType#isLinked() linked}. 42 * {@link #getDeclaringClass() holder} is not {@link ResolvedJavaType#isLinked() linked}.
185 186
186 /** 187 /**
187 * Returns the constant pool of this method. 188 * Returns the constant pool of this method.
188 */ 189 */
189 ConstantPool getConstantPool(); 190 ConstantPool getConstantPool();
190
191 /**
192 * Returns all annotations of this method. If no annotations are present, an array of length 0
193 * is returned.
194 */
195 Annotation[] getAnnotations();
196
197 /**
198 * Returns the annotation for the specified type of this method, if such an annotation is
199 * present.
200 *
201 * @param annotationClass the Class object corresponding to the annotation type
202 * @return this element's annotation for the specified annotation type if present on this
203 * method, else {@code null}
204 */
205 <T extends Annotation> T getAnnotation(Class<T> annotationClass);
206 191
207 /** 192 /**
208 * Returns an array of arrays that represent the annotations on the formal parameters, in 193 * Returns an array of arrays that represent the annotations on the formal parameters, in
209 * declaration order, of this method. 194 * declaration order, of this method.
210 * 195 *