Skip to content

Change mutators and use set in config for Gradle 5#170

Closed
sinaneski wants to merge 1 commit intoszpak:masterfrom
sinaneski:master
Closed

Change mutators and use set in config for Gradle 5#170
sinaneski wants to merge 1 commit intoszpak:masterfrom
sinaneski:master

Conversation

@sinaneski
Copy link
Copy Markdown

  • Add how to change mutators in pitest gradle.build config
  • Use set() method to prevent Gradle warnings like 'cannot assing a value to final field'

- Add how to change mutators in pitest gradle.build config
- Use set() method to prevent Gradle warnings like 'cannot assing a value to final field'
@szpak
Copy link
Copy Markdown
Owner

szpak commented Feb 26, 2020

@sinaneski Thanks for your report. I've just started working on deprecation warnings (#155), but I hasn't encountered those mentioned by you.

Could you paste sample configuration which triggers the aforementioned warnings (and Gradle version that you use)?

@sinaneski
Copy link
Copy Markdown
Author

Hi,

I'm using Gradle 5.6.3 version.

However, I got this warning from IntelliJ inspection.

Cannot assign a value to final field 'outputFormats' 
 Inspection info: Reports invalid assignments to final variables, parameters and fields and not initialized final fields.

pitest-assigning-warning

The inspection is OK after changing the assignment using the set operation.

pitest-using-set

@szpak szpak added this to the 1.4.8 milestone Mar 26, 2020
@szpak
Copy link
Copy Markdown
Owner

szpak commented Mar 27, 2020

It is a limitation of Idea. Gradle do some magic to keep the old syntax with = work with final fields (using the setters internally). I will add a point in README that the alternative syntax exists. Unfortunately it is more verbose and less readable :-(.

@sinaneski sinaneski closed this Mar 29, 2020
szpak added a commit that referenced this pull request Apr 1, 2020
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.

2 participants