lambda: check interface functional

This commit is contained in:
anna
2012-07-18 11:42:44 +02:00
parent af13d2a99e
commit 507a7bbd48
15 changed files with 224 additions and 0 deletions

View File

@@ -0,0 +1 @@
abstract class Foo { public abstract void run(); }

View File

@@ -0,0 +1,4 @@
interface Foo {
int m();
Object clone();
}

View File

@@ -0,0 +1,3 @@
interface Foo { <T> T execute(Action<T> a); }
interface Action<A>{}
// Functional

View File

@@ -0,0 +1,3 @@
interface Bar { boolean equals(Object obj); }
interface Foo extends Bar { int compare(String o1, String o2); }

View File

@@ -0,0 +1,4 @@
interface Foo<T> {
boolean equals(Object obj);
int compare(T o1, T o2);
}

View File

@@ -0,0 +1 @@
interface Foo { boolean equals(Object obj); }

View File

@@ -0,0 +1 @@
interface Foo { void run(); }

View File

@@ -0,0 +1,4 @@
interface X { int m(Iterable<String> arg); }
interface Y { int m(Iterable<Integer> arg); }
interface Foo extends X, Y {}
// Not functional: No method has a subsignature of all abstract methods

View File

@@ -0,0 +1,4 @@
interface X { int m(Iterable<String> arg, Class c); }
interface Y { int m(Iterable arg, Class<?> c); }
interface Foo extends X, Y {}
// Not functional: No method has a subsignature of all abstract methods

View File

@@ -0,0 +1,4 @@
import java.util.*;
interface X { int m(Iterable<String> arg); }
interface Y { int m(Iterable<String> arg); }
interface Foo extends X, Y {}

View File

@@ -0,0 +1,5 @@
interface Action<A>{}
interface X { <T> T execute(Action<T> a); }
interface Y { <S> S execute(Action<S> a); }
interface Foo extends X, Y {}
// Functional: signatures are "the same"

View File

@@ -0,0 +1,5 @@
interface Foo1<T, N extends Number> {
void m(T arg);
void m(N arg);
}
interface Foo extends Foo1<Integer, Integer> {}

View File

@@ -0,0 +1,4 @@
import java.util.*;
interface X { Iterable m(Iterable<String> arg); }
interface Y { Iterable<String> m(Iterable arg); }
interface Foo extends X, Y {}