mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
IDEA-92588 (check for AutoCloseable on interface extraction)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
class Test {
|
||||
void test() throws Exception {
|
||||
MyIterableImpl r = new MyIterableImpl();
|
||||
for (String s : r) {
|
||||
r.length();
|
||||
}
|
||||
}
|
||||
|
||||
interface MyIterable {
|
||||
}
|
||||
|
||||
static class MyIterableImpl implements MyIterable, Iterable<String> {
|
||||
public Iterator<String> iterator() { return null; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class Test {
|
||||
void test() throws Exception {
|
||||
MyIterableImpl r = new MyIterableImpl();
|
||||
for (String s : r) {
|
||||
r.length();
|
||||
}
|
||||
}
|
||||
|
||||
interface MyIterable {
|
||||
}
|
||||
|
||||
static class MyIterableImpl implements MyIterable, Iterable<String> {
|
||||
public Iterator<String> iterator() { return null; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class Test {
|
||||
void test() throws Exception {
|
||||
MyIterable r = new MyIterableImpl();
|
||||
for (String s : r) {
|
||||
r.length();
|
||||
}
|
||||
}
|
||||
|
||||
interface MyIterable extends Iterable<String> {
|
||||
}
|
||||
|
||||
static class MyIterableImpl implements MyIterable {
|
||||
public Iterator<String> iterator() { return null; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class Test {
|
||||
void test() throws Exception {
|
||||
MyIterableImpl r = new MyIterableImpl();
|
||||
for (String s : r) {
|
||||
r.length();
|
||||
}
|
||||
}
|
||||
|
||||
interface MyIterable extends Iterable<String> {
|
||||
}
|
||||
|
||||
static class MyIterableImpl implements MyIterable {
|
||||
public Iterator<String> iterator() { return null; }
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
void test() throws Exception {
|
||||
try (MyResourceImpl r = new MyResourceImpl()) {
|
||||
r.getName();
|
||||
}
|
||||
}
|
||||
|
||||
interface MyResource {
|
||||
String getName();
|
||||
}
|
||||
|
||||
static class MyResourceImpl implements MyResource, AutoCloseable {
|
||||
public String getName() { return ""; }
|
||||
public void close() throws Exception { }
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
void test() throws Exception {
|
||||
try (MyResourceImpl r = new MyResourceImpl()) {
|
||||
r.getName();
|
||||
}
|
||||
}
|
||||
|
||||
interface MyResource {
|
||||
String getName();
|
||||
}
|
||||
|
||||
static class MyResourceImpl implements MyResource, AutoCloseable {
|
||||
public String getName() { return ""; }
|
||||
public void close() throws Exception { }
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
void test() throws Exception {
|
||||
try (MyResource r = new MyResourceImpl()) {
|
||||
r.getName();
|
||||
}
|
||||
}
|
||||
|
||||
interface MyResource extends AutoCloseable {
|
||||
String getName();
|
||||
}
|
||||
|
||||
static class MyResourceImpl implements MyResource {
|
||||
public String getName() { return ""; }
|
||||
public void close() throws Exception { }
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
void test() throws Exception {
|
||||
try (MyResourceImpl r = new MyResourceImpl()) {
|
||||
r.getName();
|
||||
}
|
||||
}
|
||||
|
||||
interface MyResource extends AutoCloseable {
|
||||
String getName();
|
||||
}
|
||||
|
||||
static class MyResourceImpl implements MyResource {
|
||||
public String getName() { return ""; }
|
||||
public void close() throws Exception { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user