[GitHub] thrift pull request #1281: THRIFT-3703 Unions Field Count Does Not Consider ...

2017-05-30 Thread dcelasun
GitHub user dcelasun opened a pull request:

https://github.com/apache/thrift/pull/1281

THRIFT-3703 Unions Field Count Does Not Consider Map/Set/List Fields

Even though maps and slices are not pointer fields in the generated
code, they are still nullable. Adding an extra check for map/set/list
types fixes the generated Count* methods.

Sample IDL:
```thrift
union Foo{
1: map u1
2: set u2
3: list u3
4: bool u4
}
```

Generated code before fix:
```go
func (p *Foo) CountSetFieldsFoo() int {
count := 0
if p.IsSetU4() {
count++
}
return count
}
```

After fix:
```go
func (p *Foo) CountSetFieldsFoo() int {
count := 0
if p.IsSetU1() {
count++
}
if p.IsSetU2() {
count++
}
if p.IsSetU3() {
count++
}
if p.IsSetU4() {
count++
}
return count
}
```

Fixes THRIFT-3703.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/dcelasun/thrift THRIFT-3703

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1281.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1281


commit cacfd6fd041eba27540f61a897cc5d5826126197
Author: D. Can Celasun 
Date:   2017-05-30T10:44:56Z

THRIFT-3703 Unions Field Count Does Not Consider Map/Set/List Fields

Even though maps and slices are not pointer fields in the generated
code, they are still nullable. Adding an extra check for map/set/list
types fixes the generated Count* methods.

Fixes THRIFT-3703.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] thrift pull request #1281: THRIFT-3703 Unions Field Count Does Not Consider ...

2017-05-31 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/thrift/pull/1281


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---