use of com.oracle.graal.pointsto.api.HostVM in project graal by oracle.
the class Inflation method fillGenericInfo.
private void fillGenericInfo(AnalysisType type) {
SVMHost svmHost = (SVMHost) hostVM;
DynamicHub hub = svmHost.dynamicHub(type);
Class<?> javaClass = type.getJavaClass();
TypeVariable<?>[] typeParameters = javaClass.getTypeParameters();
/* The bounds are lazily initialized. Initialize them eagerly in the native image. */
Arrays.stream(typeParameters).forEach(TypeVariable::getBounds);
Type[] genericInterfaces = Arrays.stream(javaClass.getGenericInterfaces()).filter(this::filterGenericInterfaces).toArray(Type[]::new);
Type[] cachedGenericInterfaces = genericInterfacesMap.computeIfAbsent(new GenericInterfacesEncodingKey(genericInterfaces), k -> genericInterfaces);
Type genericSuperClass = javaClass.getGenericSuperclass();
hub.setGenericInfo(GenericInfo.factory(typeParameters, cachedGenericInterfaces, genericSuperClass));
AnnotatedType annotatedSuperclass = javaClass.getAnnotatedSuperclass();
AnnotatedType[] annotatedInterfaces = Arrays.stream(javaClass.getAnnotatedInterfaces()).filter(ai -> filterGenericInterfaces(ai.getType())).toArray(AnnotatedType[]::new);
AnnotatedType[] cachedAnnotatedInterfaces = annotatedInterfacesMap.computeIfAbsent(new AnnotatedInterfacesEncodingKey(annotatedInterfaces), k -> annotatedInterfaces);
hub.setAnnotatedSuperInfo(AnnotatedSuperInfo.factory(annotatedSuperclass, cachedAnnotatedInterfaces));
}
Aggregations