Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse try-with-resource template?

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?

like image 726
finejustice Avatar asked Nov 10 '22 08:11

finejustice


1 Answers

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

like image 113
Arend v. Reinersdorff Avatar answered Nov 14 '22 23:11

Arend v. Reinersdorff