On Mon, 2 Mar 2026 18:43:01 GMT, Xueming Shen <[email protected]> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   writes any ... instead of writes out any ...
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29935#discussion_r2875646078

Reply via email to