JDK-6451131 : (bf) Generify Buffer to enhance chaining of flip()
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-07-20
  • Updated: 2018-08-07
  • Resolved: 2018-08-07
Related Reports
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
Assume I have:

ByteBuffer bb;

For reading the first byte of this Buffer after filling I must code:

((ByteBuffer)bb.flip()).get();


JUSTIFICATION :

  To avoid the cast to ByteBuffer, class Buffer must be generified.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
This should be valid:

bb.flip().get();

ACTUAL -
Casting needed:

((ByteBuffer)bb.flip()).get();


CUSTOMER SUBMITTED WORKAROUND :
Casting

Comments
Resolving as Not an Issue as per Alan's comment JDK-4774077 dealt with this.
07-08-2018

The buffer classes have long been updated to use covariant return types so I think we can close this issue.
20-07-2017

EVALUATION Contribution forum : https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?forumID=1463&messageID=15540
19-09-2006

EVALUATION A specific instance of 4774077. Ideally we'd generify all of java.nio at the same time, but there's nothing preventing us from providing parameterized types incrementally.
20-07-2006