Package org.jacoco.core.runtime
Class URLStreamHandlerRuntime
- java.lang.Object
-
- org.jacoco.core.runtime.AbstractRuntime
-
- org.jacoco.core.runtime.URLStreamHandlerRuntime
-
- All Implemented Interfaces:
IExecutionDataAccessorGenerator
,IRuntime
public class URLStreamHandlerRuntime extends AbstractRuntime
ThisIRuntime
implementation registers a specialURLStreamHandler
to process coverage data. The handler is not actually used for opening a URL, but to get access to the runtime object.
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.URLConnection
connection
private java.net.URLStreamHandler
handler
private java.util.Map<java.lang.String,java.net.URLStreamHandler>
handlers
private java.lang.String
protocol
private static java.lang.String
PROTOCOLPREFIX
-
Fields inherited from class org.jacoco.core.runtime.AbstractRuntime
data
-
-
Constructor Summary
Constructors Constructor Description URLStreamHandlerRuntime()
Creates a new runtime.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
generateDataAccessor(long classid, java.lang.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.private java.util.Map<java.lang.String,java.net.URLStreamHandler>
getHandlersReference()
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
createRandomId
-
-
-
-
Field Detail
-
PROTOCOLPREFIX
private static final java.lang.String PROTOCOLPREFIX
- See Also:
- Constant Field Values
-
protocol
private final java.lang.String protocol
-
handlers
private java.util.Map<java.lang.String,java.net.URLStreamHandler> handlers
-
handler
private final java.net.URLStreamHandler handler
-
connection
private final java.net.URLConnection connection
-
-
Method Detail
-
startup
public void startup(RuntimeData data) throws java.lang.Exception
Description copied from class:AbstractRuntime
Subclasses must call this method when overwriting it.- Specified by:
startup
in interfaceIRuntime
- Overrides:
startup
in classAbstractRuntime
- Parameters:
data
- the execution data for this runtime- Throws:
java.lang.Exception
- any internal problem during startup
-
getHandlersReference
private java.util.Map<java.lang.String,java.net.URLStreamHandler> getHandlersReference() throws java.lang.Exception
- Throws:
java.lang.Exception
-
shutdown
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.
-
generateDataAccessor
public int generateDataAccessor(long classid, java.lang.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 aboolean[]
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.- Parameters:
classid
- identifier of the classclassname
- VM class nameprobecount
- probe count for this classmv
- code output- Returns:
- additional stack size required by the implementation, including the instance pushed to the stack
-
-