On Tue, 3 Mar 2026 02:05:56 GMT, Jaikiran Pai <[email protected]> wrote:
>> src/java.base/share/classes/java/util/zip/InflaterOutputStream.java line 228:
>>
>>> 226: *
>>> 227: * @implSpec This method calls {@link #flush()} to write any
>>> pending buffered
>>> 228: * decompressed data.
>>
>> Do we really want to explicitly specify (enforce?) "finish() -> flush()"
>> here. @implSpec is normative, this may be read as an implementation
>> requirement for finish(). If a subclass override finish() without calling
>> flush() but still provides equivalent output semantics, this wording might
>> overly constraining? Or I'm overthinking this?
>
> Hello Sherman,
>
>> @implSpec is normative, this may be read as an implementation requirement
>> for finish().
>
> My understanding of `@implSpec` is that it specifies what the subclasses can
> expect of this superclass method, so that they can then decide if/how they
> would like to override the method. It doesn't specify what the subclasses are
> expected to do. So this text doesn't mandate that subclasses call `flush()`
> in their overridden `finish()`.
>
> This draft JEP here https://openjdk.org/jeps/8068562 has some additional
> details of these tags. The implSpec section says:
>
>> Implementation Specification. This is where the default implementation (or
>> an overrideable implementation in a class) is specified. Interface
>> implementors or class subclassers use the information here in order to
>> decide whether it is sensible or necessary to override a particular method,
>> and what behavior they can rely on if a method is called via super.
I think implSpec is appropriate here as it is specifying what the close and
finish methods in the base class.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29935#discussion_r2876587703