Class SystemPropertiesRuntime

  extended by org.jacoco.core.runtime.AbstractRuntime
      extended by org.jacoco.core.runtime.SystemPropertiesRuntime
All Implemented Interfaces:
IExecutionDataAccessorGenerator, IRuntime

public class SystemPropertiesRuntime
extends AbstractRuntime

This IRuntime implementation makes the execution data available through a special entry in the System.getProperties() hash table. The advantage is, that the instrumented classes do not get dependencies to other classes than the JRE library itself. This runtime may cause problems in environments with security restrictions, in applications that replace the system properties or in applications that fail if non-String values are placed in the system properties.

Field Summary
Fields inherited from class org.jacoco.core.runtime.AbstractRuntime
Constructor Summary
          Creates a new runtime.
Method Summary
 int generateDataAccessor(long classid, String classname, int probecount, org.objectweb.asm.MethodVisitor mv)
          This method generates the byte code required to obtain the coverage data structure for the class with the given id.
 void shutdown()
          Allows the coverage runtime to cleanup internals.
 void startup(RuntimeData data)
          Subclasses must call this method when overwriting it.
Methods inherited from class org.jacoco.core.runtime.AbstractRuntime
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public SystemPropertiesRuntime()
Creates a new runtime.

Method Detail


public int generateDataAccessor(long classid,
                                String classname,
                                int probecount,
                                org.objectweb.asm.MethodVisitor mv)
Description copied from interface: IExecutionDataAccessorGenerator
This method generates the byte code required to obtain the coverage data structure for the class with the given id. Typically the instrumentation process will embed this code into a method that is called on class initialization. This method can be called at any time even outside the target VM. The generated code must push a boolean[] instance to the operand stack. Except this result object the generated code must not make any assumptions about the structure of the embedding method or class. The generated code must not use or allocate local variables.

classid - identifier of the class
classname - VM class name
probecount - probe count for this class
mv - code output
additional stack size required by the implementation, including the instance pushed to the stack


public void startup(RuntimeData data)
             throws Exception
Description copied from class: AbstractRuntime
Subclasses must call this method when overwriting it.

Specified by:
startup in interface IRuntime
startup in class AbstractRuntime
data - the execution data for this runtime
Exception - any internal problem during startup


public void shutdown()
Description copied from interface: IRuntime
Allows the coverage runtime to cleanup internals. This class should be called when classes instrumented for this runtime are not used any more.

Copyright © 2009–2023 Mountainminds GmbH & Co. KG. All rights reserved.