JDK-4850330 : (bf spec) Buffer spec should note that buffers are a closed abstraction
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-04-17
  • Updated: 2022-03-24
  • Resolved: 2022-03-24
Related Reports
Duplicate :  
Relates :  
Description

Name: rmT116609			Date: 04/17/2003


A DESCRIPTION OF THE REQUEST :
CharBuffer includes a package-private abstract method, toString(int,int). This effectively precludes making subclasses of CharBuffer in other packages.

JUSTIFICATION :
It seems useful and legitimate to allow user subclasses of CharBuffer, which may wrap other object types or annotate the CharBuffer with additional state.


EXPECTED VERSUS ACTUAL BEHAVIOR :
If precluding such subclasses is intentional design, a Javadoc note explaining why developers should not create their own CharBuffer subclasses would be appreciated.

If precluding such subclasses is unintentional behavior, please remove the package-private protection on the toString(int,int) method to enable outside subclassing. (It's the only abstract method in CharBuffer so protected.)
(Review ID: 184321) 
======================================================================

Comments
Resolving this issue as a duplicate of JDK-8283417.
24-03-2022

Changing the java.nio.Buffer hierarchy to use sealed classes makes it clear that buffers are a closed abstraction.
24-03-2022

EVALUATION Buffers are intentionally non-extensible for performance reasons. A note will be added to the specification to explain this. -- ###@###.### 2003/4/22
04-11-0188