Class KotlinDefaultArgumentsFilter
- java.lang.Object
-
- org.jacoco.core.internal.analysis.filter.KotlinDefaultArgumentsFilter
-
- All Implemented Interfaces:
IFilter
public final class KotlinDefaultArgumentsFilter extends java.lang.Object implements IFilter
Filters branches that Kotlin compiler generates for default arguments. For methods and constructors with default arguments Kotlin compiler generates synthetic method with suffix "$default" or a synthetic constructor with last argument "kotlin.jvm.internal.DefaultConstructorMarker" respectively. And in this synthetic method for each default argument Kotlin compiler generates following bytecode to determine if it should be used or not:ILOAD maskVar ICONST_x, BIPUSH, SIPUSH, LDC or LDC_W IAND IFEQ label default argument label:
If original method hasX
arguments, then in synthetic methodmaskVar
is one of arguments fromX+1
toX+1+(X/32)
. At least one of such arguments is not zero - invocation without default arguments uses original non synthetic method. This filter marksIFEQ
instructions as ignored.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
KotlinDefaultArgumentsFilter.Matcher
-
Constructor Summary
Constructors Constructor Description KotlinDefaultArgumentsFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static int
computeNumberOfMaskArguments(int arguments)
void
filter(org.objectweb.asm.tree.MethodNode methodNode, IFilterContext context, IFilterOutput output)
This method is called for every method.(package private) static boolean
isDefaultArgumentsConstructor(org.objectweb.asm.tree.MethodNode methodNode)
(package private) static boolean
isDefaultArgumentsMethod(org.objectweb.asm.tree.MethodNode methodNode)
-
-
-
Method Detail
-
isDefaultArgumentsMethod
static boolean isDefaultArgumentsMethod(org.objectweb.asm.tree.MethodNode methodNode)
-
isDefaultArgumentsConstructor
static boolean isDefaultArgumentsConstructor(org.objectweb.asm.tree.MethodNode methodNode)
-
filter
public void filter(org.objectweb.asm.tree.MethodNode methodNode, IFilterContext context, IFilterOutput output)
Description copied from interface:IFilter
This method is called for every method. The filter implementation is expected to inspect the provided method and report its result to the givenIFilterOutput
instance.
-
computeNumberOfMaskArguments
static int computeNumberOfMaskArguments(int arguments)
- Parameters:
arguments
- number of arguments of synthetic method- Returns:
- number of arguments holding mask
-
-