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

ArrayIndexOutOfBoundsException at ModifierWithoutDefaultDetector.visitComposable #423

Open
jsjeon opened this issue Oct 4, 2024 · 1 comment

Comments

@jsjeon
Copy link

jsjeon commented Oct 4, 2024

From https://issuetracker.google.com/371140566

Version of Gradle Plugin: 8.2.2
Version of Gradle: 8.9
android.experimental.lint.version=8.8.0-alpha04

The code example:

/**
 * Automatically requests focus after initial composition.
 */
@Suppress("ModifierComposable") // Comment
@Composable
fun Modifier.focusAutoRequester(): Modifier {
    val focusRequester = remember { FocusRequester() }

    LaunchedEffect(Unit) {
        focusRequester.requestFocus()
    }

    return focusRequester(focusRequester)
}

stacktrace:

Stack: \\\`ArrayIndexOutOfBoundsException:Arrays$ArrayList.get(Arrays.java:4165)
←ModifierWithoutDefaultDetector.visitComposable(ModifierWithoutDefaultDetector.kt:59)
←ComposableFunctionDetector$createUastHandler$1.visitMethod(ComposableFunctionDetector.kt:33)
←UElementVisitor$DispatchUastVisitor.visitMethod(UElementVisitor.kt:535)
←UElementVisitor$DelegatingUastVisitor.visitMethod(UElementVisitor.kt:818)
←UMethod.accept(UMethod.kt:42)
←ImplementationUtilsKt.acceptList(implementationUtils.kt:15)
←AbstractKotlinUClass.accept(AbstractKotlinUClass.kt:213)
←ImplementationUtilsKt.acceptList(implementationUtils.kt:15)
←UFile.accept(UFile.kt:89)
←UastLintUtilsKt.acceptSourceFile(UastLintUtils.kt:953)
←UElementVisitor$visitFile$3.run(UElementVisitor.kt:216)
←LintClient.runReadAction(LintClient.kt:1781)
←LintDriver$LintClientWrapper.runReadAction(LintDriver.kt:2747)
←UElementVisitor.visitFile(UElementVisitor.kt:213)
←LintDriver$visitUastDetectors$1.run(LintDriver.kt:2048)
←LintClient.runReadAction(LintClient.kt:1781)
←LintDriver$LintClientWrapper.runReadAction(LintDriver.kt:2747)
←LintDriver.visitUastDetectors(LintDriver.kt:2048)
←LintDriver.visitUast(LintDriver.kt:2010)
←LintDriver.runFileDetectors(LintDriver.kt:1284)
←LintDriver.checkProject(LintDriver.kt:1070)
←LintDriver.checkProjectRoot(LintDriver.kt:622)
...
@ZacSweers
Copy link
Collaborator

Thanks!

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