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

Fix NoSuchMethodError with Gradle 8.0 RC1 #2816

Merged
merged 1 commit into from Jan 19, 2023
Merged

Conversation

atyrin
Copy link
Contributor

@atyrin atyrin commented Jan 16, 2023

An attempt to fix #2796

The dokkaHtmlMultiModule started failing after the change in Gradle: gradle/gradle@7d9d6c4#diff-8d6d587bb7323c4c8105f5616986da4d67c575f8f7fb576071e58587e17a6878 where a new constructor appeared.

  1. Changed AbstractTaskDependency to DefaultTaskDependency.
    The logic behind this: the message https://github.com/gradle/gradle/blob/ab07117466b9a28de41c1ec85a3fb6f4c61abbcd/subprojects/core/src/main/java/org/gradle/api/internal/AbstractTask.java#L102 that AbstactTask should be replaced with DefaultTask. So I apply the same for AbstractTaskDependency and DefaultTaskDependency. even they are both are in *internal* package. But we try to override method public TaskDependencyInternal getTaskDependencies() that returns an interface from the same *internal* package.
  2. I remove custom logic in visitDependencies from TaskDependencyInternalWithAdditions and delegate it to the default implementation of the DefaultTaskDependency. It seems to contain the same. And for that, I inject tasks inside the DefaultTaskDependency.
  3. There are 2 ways to delegate tasks to the DefaultTaskDependency according to documentation (javadoc): in the constructor and with the add function. The way with the constructor is even recommended from a performance point of view.
    But it requires adding a dependency to Google common collections (full guava?) and I tried to avoid it.

Copy link
Member

@IgnatBeresnev IgnatBeresnev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 The fix is good to get us started with Gradle 8

We've agreed to look for a solution that does not use internal classes as part of #2822 - to make sure it doesn't happen again.

@atyrin atyrin merged commit 4121336 into master Jan 19, 2023
@atyrin atyrin deleted the no-method-gradle-8 branch January 19, 2023 12:45
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

Successfully merging this pull request may close these issues.

NoSuchMethodError with Gradle 8.0 RC1
2 participants