mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
commented tests for use interface where possible refactoring
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
interface Int {
|
||||
Int f();
|
||||
}
|
||||
class Impl implements Int {
|
||||
void foo(){}
|
||||
Impl f() {return this;}
|
||||
}
|
||||
|
||||
class Usage {
|
||||
void fk(Impl l, Impl ll){
|
||||
l.f().foo();
|
||||
|
||||
final Impl f = ll.f();
|
||||
f.foo();
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
interface Int {
|
||||
Int f();
|
||||
}
|
||||
class Impl implements Int {
|
||||
void foo(){}
|
||||
Impl f() {return this;}
|
||||
}
|
||||
|
||||
class Usage {
|
||||
void fk(Impl l, Impl ll){
|
||||
l.f().foo();
|
||||
|
||||
final Impl f = ll.f();
|
||||
f.foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import java.util.*;
|
||||
interface Int {}
|
||||
class Impl implements Int {
|
||||
void foo(){}
|
||||
}
|
||||
|
||||
class Usage {
|
||||
void f(List<Impl> l){
|
||||
for (Impl aImpl : l) {
|
||||
aImpl.foo();
|
||||
}
|
||||
l.get(0).foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import java.util.*;
|
||||
interface Int {}
|
||||
class Impl implements Int {
|
||||
void foo(){}
|
||||
}
|
||||
|
||||
class Usage {
|
||||
void f(List<Impl> l){
|
||||
for (Impl aImpl : l) {
|
||||
aImpl.foo();
|
||||
}
|
||||
l.get(0).foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import java.util.*;
|
||||
|
||||
interface Int {
|
||||
}
|
||||
|
||||
class Impl implements Int {
|
||||
void foo() {
|
||||
}
|
||||
}
|
||||
|
||||
class Usage {
|
||||
void f() {
|
||||
List<Impl> l = new ArrayList<Impl>();
|
||||
l.get(0).foo();
|
||||
|
||||
|
||||
List<Int> l1 = new ArrayList<Int>();
|
||||
Int i = l1.get(0);
|
||||
|
||||
|
||||
List<Impl> l2 = new ArrayList<Impl>();
|
||||
Impl i2 = l2.get(0);
|
||||
i2.foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import java.util.*;
|
||||
|
||||
interface Int {
|
||||
}
|
||||
|
||||
class Impl implements Int {
|
||||
void foo() {
|
||||
}
|
||||
}
|
||||
|
||||
class Usage {
|
||||
void f() {
|
||||
List<Impl> l = new ArrayList<Impl>();
|
||||
l.get(0).foo();
|
||||
|
||||
|
||||
List<Impl> l1 = new ArrayList<Impl>();
|
||||
Impl i = l1.get(0);
|
||||
|
||||
|
||||
List<Impl> l2 = new ArrayList<Impl>();
|
||||
Impl i2 = l2.get(0);
|
||||
i2.foo();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import java.util.*;
|
||||
interface Int {}
|
||||
class Impl implements Int {
|
||||
}
|
||||
|
||||
class Usage {
|
||||
void f(List<Int> l){}
|
||||
void bar() {
|
||||
f(Collections.<Int>emptyList());
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import java.util.*;
|
||||
interface Int {}
|
||||
class Impl implements Int {
|
||||
}
|
||||
|
||||
class Usage {
|
||||
void f(List<Impl> l){}
|
||||
void bar() {
|
||||
f(Collections.<Impl>emptyList());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user