-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P5
-
None
-
Affects Version/s: 25
-
Component/s: core-libs
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
The SegmentAllocator class Javadoc says "SegmentAllocator is a functional interface [...]" and then contains this Java snippet:
```
SegmentAllocator autoAllocator = (byteSize, byteAlignment) -> Arena.ofAuto().allocate(byteSize, byteAlignment);
```
This is rather misleading, because Arena implements SegmentAllocator, so this snippet could be simplified a lot to just `SegmentAllocator autoAllocator = Arena.ofAuto()`.
Why is this is problem?
- Many APIs take a SegmentAllocator as parameter, so users might encounter it first before the Arena class
- Users might think the currently shown snippet is the proper way of obtaining a SegmentAllocator, which leads to unnecessarily complex code
Suggested changes:
- Mention Arena more prominently in the SegmentAllocator docs, because for most use cases an Arena will be the default choice
- Remove the "SegmentAllocator is a functional interface [...]" section or show a more realistic / useful example?
The SegmentAllocator class Javadoc says "SegmentAllocator is a functional interface [...]" and then contains this Java snippet:
```
SegmentAllocator autoAllocator = (byteSize, byteAlignment) -> Arena.ofAuto().allocate(byteSize, byteAlignment);
```
This is rather misleading, because Arena implements SegmentAllocator, so this snippet could be simplified a lot to just `SegmentAllocator autoAllocator = Arena.ofAuto()`.
Why is this is problem?
- Many APIs take a SegmentAllocator as parameter, so users might encounter it first before the Arena class
- Users might think the currently shown snippet is the proper way of obtaining a SegmentAllocator, which leads to unnecessarily complex code
Suggested changes:
- Mention Arena more prominently in the SegmentAllocator docs, because for most use cases an Arena will be the default choice
- Remove the "SegmentAllocator is a functional interface [...]" section or show a more realistic / useful example?