mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8303431: [JVMCI] libgraal annotation API
Reviewed-by: kvn, never, darcy
This commit is contained in:
parent
c57af319f6
commit
48fd4f2bd3
34 changed files with 2298 additions and 51 deletions
|
@ -677,6 +677,13 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
|||
UnsafeAccessor.setMemberValues(this, mv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an unmodifiable view on the member values.
|
||||
*/
|
||||
Map<String, Object> memberValues() {
|
||||
return Collections.unmodifiableMap(memberValues);
|
||||
}
|
||||
|
||||
private static class UnsafeAccessor {
|
||||
private static final jdk.internal.misc.Unsafe unsafe
|
||||
= jdk.internal.misc.Unsafe.getUnsafe();
|
||||
|
|
|
@ -83,14 +83,14 @@ public class AnnotationParser {
|
|||
* Like {@link #parseAnnotations(byte[], sun.reflect.ConstantPool, Class)}
|
||||
* with an additional parameter {@code selectAnnotationClasses} which selects the
|
||||
* annotation types to parse (other than selected are quickly skipped).<p>
|
||||
* This method is only used to parse select meta annotations in the construction
|
||||
* This method is used to parse select meta annotations in the construction
|
||||
* phase of {@link AnnotationType} instances to prevent infinite recursion.
|
||||
*
|
||||
* @param selectAnnotationClasses an array of annotation types to select when parsing
|
||||
*/
|
||||
@SafeVarargs
|
||||
@SuppressWarnings("varargs") // selectAnnotationClasses is used safely
|
||||
static Map<Class<? extends Annotation>, Annotation> parseSelectAnnotations(
|
||||
public static Map<Class<? extends Annotation>, Annotation> parseSelectAnnotations(
|
||||
byte[] rawAnnotations,
|
||||
ConstantPool constPool,
|
||||
Class<?> container,
|
||||
|
@ -336,6 +336,8 @@ public class AnnotationParser {
|
|||
ByteBuffer buf,
|
||||
ConstantPool constPool,
|
||||
Class<?> container) {
|
||||
// Note that VMSupport.encodeAnnotation (used by JVMCI) may need to
|
||||
// be updated if new annotation member types are added.
|
||||
Object result = null;
|
||||
int tag = buf.get();
|
||||
switch(tag) {
|
||||
|
|
|
@ -281,4 +281,13 @@ public final class AnnotationSupport {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an unmodifiable view of {@code a}'s elements.
|
||||
*
|
||||
* @return a map from element names to element values
|
||||
*/
|
||||
public static Map<String, Object> memberValues(Annotation a) {
|
||||
return ((AnnotationInvocationHandler) Proxy.getInvocationHandler(a)).memberValues();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue