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

Unable to override not initialized Boolean property with false value #1

Closed
szpak opened this issue Oct 6, 2014 · 5 comments
Closed

Unable to override not initialized Boolean property with false value #1

szpak opened this issue Oct 6, 2014 · 5 comments
Assignees
Labels
bug
Milestone

Comments

@szpak
Copy link
Contributor

@szpak szpak commented Oct 6, 2014

A try to override not initialized Boolean property like below:

class MyExtension {
    Boolean myBoolean
}

with false value

-Doverride.example.myBoolean=false

ends with true value assigned.

After some debugging the problem is in DotNotationWalkerOverrideStrategy. determineProperty() for not initialized field property it returns null and clazz is set to NullObject. parent.setProperty doesn't know that is a Boolean field and set false as String and for Groovy is true.

It would be required to get a type of not initialized property in Groovy object, but I don't know if Groovy offers that information.

In a few minutes I will make a pull request with test reproducing that case.

szpak added a commit to szpak/gradle-override-plugin that referenced this issue Oct 6, 2014
…olean property with false value

Broken test is ignored.
@bmuschko
Copy link
Contributor

@bmuschko bmuschko commented Oct 6, 2014

Thanks for reporting. If you open the pull request, please open it against the gradle-1.12 branch.

@szpak
Copy link
Contributor Author

@szpak szpak commented Oct 6, 2014

Too late :(. I created at against master as I thought it is the main branch now.

Nevertheless if you prefer I can create another PR.

@bmuschko
Copy link
Contributor

@bmuschko bmuschko commented Oct 6, 2014

Yes, can you please close the pull request and reopen. Thanks!

szpak added a commit to szpak/gradle-override-plugin that referenced this issue Oct 6, 2014
…olean property with false value

Broken test is ignored.
@szpak
Copy link
Contributor Author

@szpak szpak commented Oct 6, 2014

I rebased my branch. The old PR should be already against gradle-1.12.

szpak added a commit to szpak/gradle-override-plugin that referenced this issue Oct 6, 2014
…olean property with false value

Broken test is ignored.
@szpak
Copy link
Contributor Author

@szpak szpak commented Oct 6, 2014

I created a new PR.

bmuschko added a commit that referenced this issue Oct 9, 2014
#1 - Reproduce problem with override not initialized Boolean property
bmuschko added a commit that referenced this issue Oct 9, 2014
Issue #1: Determine property type if no value is assigned.
bmuschko added a commit that referenced this issue Oct 9, 2014
bmuschko added a commit that referenced this issue Oct 9, 2014
@bmuschko bmuschko closed this Oct 9, 2014
@bmuschko bmuschko modified the milestones: v1.12.1, v2.0.1 Oct 9, 2014
@bmuschko bmuschko self-assigned this Oct 9, 2014
@bmuschko bmuschko added the bug label Oct 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.