Package org.jacoco.agent.rt.internal
Class PreMain
- java.lang.Object
-
- org.jacoco.agent.rt.internal.PreMain
-
public final class PreMain extends java.lang.Object
The agent which is referred as thePremain-Class
. The agent configuration is provided with the agent parameters in the command line.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
PreMain()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static IRuntime
createRuntime(java.lang.instrument.Instrumentation inst)
private static java.lang.Object
getModule(java.lang.Class<?> cls)
static void
premain(java.lang.String options, java.lang.instrument.Instrumentation inst)
This method is called by the JVM to initialize Java agents.private static boolean
redefineJavaBaseModule(java.lang.instrument.Instrumentation instrumentation)
Opensjava.base
module forInjectedClassRuntime
when executed on Java 9 JREs or higher.
-
-
-
Method Detail
-
premain
public static void premain(java.lang.String options, java.lang.instrument.Instrumentation inst) throws java.lang.Exception
This method is called by the JVM to initialize Java agents.- Parameters:
options
- agent optionsinst
- instrumentation callback provided by the JVM- Throws:
java.lang.Exception
- in case initialization fails
-
createRuntime
private static IRuntime createRuntime(java.lang.instrument.Instrumentation inst) throws java.lang.Exception
- Throws:
java.lang.Exception
-
redefineJavaBaseModule
private static boolean redefineJavaBaseModule(java.lang.instrument.Instrumentation instrumentation) throws java.lang.Exception
Opensjava.base
module forInjectedClassRuntime
when executed on Java 9 JREs or higher.- Returns:
true
when running on Java 9 or higher,false
otherwise- Throws:
java.lang.Exception
- if unable to open
-
getModule
private static java.lang.Object getModule(java.lang.Class<?> cls) throws java.lang.Exception
- Returns:
cls.getModule()
- Throws:
java.lang.Exception
-
-