On Thu, 16 Jan 2025 17:53:48 GMT, Leonid Mesnik <lmes...@openjdk.org> wrote:

>> test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java line 46:
>> 
>>> 44:     public int   getInt(long pos) throws IOException;
>>> 45:     public long  getLong(long pos) throws IOException;
>>> 46:     public void  close() throws IOException;
>> 
>> Why was this redefined to throw IOException rather than just Exception?
>
> The javac complains about potential InterruptedException, so I changed type.
> See
> https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html
> `Implementers of this interface are also strongly advised to not have the 
> close method throw 
> [InterruptedException](https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html).
>  This exception interacts with a thread's interrupted status, and runtime 
> misbehavior is likely to occur if an InterruptedException is 
> [suppressed](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#addSuppressed-java.lang.Throwable-).
>  More generally, if it would cause problems for an exception to be 
> suppressed, the AutoCloseable.close method should not throw it.`

Ugggh! That is an annoyance.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23143#discussion_r1919602558

Reply via email to