Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

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

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

Comments

@szpak
Copy link
Contributor

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-forks/gradle-override-plugin that referenced this issue Oct 6, 2014
…olean property with false value

Broken test is ignored.
@bmuschko
Copy link
Contributor

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 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 commented Oct 6, 2014

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

szpak added a commit to szpak-forks/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 commented Oct 6, 2014

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

szpak added a commit to szpak-forks/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 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 as completed 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants