Top Fields Constructors Methods
org.graalvm.nativeimage.impl.clinit

public Class ClassInitializationTracking

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .IdentityHashMap, .List, .Map, java.util.concurrent.ConcurrentHashMap

Field Summary

Modifier and TypeField and Description
public static final Map<Class<?>, StackTraceElement[]>
public static final Map<Object, StackTraceElement[]>
instantiatedObjects

Instantiated objects must be traced using their identities as their hashCode may change during the execution.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static StackTraceElement[]

Returns:

a stack trace that led to erroneous situation
relevantStackTrace
(StackTraceElement[] stack)

If the stack trace contains class initializaiton, returns the stack frames up to the last initialization.

public static void
reportClassInitialized(Class<?> clazz, StackTraceElement[] stackTrace)

This method is called from the native-image diagnostics agent to report class initialization.

public static void
reportObjectInstantiated(Object o, StackTraceElement[] stackTrace)

This method is called from the native-image-diagnostics agent to report object instantiation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

initializedClassesback to summary
public static final Map<Class<?>, StackTraceElement[]> initializedClasses
instantiatedObjectsback to summary
public static final Map<Object, StackTraceElement[]> instantiatedObjects

Instantiated objects must be traced using their identities as their hashCode may change during the execution. We also want two objects of the same class that have the same hash and are equal to be mapped as two distinct entries.

Constructor Detail

ClassInitializationTrackingback to summary
public ClassInitializationTracking()

Method Detail

relevantStackTraceback to summary
private static StackTraceElement[] relevantStackTrace(StackTraceElement[] stack)

If the stack trace contains class initializaiton, returns the stack frames up to the last initialization. Otherwise returns the whole stack trace. The method never returns the stack from the instrumented part. This method can be refined on a case-by-case basis to print nicer traces.

Returns:StackTraceElement[]

a stack trace that led to erroneous situation

reportClassInitializedback to summary
public static void reportClassInitialized(Class<?> clazz, StackTraceElement[] stackTrace)

This method is called from the native-image diagnostics agent to report class initialization.

Annotations
@SuppressWarnings:unused
reportObjectInstantiatedback to summary
public static void reportObjectInstantiated(Object o, StackTraceElement[] stackTrace)

This method is called from the native-image-diagnostics agent to report object instantiation.

Annotations
@SuppressWarnings:unused