Class KotlinInlineClassFilter

java.lang.Object
org.jacoco.core.internal.analysis.filter.KotlinInlineClassFilter
All Implemented Interfaces:
IFilter

final class KotlinInlineClassFilter extends Object implements IFilter
Filters methods that Kotlin compiler generates for inline classes. For
@kotlin.jvm.JvmInline
value class Example(val value: String) : Base {
  fun f(p: String) { ... }
  fun f(p: Example) { ... }
  override fun base() { ... }
}
Kotlin compiler produces
@kotlin.jvm.JvmInline
class Example implements Base {
  private final String value;
  public String getValue() { return value; }

  private synthetic Example(String value) { this.value = value; }

  public static String constructor-impl(String value) { ... }

  public static void f-impl(String value, String p) { ... }

  public static void f-ulP-heY(String value, String p) { ... }

  public void base() { base-impl(value); }
  public static void base-impl(String value) { ... }

  public String toString() { return toString-impl(value); }
  public static String toString-impl(String value) { ... }

  public boolean equals(Object other) { return equals-impl(value, other); }
  public static boolean equals-impl(String value, Object other) { ... }

  public int hashCode() { return hashCode-impl(value); }
  public static int hashCode-impl(String value) { ... }

  public final synthetic String unbox-impl() { return value; }
  public static synthetic Example box-impl(String value) { return new Example(value); }

  public static equals-impl0(String value1, String value2) { ... }
}
Except getter all non-synthetic non-static methods delegate to corresponding static methods. Non-static methods are provided for interoperability with Java and can not be invoked from Kotlin without reflection and so should be filtered out.
  • Constructor Details

    • KotlinInlineClassFilter

      KotlinInlineClassFilter()
  • Method Details

    • 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 given IFilterOutput instance.
      Specified by:
      filter in interface IFilter
      Parameters:
      methodNode - method to inspect
      context - context information for the method
      output - callback to report filtering results to