Add "try-with-resources" live postfix template

This commit is contained in:
Andrey Starovoyt
2014-04-17 17:57:50 +04:00
parent cfec5b058e
commit 5d908867e0
14 changed files with 324 additions and 4 deletions
@@ -0,0 +1,12 @@
import java.lang.AutoCloseable
public class Foo {
void m() {
getStream().twr<caret>
}
AutoCloseable getStream()
{
return null;
}
}
@@ -0,0 +1,12 @@
import java.lang.AutoCloseable
public class Foo {
void m() {
getStream().twr<caret>
}
Object getStream()
{
return null;
}
}
@@ -0,0 +1,12 @@
import java.lang.AutoCloseable
public class Foo {
void m() {
getStream().twr <caret>
}
Object getStream()
{
return null;
}
}
@@ -0,0 +1,17 @@
import java.lang.AutoCloseable
public class Foo {
void m() {
getStream().twr<caret>
}
AutoCloseable getStream()
{
return null;
}
private class Exception extends java.lang.Exception
{
}
}
@@ -0,0 +1,20 @@
import java.lang.AutoCloseable
public class Foo {
void m() {
try (AutoCloseable stream = getStream()) {
<caret>
} catch (java.lang.Exception e) {
}
}
AutoCloseable getStream()
{
return null;
}
private class Exception extends java.lang.Exception
{
}
}
@@ -0,0 +1,23 @@
import java.lang.AutoCloseable
import java.lang.Exception;
public class Foo {
void m() {
getStream().twr<caret>
}
MyStream getStream()
{
return null;
}
private class MyStream implements AutoCloseable
{
public void close() throws MyException {}
}
private class MyException extends Exception
{
}
}
@@ -0,0 +1,26 @@
import java.lang.AutoCloseable
import java.lang.Exception;
public class Foo {
void m() {
try (MyStream stream = getStream()) {
<caret>
} catch (MyException e) {
}
}
MyStream getStream()
{
return null;
}
private class MyStream implements AutoCloseable
{
public void close() throws MyException {}
}
private class MyException extends Exception
{
}
}
@@ -0,0 +1,15 @@
import java.lang.AutoCloseable
public class Foo {
void m() {
try (AutoCloseable stream = getStream()) {
<caret>
} catch (Exception e) {
}
}
AutoCloseable getStream()
{
return null;
}
}