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

Adjust Handle.get() behavior - throw exception if attempting to get()… #555

Merged
merged 1 commit into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/src/main/java/jakarta/enterprise/inject/Instance.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ interface Handle<T> extends AutoCloseable {
* @return the contextual reference
* @see Instance#get()
* @throws IllegalStateException If the producing {@link Instance} does not exist
* @throws IllegalStateException If invoked on {@link Handle} that previously successfully destroyed its
* underlying contextual reference
*/
T get();

Expand Down
3 changes: 2 additions & 1 deletion spec/src/main/asciidoc/core/injectionandresolution.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,8 @@ public interface Handle<T> extends AutoCloseable {
}
----

The `get()` method returns a contextual reference object. The contextual reference is resolved lazily.
The `get()` method returns a contextual reference object. The contextual reference is resolved lazily. Throws
`IllegalStateException` if invoked on `Handle` that previously successfully destroyed its underlying contextual reference.

The `getBean()` method returns the `Bean` object representing metadata of the given contextual instance.

Expand Down