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

Disallow setters for properties on parameter-like objects #9323

Open
lptr opened this issue Apr 30, 2019 · 5 comments
Open

Disallow setters for properties on parameter-like objects #9323

lptr opened this issue Apr 30, 2019 · 5 comments
Assignees
Labels
a:feature A new functionality in:work-validation task validation, warnings, disable optimizations

Comments

@lptr
Copy link
Member

lptr commented Apr 30, 2019

This is a follow-up to #9068.

We want to encourage users to use mutable property objects instead of getter/setter pairs to configure parameter-like objects (tasks, artifact transforms, extensions, work items etc.).

So instead of this:

class MyTask extends DefaultTask {
    @InputFiles
    FileCollection sources
}

We'd want to support this:

class MyTask extends DefaultTask {
    @InputFiles
    final ConfigurableFileCollection sources
}

Conversely, instead of naked types like this:

class MyTask extends DefaultTask {
    @Input String name
    @Input int count
}

We'd like to migrate users towards Property types:

class MyTask extends DefaultTask {
    @Input final Property<String> name
    @Input final Property<Integer> count
}

We should thus issue warnings about any setter for a parameter value with a recommendation to use the corresponding mutable property type.

@stale
Copy link

stale bot commented Sep 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

@stale stale bot added the stale label Sep 11, 2020
@stale
Copy link

stale bot commented Oct 7, 2020

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Gradle or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

@stale stale bot closed this as completed Oct 7, 2020
@wolfs
Copy link
Member

wolfs commented Oct 7, 2020

I think we still want to do this.

@wolfs wolfs reopened this Oct 7, 2020
@wolfs wolfs removed the stale label Oct 7, 2020
@lptr
Copy link
Member Author

lptr commented Dec 10, 2020

Let's consider deprecating this for 7.0, too.

@lptr lptr added this to the 7.0 RC1 milestone Dec 10, 2020
@lptr lptr removed this from the 7.0 RC1 milestone Feb 23, 2021
@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

@stale stale bot added the stale label Apr 17, 2022
@wolfs wolfs removed the stale label Apr 19, 2022
@lptr lptr added the in:provider-api property lazy provider MapProperty ListProperty DirectoryProperty label Apr 20, 2022
@jbartok jbartok added in:work-validation task validation, warnings, disable optimizations and removed in:provider-api property lazy provider MapProperty ListProperty DirectoryProperty labels May 25, 2023
@lptr lptr added the a:feature A new functionality label Sep 12, 2023
@lptr lptr removed the @execution label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:work-validation task validation, warnings, disable optimizations
Projects
None yet
Development

No branches or pull requests

4 participants