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

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

Comments

Projects
None yet
2 participants
@szpak
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/gradle-override-plugin that referenced this issue Oct 6, 2014

#1 - Reproduce problem with override not initialized Boolean propert…
…y with false value

Broken test is ignored.
@bmuschko

This comment has been minimized.

Show comment
Hide comment
@bmuschko

bmuschko Oct 6, 2014

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@szpak

szpak Oct 6, 2014

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@bmuschko

bmuschko Oct 6, 2014

Contributor

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

Contributor

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

#1 - Reproduce problem with override not initialized Boolean propert…
…y with false value

Broken test is ignored.
@szpak

This comment has been minimized.

Show comment
Hide comment
@szpak

szpak Oct 6, 2014

Contributor

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

Contributor

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

#1 - Reproduce problem with override not initialized Boolean propert…
…y with false value

Broken test is ignored.
@szpak

This comment has been minimized.

Show comment
Hide comment
@szpak

szpak Oct 6, 2014

Contributor

I created a new PR.

Contributor

szpak commented Oct 6, 2014

I created a new PR.

bmuschko added a commit that referenced this issue Oct 9, 2014

Merge pull request #4 from szpak/topic/notInitedBoolean1.12
#1 - Reproduce problem with override not initialized Boolean property

bmuschko added a commit that referenced this issue Oct 9, 2014

Merge pull request #5 from nebula-plugins/issue-1
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