Skip to content

Handle Kotlin Function Names Correctly #2748

Open
@jlink

Description

@jlink

In "normal" cases Kotlin function names map directly onto Java method names.
However, there are a few cases where the Kotlin source name of a function will be different than the generated method name in byte code:

  1. in internal classes
  2. with parameters of specific types present - e.g. UInt, UShort etc.
  3. There might be more...

As a test engine writer I stumble upon this problem in a few classes:

  • org.junit.platform.engine.discovery.MethodSelector which - when called from IntelliJ's test runner - provides the correct Kotlin function name, but cannot resolve the underlying Java method.
  • org.junit.platform.engine.support.descriptor.MethodSource which cannot differentiate between methodName and getJavaMethod()

Deliverables

  • Implement MethodSelector so that it works correctly with all Kotlin function names
  • Implement MethodSource so that it will correctly produce methodName (Kotlin name) and getJavaMethod().

Alternatively, allow a test engine to change the behaviour of MethodSelector and MethodSource.

Addendum

A similar problem may exist with Kotlin class names, e.g. internal or inner classes, but I haven't checked.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions