RFR: 8256828: ostream::print_cr() truncates buffer in copy-through case [v3]

David Holmes dholmes at openjdk.org
Tue Jun 4 06:56:01 UTC 2024


On Tue, 4 Jun 2024 04:19:03 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/share/utilities/defaultStream.hpp line 33:
>> 
>>> 31:   friend void ostream_abort();
>>> 32:  public:
>>> 33:   class TestSupport;  // Unit test support
>> 
>> Interesting variant of the "friend class for test support". I never thought of this. An advantage is that its name is scoped to the testee class, so one does not have to think up a good name.
>
> Any reason why you test defaultstream and instread of outputStream?

Because I use `tty` which is a `defaultStream` so that is where the test code has to be placed to access the protected function.

BTW this pattern was suggested by Kim Barrett in preference to the use of a friend class.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19512#discussion_r1625448806


More information about the hotspot-dev mailing list