24
24
*/
25
25
package com .oracle .svm .core .reflect .target ;
26
26
27
+ import static com .oracle .svm .core .reflect .RuntimeMetadataDecoder .getConstantPoolLayerId ;
28
+
27
29
import java .lang .annotation .Annotation ;
28
30
import java .lang .annotation .AnnotationFormatError ;
29
31
import java .lang .reflect .Method ;
@@ -64,7 +66,7 @@ private static Annotation parseAnnotation2(ByteBuffer buf,
64
66
}
65
67
Class <? extends Annotation > annotationClass ;
66
68
try {
67
- annotationClass = (Class <? extends Annotation >) MetadataAccessor .singleton ().getClass (typeIndex );
69
+ annotationClass = (Class <? extends Annotation >) MetadataAccessor .singleton ().getClass (typeIndex , getConstantPoolLayerId ( constPool ) );
68
70
} catch (Throwable e ) {
69
71
if (exceptionOnMissingAnnotationClass ) {
70
72
throw new TypeNotPresentException ("[unknown]" , e );
@@ -91,7 +93,7 @@ private static Annotation parseAnnotation2(ByteBuffer buf,
91
93
int numMembers = buf .getShort () & 0xFFFF ;
92
94
for (int i = 0 ; i < numMembers ; i ++) {
93
95
int memberNameIndex = buf .getInt ();
94
- String memberName = MetadataAccessor .singleton ().getMemberName (memberNameIndex );
96
+ String memberName = MetadataAccessor .singleton ().getMemberName (memberNameIndex , getConstantPoolLayerId ( constPool ) );
95
97
Class <?> memberType = memberTypes .get (memberName );
96
98
97
99
if (memberType == null ) {
@@ -116,11 +118,11 @@ public static native Object parseMemberValue(Class<?> memberType,
116
118
117
119
@ Substitute
118
120
private static Object parseClassValue (ByteBuffer buf ,
119
- @ SuppressWarnings ( "unused" ) Target_jdk_internal_reflect_ConstantPool constPool ,
121
+ Target_jdk_internal_reflect_ConstantPool constPool ,
120
122
@ SuppressWarnings ("unused" ) Class <?> container ) {
121
123
int classIndex = buf .getInt ();
122
124
try {
123
- return MetadataAccessor .singleton ().getClass (classIndex );
125
+ return MetadataAccessor .singleton ().getClass (classIndex , getConstantPoolLayerId ( constPool ) );
124
126
} catch (Throwable t ) {
125
127
throw VMError .shouldNotReachHereSubstitution (); // ExcludeFromJacocoGeneratedReport
126
128
}
@@ -129,13 +131,13 @@ private static Object parseClassValue(ByteBuffer buf,
129
131
@ Substitute
130
132
@ SuppressWarnings ({"unchecked" , "rawtypes" })
131
133
private static Object parseEnumValue (Class <? extends Enum > enumType , ByteBuffer buf ,
132
- @ SuppressWarnings ( "unused" ) Target_jdk_internal_reflect_ConstantPool constPool ,
134
+ Target_jdk_internal_reflect_ConstantPool constPool ,
133
135
@ SuppressWarnings ("unused" ) Class <?> container ) {
134
136
int typeIndex = buf .getInt ();
135
137
int constNameIndex = buf .getInt ();
136
- String constName = MetadataAccessor .singleton ().getMemberName (constNameIndex );
138
+ String constName = MetadataAccessor .singleton ().getMemberName (constNameIndex , getConstantPoolLayerId ( constPool ) );
137
139
138
- if (!enumType .isEnum () || enumType != MetadataAccessor .singleton ().getClass (typeIndex )) {
140
+ if (!enumType .isEnum () || enumType != MetadataAccessor .singleton ().getClass (typeIndex , getConstantPoolLayerId ( constPool ) )) {
139
141
Target_sun_reflect_annotation_AnnotationTypeMismatchExceptionProxy e = new Target_sun_reflect_annotation_AnnotationTypeMismatchExceptionProxy ();
140
142
e .constructor (enumType .getTypeName () + "." + constName );
141
143
return e ;
@@ -150,7 +152,7 @@ private static Object parseEnumValue(Class<? extends Enum> enumType, ByteBuffer
150
152
151
153
@ Substitute
152
154
private static Object parseConst (int tag ,
153
- ByteBuffer buf , @ SuppressWarnings ( "unused" ) Target_jdk_internal_reflect_ConstantPool constPool ) {
155
+ ByteBuffer buf , Target_jdk_internal_reflect_ConstantPool constPool ) {
154
156
switch (tag ) {
155
157
case 'B' :
156
158
return buf .get ();
@@ -171,9 +173,9 @@ private static Object parseConst(int tag,
171
173
assert value == 1 || value == 0 ;
172
174
return value == 1 ;
173
175
case 's' :
174
- return MetadataAccessor .singleton ().getOtherString (buf .getInt ());
176
+ return MetadataAccessor .singleton ().getOtherString (buf .getInt (), getConstantPoolLayerId ( constPool ) );
175
177
case 'E' :
176
- return MetadataAccessor .singleton ().getObject (buf .getInt ());
178
+ return MetadataAccessor .singleton ().getObject (buf .getInt (), getConstantPoolLayerId ( constPool ) );
177
179
default :
178
180
throw new AnnotationFormatError (
179
181
"Invalid member-value tag in annotation: " + tag );
@@ -339,7 +341,7 @@ private static Object parseBooleanArray(int length,
339
341
340
342
@ Substitute
341
343
private static Object parseStringArray (int length ,
342
- ByteBuffer buf , @ SuppressWarnings ( "unused" ) Target_jdk_internal_reflect_ConstantPool constPool ) {
344
+ ByteBuffer buf , Target_jdk_internal_reflect_ConstantPool constPool ) {
343
345
String [] result = new String [length ];
344
346
boolean typeMismatch = false ;
345
347
int tag = 0 ;
@@ -348,7 +350,7 @@ private static Object parseStringArray(int length,
348
350
tag = buf .get ();
349
351
if (tag == 's' ) {
350
352
int index = buf .getInt ();
351
- result [i ] = MetadataAccessor .singleton ().getOtherString (index );
353
+ result [i ] = MetadataAccessor .singleton ().getOtherString (index , getConstantPoolLayerId ( constPool ) );
352
354
} else {
353
355
skipMemberValue (tag , buf );
354
356
typeMismatch = true ;
0 commit comments