Skip to content

De-duplicate PooledByteBuf implementations - #9120

Merged
normanmaurer merged 1 commit into
netty:4.1from
njhill:buffers-dedup
Jun 19, 2019
Merged

normanmaurer merged 1 commit into
netty:4.1from
njhill:buffers-dedup

Conversation

@njhill

@njhill njhill commented May 3, 2019

Copy link
Copy Markdown
Member

Motivation

There's quite a lot of duplicate/equivalent logic across the various concrete ByteBuf implementations. We could take this even further but here I've focused on the PooledByteBuf sub-hierarchy.

Modifications

  • Move common logic/methods into existing PooledByteBuf abstract superclass
  • Shorten PooledByteBuf.capacity(int) method implementation

Result

Less code to maintain

@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

@normanmaurer normanmaurer added this to the 4.1.37.Final milestone Jun 17, 2019
@normanmaurer

Copy link
Copy Markdown
Member

@njhill can you rebase and fix compile error and let me know once done ?

15:29:54 [INFO] ------------------------------------------------------------------------
15:29:54 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project netty-buffer: Compilation failure
15:29:54 [ERROR] /code/buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java:[1423,12] error: method checkRangeBounds in class AbstractByteBuf cannot be applied to given types;
15:29:54 [ERROR]   required: String,int,int,int
15:29:54 [ERROR]   found: int,int,int
15:29:54 [ERROR]   reason: actual and formal argument lists differ in length
15:29:54 [ERROR] 
15:29:54 [ERROR] -> [Help 1]
15:29:54 [ERROR] 
15:29:54 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
15:29:54 [ERROR] Re-run Maven using the -X switch to enable full debug logging.

Motivation

There's quite a lot of duplicate/equivalent logic across the various
concrete ByteBuf implementations. We could take this even further but
for now I've focused on the PooledByteBuf sub-hierarchy.

Modifications

- Move common logic/methods into existing PooledByteBuf abstract
superclass
- Shorten PooledByteBuf.capacity(int) method implementation

Result

Less code to maintain
@njhill

njhill commented Jun 18, 2019

Copy link
Copy Markdown
Member Author

@normanmaurer done!

@normanmaurer

Copy link
Copy Markdown
Member

@netty-bot test this please

@normanmaurer
normanmaurer merged commit 6381d07 into netty:4.1 Jun 19, 2019
@normanmaurer

Copy link
Copy Markdown
Member

@njhill thanks a lot!

normanmaurer pushed a commit that referenced this pull request Jun 19, 2019
Motivation

There's quite a lot of duplicate/equivalent logic across the various
concrete ByteBuf implementations. We could take this even further but
for now I've focused on the PooledByteBuf sub-hierarchy.

Modifications

- Move common logic/methods into existing PooledByteBuf abstract
superclass
- Shorten PooledByteBuf.capacity(int) method implementation

Result

Less code to maintain
@njhill
njhill deleted the buffers-dedup branch June 19, 2019 23:25
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