Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@JvmOverloads doesn't generate different methods for compose functions #213

Closed
diklimchuk opened this issue Apr 3, 2024 · 2 comments
Closed

Comments

@diklimchuk
Copy link

If i create a composable with @jvmoverloads annotation:

@JvmOverloads
@Composable
public fun Test(
    x: Int,
    y: String = "",
): Unit = Unit

the task apiDump generaties a single method instead of two different overloads of the same method:

public final class com/vk/id/onetap/compose/onetap/TmpKt {
	public static final fun Test (ILjava/lang/String;Landroidx/compose/runtime/Composer;II)V
}

If the same is run without @composable annotation the task correctly dumps two methods into the api file

@fzhinkin
Copy link
Collaborator

fzhinkin commented Apr 3, 2024

@diklimchuk, it seems like once the Compose compiler plugin transformed @Composable functions, there are no default args anymore, so @JvmOverloads has no effect. You can check compiled classfiles to ensure that overloads were not included in the dump because they don't exist.

@diklimchuk
Copy link
Author

Thank you, this resolves my problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants