Skip to content

Avoid repeating the same field and hiding it#8335

Merged
normanmaurer merged 1 commit intonetty:4.1from
Squarespace:rkapsi/issue-8331
Sep 28, 2018
Merged

Avoid repeating the same field and hiding it#8335
normanmaurer merged 1 commit intonetty:4.1from
Squarespace:rkapsi/issue-8331

Conversation

@rkapsi
Copy link
Copy Markdown
Member

@rkapsi rkapsi commented Sep 28, 2018

Motivation

The EpollChannelConfig (same for KQueues) and its subclasses repeatetly declare their own channel field which leads to a 3x repetition for each config instance. Given the fields are protected or package-private it's exposing the code code to "field hiding" bugs.

Modifications

Use the the existing protected channel field from the DefaultChannelConfig class and simply cast it when needed.

Result

Fixes #8331

Copy link
Copy Markdown
Member

@normanmaurer normanmaurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@normanmaurer normanmaurer self-assigned this Sep 28, 2018
@normanmaurer normanmaurer added this to the 4.1.31.Final milestone Sep 28, 2018
@netty-bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

@normanmaurer
Copy link
Copy Markdown
Member

@netty-bot test this please

Motivation

The EpollChannelConfig (same for KQueues) and its subclasses repeatetly declare their own channel field which leads to a 3x repetition for each config instance. Given the fields are protected or package-private it's exposing the code code to "field hiding" bugs.

Modifications

Use the the existing protected channel field from the DefaultChannelConfig class and simply cast it when needed.

Result

Fixes netty#8331
@normanmaurer normanmaurer merged commit 6138541 into netty:4.1 Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants