eclipse 尝试资源模板?

fin*_*ice 5 java eclipse templates try-with-resources

Eclipse 支持 try-with-resource,有点像这样:

try(Outputstream resource = new FileOutputStream(file)){
// do something...
}
Run Code Online (Sandbox Code Playgroud)

自从这个功能添加到 Eclipse 以来已经有很多年了,但是还没有模板“try-with-reousource”。只存在一种“try-catch”。

我尝试制作模板,例如try($type{} ${localVar} = new $type{}){ {$cursor{} },但没有用。(还建议使用非 AutoClosable 类型)

有没有有用的资源尝试模板?

Are*_*rff 1

Eclipse 中不包含“try-with-resource”模板。

有一个未解决的问题:Bug 351864 - [1.7][templates] Add 'try-with-resource' template