Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve BlockingIterable javadoc #2010

Merged
merged 1 commit into from Dec 14, 2021

Conversation

chemicL
Copy link
Contributor

@chemicL chemicL commented Dec 10, 2021

Motivation:

BlockingIterable and BlockingIterator methods can throw
InterruptedException using the sneaky-throw mechanism. The reason for
it is that implementations rely on BlockingQueue which may be
interrupted. However, as BlockingIterator extends Iterator from the
JDK, its' method signatures don't list any checked exception. Therefore
it would be inconsistent to have some methods declare checked
exceptions, while the overridden ones not.

Modification:

Add javadoc notes to all methods that can throw InterruptedException
to BlockingIterable and BlockingIterator.

Result:

The runtime behavior is better described via javadoc.

Motivation:

`BlockingIterable` and `BlockingIterator` methods can throw
`InterruptedException` using the sneaky-throw mechanism. The reason for
it is that implementations rely on `BlockingQueue` which may be
interrupted. However, as `BlockingIterator` extends `Iterator` from the
JDK, its' method signatures don't list any checked exception. Therefore
it would be inconsistent to have some methods declare checked
exceptions, while the overridden ones not.

Modification:

Add javadoc notes to all methods that can throw `InterruptedException`
to `BlockingIterable` and `BlockingIterator`.

Result:

The runtime behavior is better described via javadoc.
@idelpivnitskiy idelpivnitskiy merged commit 8bfa4c1 into apple:main Dec 14, 2021
idelpivnitskiy pushed a commit that referenced this pull request Dec 14, 2021
Motivation:

`BlockingIterable` and `BlockingIterator` methods can throw
`InterruptedException` using the sneaky-throw mechanism. The reason for
it is that implementations rely on `BlockingQueue` which may be
interrupted. However, as `BlockingIterator` extends `Iterator` from the
JDK, its' method signatures don't list any checked exception. Therefore
it would be inconsistent to have some methods declare checked
exceptions, while the overridden ones not.

Modification:

Add javadoc notes to all methods that can throw `InterruptedException`
to `BlockingIterable` and `BlockingIterator`.

Result:

The runtime behavior is better described via javadoc.
@chemicL chemicL deleted the document-interrupted-exceptions branch December 14, 2021 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants