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

ComposeModifierWithoutDefault triggers for @Composable Modifier factory functions #271

Closed
dandc87 opened this issue Feb 6, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@dandc87
Copy link

dandc87 commented Feb 6, 2024

My codebase has some Modifier helpers that can't be converted to Modifier.Nodes, and want to use the Composable factory guidance but Slack lints (latest 1.3.1) don't make that easy.

Currently I have to write this incantation to suppress (task and in-IDE):

@Composable
// noinspection ComposeModifierWithoutDefault
fun @Suppress("ComposeComposableModifier") Modifier.myModifierFactory(
  @SuppressLint("ComposeModifierWithoutDefault") myParameter: String,
): Modifier { ... }

I also get a crash if there are no parameters (just the receiver):

Stack:
ArrayIndexOutOfBoundsException:Arrays$ArrayList.get(null:-1)
←ModifierWithoutDefaultDetector.visitComposable(ModifierWithoutDefaultDetector.kt:59)
←ComposableFunctionDetector$createUastHandler$1.visitMethod(ComposableFunctionDetector.kt:33)
...
@ZacSweers ZacSweers added the bug Something isn't working label Feb 7, 2024
@blipinsk
Copy link

🆙 We encountered this problem as well.

@svenjacobs
Copy link
Contributor

I think this relates to #369. Composable Modifier factories are now officially permitted by Google so ComposeModifierWithoutDefault needs to be updated and ComposeComposableModifier removed.

@ZacSweers
Copy link
Collaborator

Resolved by #378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants