Skip to content

Commit 8d8adfb

Browse files
committed
Fix array type tracing: replace getName calls with getTypeName
1 parent 1d1cfe9 commit 8d8adfb

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/ClassForNameSupport.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ private Object forName0(String className, ClassLoader classLoader) {
414414
}
415415
if (MetadataTracer.enabled()) {
416416
// NB: the early returns above ensure we do not trace calls with bad type args.
417-
MetadataTracer.singleton().traceReflectionType(className);
417+
MetadataTracer.singleton().traceReflectionType(ClassNameSupport.reflectionNameToTypeName(className));
418418
}
419419
return result == NEGATIVE_QUERY ? new ClassNotFoundException(className) : result;
420420
}
@@ -502,7 +502,7 @@ public static Throwable getSavedException(String className) {
502502
public static boolean canUnsafeInstantiateAsInstance(DynamicHub hub) {
503503
Class<?> clazz = DynamicHub.toClass(hub);
504504
if (MetadataTracer.enabled()) {
505-
ConfigurationType type = MetadataTracer.singleton().traceReflectionType(clazz.getName());
505+
ConfigurationType type = MetadataTracer.singleton().traceReflectionType(clazz.getTypeName());
506506
if (type != null) {
507507
type.setUnsafeAllocated();
508508
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ private static boolean isClassFlagSet(int mask, ReflectionMetadata reflectionMet
786786
}
787787

788788
private void traceClassFlagQuery(int mask) {
789-
ConfigurationType type = MetadataTracer.singleton().traceReflectionType(getName());
789+
ConfigurationType type = MetadataTracer.singleton().traceReflectionType(getTypeName());
790790
if (type == null) {
791791
return;
792792
}
@@ -1397,15 +1397,15 @@ private void traceFieldLookup(String fieldName, Field field, boolean publicOnly)
13971397
ConfigurationMemberDeclaration declaration = publicOnly ? ConfigurationMemberDeclaration.PRESENT : ConfigurationMemberDeclaration.DECLARED;
13981398
if (field != null) {
13991399
// register declaring type and field
1400-
ConfigurationType declaringType = MetadataTracer.singleton().traceReflectionType(field.getDeclaringClass().getName());
1400+
ConfigurationType declaringType = MetadataTracer.singleton().traceReflectionType(field.getDeclaringClass().getTypeName());
14011401
if (declaringType != null) {
14021402
declaringType.addField(fieldName, declaration, false);
14031403
}
14041404
// register receiver type
1405-
MetadataTracer.singleton().traceReflectionType(getName());
1405+
MetadataTracer.singleton().traceReflectionType(getTypeName());
14061406
} else {
14071407
// register receiver type and negative field query
1408-
ConfigurationType receiverType = MetadataTracer.singleton().traceReflectionType(getName());
1408+
ConfigurationType receiverType = MetadataTracer.singleton().traceReflectionType(getTypeName());
14091409
if (receiverType != null) {
14101410
receiverType.addField(fieldName, declaration, false);
14111411
}
@@ -1482,15 +1482,15 @@ private void traceMethodLookup(String methodName, Class<?>[] parameterTypes, Exe
14821482
ConfigurationMemberDeclaration declaration = publicOnly ? ConfigurationMemberDeclaration.PRESENT : ConfigurationMemberDeclaration.DECLARED;
14831483
if (method != null) {
14841484
// register declaring type and method
1485-
ConfigurationType declaringType = MetadataTracer.singleton().traceReflectionType(method.getDeclaringClass().getName());
1485+
ConfigurationType declaringType = MetadataTracer.singleton().traceReflectionType(method.getDeclaringClass().getTypeName());
14861486
if (declaringType != null) {
14871487
declaringType.addMethod(methodName, toInternalSignature(parameterTypes), declaration);
14881488
}
14891489
// register receiver type
1490-
MetadataTracer.singleton().traceReflectionType(getName());
1490+
MetadataTracer.singleton().traceReflectionType(getTypeName());
14911491
} else {
14921492
// register receiver type and negative method query
1493-
ConfigurationType receiverType = MetadataTracer.singleton().traceReflectionType(getName());
1493+
ConfigurationType receiverType = MetadataTracer.singleton().traceReflectionType(getTypeName());
14941494
if (receiverType != null) {
14951495
receiverType.addMethod(methodName, toInternalSignature(parameterTypes), declaration, ConfigurationMemberAccessibility.QUERIED);
14961496
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaIOSubstitutions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static ObjectStreamClass lookup(Class<?> cl, boolean all) {
6666

6767
if (Serializable.class.isAssignableFrom(cl) && !cl.isArray()) {
6868
if (MetadataTracer.enabled()) {
69-
MetadataTracer.singleton().traceSerializationType(cl.getName());
69+
MetadataTracer.singleton().traceSerializationType(cl.getTypeName());
7070
}
7171
if (!DynamicHub.fromClass(cl).isRegisteredForSerialization()) {
7272
MissingSerializationRegistrationUtils.reportSerialization(cl);

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangReflectSubstitutions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ private static void set(Object a, int index, Object value) {
388388
private static Object newArray(Class<?> componentType, int length)
389389
throws NegativeArraySizeException {
390390
if (MetadataTracer.enabled()) {
391-
MetadataTracer.singleton().traceReflectionType(componentType.arrayType().getName());
391+
MetadataTracer.singleton().traceReflectionType(componentType.arrayType().getTypeName());
392392
}
393393
return KnownIntrinsics.unvalidatedNewArray(componentType, length);
394394
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/access/JNIReflectionDictionary.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public static JNIMethodId getDeclaredMethodID(Class<?> classObject, JNIAccessibl
274274

275275
private static JNIAccessibleMethod getDeclaredMethod(Class<?> classObject, JNIAccessibleMethodDescriptor descriptor, String dumpLabel) {
276276
if (MetadataTracer.enabled()) {
277-
ConfigurationType clazzType = MetadataTracer.singleton().traceJNIType(classObject.getName());
277+
ConfigurationType clazzType = MetadataTracer.singleton().traceJNIType(classObject.getTypeName());
278278
if (clazzType != null) {
279279
clazzType.addMethod(descriptor.getNameConvertToString(), descriptor.getSignatureConvertToString(), ConfigurationMemberInfo.ConfigurationMemberDeclaration.DECLARED);
280280
}
@@ -335,7 +335,7 @@ private static JNIAccessibleMethod checkMethod(JNIAccessibleMethod method, Class
335335

336336
private static JNIAccessibleField getDeclaredField(Class<?> classObject, CharSequence name, boolean isStatic, String dumpLabel) {
337337
if (MetadataTracer.enabled()) {
338-
ConfigurationType clazzType = MetadataTracer.singleton().traceJNIType(classObject.getName());
338+
ConfigurationType clazzType = MetadataTracer.singleton().traceJNIType(classObject.getTypeName());
339339
if (clazzType != null) {
340340
clazzType.addField(name.toString(), ConfigurationMemberInfo.ConfigurationMemberDeclaration.DECLARED, false);
341341
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/metadata/MetadataTracer.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ private ConfigurationSet getConfigurationSetForTracing() {
145145
* @return the corresponding {@link ConfigurationType} or {@code null} if tracing is not active
146146
* (e.g., during shutdown).
147147
*/
148-
public ConfigurationType traceReflectionType(String className) {
149-
return traceReflectionTypeImpl(new NamedConfigurationTypeDescriptor(className));
148+
public ConfigurationType traceReflectionType(String typeName) {
149+
return traceReflectionTypeImpl(new NamedConfigurationTypeDescriptor(typeName));
150150
}
151151

152152
/**
@@ -171,9 +171,9 @@ private ConfigurationType traceReflectionTypeImpl(ConfigurationTypeDescriptor ty
171171
* @return the corresponding {@link ConfigurationType} or {@code null} if tracing is not active
172172
* (e.g., during shutdown).
173173
*/
174-
public ConfigurationType traceJNIType(String className) {
174+
public ConfigurationType traceJNIType(String typeName) {
175175
assert enabledAtRunTime();
176-
ConfigurationType result = traceReflectionType(className);
176+
ConfigurationType result = traceReflectionType(typeName);
177177
if (result != null) {
178178
result.setJniAccessible();
179179
}
@@ -206,9 +206,9 @@ public void traceResourceBundle(String baseName) {
206206
/**
207207
* Marks the given type as serializable.
208208
*/
209-
public void traceSerializationType(String className) {
209+
public void traceSerializationType(String typeName) {
210210
assert enabledAtRunTime();
211-
ConfigurationType result = traceReflectionType(className);
211+
ConfigurationType result = traceReflectionType(typeName);
212212
if (result != null) {
213213
result.setSerializable();
214214
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/SerializationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public static Object getSerializationConstructorAccessor(Class<?> serializationT
268268
}
269269
} else {
270270
if (MetadataTracer.enabled()) {
271-
MetadataTracer.singleton().traceSerializationType(declaringClass.getName());
271+
MetadataTracer.singleton().traceSerializationType(declaringClass.getTypeName());
272272
}
273273
for (var singleton : layeredSingletons()) {
274274
Object constructorAccessor = singleton.getSerializationConstructorAccessor0(declaringClass, targetConstructorClass);

0 commit comments

Comments
 (0)