Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Broken equals() contract for LifecycleAwareProject #30272

Closed
Assignees
6hundreds
Milestone
@jhonnen

Description

@jhonnen

Current Behavior

The equals contract ofProject::equals is broken when comparing against aLifecycleAwareProject:LifecycleAwareProject is equal to its correspondingDefaultProject but not the other way around.

Expected Behavior

equals() must be symmetric

Context (optional)

We have a plugin applied on the root project with an extension that maintains aSet<Project>.
A plugin applied on subprojects checks if the target project is contained in that set.

As of Gradle 8.10, the set now containsLifecycleAwareProjects and acontains(defaultProject) check always fails.

Also identity equality is not reliably anymore because ofLifecycleAwareProject (e.g. in Java code:project.getParent() == project.getRootProject()). This changed behavior is understandable but might be good to document it in the release notes.

Steps to Reproduce

/build.gradle.kts

project.ext["subproject"]= subprojects.toList()[0]

/subproject/build.gradle.kts

val lifecycleAware= rootProject.ext["subproject"]!!println("$lifecycleAware (${lifecycleAware.javaClass}")println("$project (${project.javaClass}")println(lifecycleAware== project)println(project== lifecycleAware)

This prints

> Configure project :subprojectproject ':subproject' (class org.gradle.api.internal.project.LifecycleAwareProject_Decoratedproject ':subproject' (class org.gradle.api.internal.project.DefaultProject_Decoratedtruefalse

Gradle version

8.10

Build scan URL (optional)

No response

Your Environment (optional)

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp