Since Java 7, we can use try-with-resources and have any object automatically closed that implements the Autocloseable interface. If the resource is Autocloseable, some of the classes need some wrap-up but are not Autocloseable. These are mainly old classes in some legacy framework that still get in our way to make us trip up. Nobody is using Struts any more, but still, there are enough old frameworks that are lurking in the dark and with which we have to live. I recently had that experience and I was so motivated that I created a simple AutoCloser class.
We may have a legacy class (in the example, this is a mocking inner class of the testing class)
from DZone.com Feed http://bit.ly/2VOWv0g
No comments:
Post a Comment