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

ClassCastException: class TestTaskSkipEventsServiceProvider$Inject cannot be cast to class TestTaskSkipEventsServiceProvider #266

Open
takahirom opened this issue Feb 20, 2024 · 3 comments

Comments

@takahirom
Copy link
Owner

takahirom commented Feb 20, 2024

reporting
#261 (comment)

cause
gradle/gradle#17559

@takahirom
Copy link
Owner Author

takahirom commented Feb 20, 2024

I was able to reproduce the issue and made some changes in an attempt to fix it, such as using Provider<java.lang.Object>, but I couldn't resolve the ClassCastException. I'm considering adding a try-catch block and rethrowing the exception to inform users that they should use apply false in the root project.

try {
    testTaskSkipEventsServiceProvider.get().addExpectingTestTaskName(testTaskName)
} catch (e: ClassCastException) {
    throw IllegalStateException("""You should use `id("io.github.takahirom.roborazzi") version "[version]" apply false` in the root project to ensure the build cache property works correctly.""", e)
}

@takahirom
Copy link
Owner Author

takahirom commented Feb 20, 2024

We can refer to this comment for more context:
bmuschko/gradle-docker-plugin#1123 (comment).
It seems we'll have to wait for a fix from Gradle. Therefore, the exception message could be structured as follows:

throw IllegalStateException("""You should use id("io.github.takahirom.roborazzi") version "[version]" apply false in the root project to ensure the build cache property functions correctly. This is a temporary workaround, and we are awaiting a permanent fix from the Gradle core.""", e)

@takahirom
Copy link
Owner Author

If there are any workarounds that the Roborazzi plugin can offer, I would like to try them, so please let me know if there is anything I can do.

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

1 participant