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

Make Context Closeable #864

Merged
merged 1 commit into from
Apr 14, 2021
Merged

Make Context Closeable #864

merged 1 commit into from
Apr 14, 2021

Conversation

gbrail
Copy link
Collaborator

@gbrail gbrail commented Apr 13, 2021

This makes it possible to write:

try (Context cx = Context.enter()) { ... }

instead of using try...finally.

This makes it possible to write:

try (Context cx = Context.enter()) { ... }

instead of using try...finally.
Copy link
Collaborator

@rbri rbri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make exit deprecated?
Maybe we can make close() the default implementation and exit() the forwarder method.

@gbrail
Copy link
Collaborator Author

gbrail commented Apr 14, 2021

Yes -- we could encourage people to call "close" instead of exit if they aren't using a try...catch (for instance, in lots of tests we create the context in a @before method and exit in @after. But my gut feeling is that making it deprecated will just mean that we get deprecation warnings for the next 20 years of Rhino development and it might not be worth the effort unless we want to actually go in and remove the code some day in the future.

@rbri
Copy link
Collaborator

rbri commented Apr 14, 2021

not sure what we all do in 20 years but i can live without the deprecated warning (hopefully for the next 20 years)

@gbrail
Copy link
Collaborator Author

gbrail commented Apr 14, 2021

Thanks for taking a look at this!

@gbrail gbrail merged commit c86875e into master Apr 14, 2021
@p-bakker p-bakker added enhancement Java Interop Issues related to the interaction between Java and JavaScript labels Oct 13, 2021
@p-bakker p-bakker added this to the Release 1.7.14 milestone Oct 13, 2021
@p-bakker p-bakker added embedding Rhino Issues related to enbedding Rhino and removed Java Interop Issues related to the interaction between Java and JavaScript labels Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedding Rhino Issues related to enbedding Rhino enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants