mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
Add "try-with-resources" live postfix template
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import java.lang.AutoCloseable
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
getStream().twr<caret>
|
||||
}
|
||||
|
||||
AutoCloseable getStream()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import java.lang.AutoCloseable
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
getStream().twr<caret>
|
||||
}
|
||||
|
||||
Object getStream()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import java.lang.AutoCloseable
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
getStream().twr <caret>
|
||||
}
|
||||
|
||||
Object getStream()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+17
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+20
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+23
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+26
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user