Issue
Eclipse supports try-with-resource, somewhat like this:
try(Outputstream resource = new FileOutputStream(file)){
// do something...
}
It has been years since this featured added to eclipse, but there is no template "try-with-reousource". only exists one is "try-catch".
I tried to make template, like try($type{} ${localVar} = new $type{}){ {$cursor{} }
, but was useless. (non-AutoClosable types were also suggested)
Is there any useful try-with-resource template?
Solution
There's no "try-with-resource" template included in Eclipse.
There is an open issue for it: Bug 351864 - [1.7][templates] Add 'try-with-resource' template
Answered By - Arend v. Reinersdorff
Answer Checked By - David Goodson (JavaFixing Volunteer)