Skip to content

@JvmOverloads leads to binary-incompatible advice on consumer module #1767

Description

@SimonMarquis

Plugin version
latest (3.16.1)

Gradle version
latest (9.6.1)

JDK version
25

(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version
KGP 2.3.21

(Optional) Android Gradle Plugin (AGP) version
9.2.1

(Optional) reason output for bugs relating to incorrect advice

./gradlew :features:VehicleAgreement:impl:reason --id :libraries:StandardLibraryExtensions

> Task :features:VehicleAgreement:impl:reason

------------------------------------------------------------
You asked about the dependency ':libraries:StandardLibraryExtensions'.
You have been advised to remove this dependency from 'testImplementation'.
------------------------------------------------------------

There is no path from :features:VehicleAgreement:impl to :libraries:StandardLibraryExtensions for releaseCompileClasspath


Shortest path from :features:VehicleAgreement:impl to :libraries:StandardLibraryExtensions for releaseRuntimeClasspath:
:features:VehicleAgreement:impl
\--- :libraries:VehicleUiComponent
      \--- :libraries:StandardLibraryExtensions

Shortest path from :features:VehicleAgreement:impl to :libraries:StandardLibraryExtensions for releaseUnitTestCompileClasspath:
:features:VehicleAgreement:impl
\--- :libraries:StandardLibraryExtensions

Shortest path from :features:VehicleAgreement:impl to :libraries:StandardLibraryExtensions for releaseUnitTestRuntimeClasspath:
:features:VehicleAgreement:impl
\--- :libraries:StandardLibraryExtensions

Source: release, main
---------------------
(no usages)

Source: release, test
---------------------
* Is binary-incompatible, and should be removed from the classpath:
  Expected METHOD fr/leboncoin/libraries/standardlibraryextensions/RandomKt.nextNumericalString(Lkotlin/random/Random;Ljava/lang/Integer;)Ljava/lang/String;, but was fr/leboncoin/libraries/standardlibraryextensions/RandomKt.nextNumericalString(Lkotlin/random/Random;)Ljava/lang/String;

Describe the bug

Random.nextNumericalString() extension is defined like this

@JvmOverloads
fun Random.nextNumericalString(size: Int? = null): String = ...

Without the @JvmOverloads no advice is generated, which is what we would expect.
Note: this annotation was added when we used to have a mix of java and kotlin code.

To Reproduce

I'm trying to reproduce the bug in a test project, but it does not seem to trigger.
SimonMarquis#2

I'm probably forgetting something 🤔

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions