mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
lambda: redundant lambda param types
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
// "Remove redundant types" "true"
|
||||
class Test {
|
||||
{
|
||||
Comparable<String> r = o-> 1;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Remove redundant types" "true"
|
||||
class Test2 {
|
||||
class Y<T>{
|
||||
T t;
|
||||
}
|
||||
|
||||
interface I<X> {
|
||||
X foo(Y<X> list);
|
||||
}
|
||||
|
||||
static <T> I<T> bar(I<T> i){return i;}
|
||||
|
||||
{
|
||||
Test2.<String>bar(y-> y.t);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Remove redundant types" "true"
|
||||
class ReturnTypeCompatibility {
|
||||
|
||||
interface I1<L> {
|
||||
L m(L x);
|
||||
}
|
||||
|
||||
static <P> void call(P p, I1<P> i2) {
|
||||
i2.m(null);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
call("", i-> "");
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Remove redundant types" "true"
|
||||
class Test {
|
||||
{
|
||||
Comparable<String> r = (St<caret>ring o) -> 1;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Remove redundant types" "false"
|
||||
class Test {
|
||||
{
|
||||
Runnable r = (<caret>) -> {};
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Remove redundant types" "false"
|
||||
class Test {
|
||||
{
|
||||
Comparable<String> r = <caret>o -> 1;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Remove redundant types" "false"
|
||||
class Test2 {
|
||||
class Y<T>{
|
||||
T t;
|
||||
}
|
||||
|
||||
interface I<X> {
|
||||
X foo(Y<X> list);
|
||||
}
|
||||
|
||||
static <T> I<T> bar(I<T> i){return i;}
|
||||
|
||||
{
|
||||
Test2.bar((Y<St<caret>ring> y) -> y.t);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Remove redundant types" "false"
|
||||
class NoInferenceResult {
|
||||
interface I<A, B> {
|
||||
B foo(A a);
|
||||
}
|
||||
|
||||
<A, B> I<A, B> m(I<A, B> f) { return null; }
|
||||
|
||||
void test() {
|
||||
m((Stri<caret>ng s1) -> s1.length());
|
||||
m((String s1) -> s1);
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Remove redundant types" "true"
|
||||
class Test2 {
|
||||
class Y<T>{
|
||||
T t;
|
||||
}
|
||||
|
||||
interface I<X> {
|
||||
X foo(Y<X> list);
|
||||
}
|
||||
|
||||
static <T> I<T> bar(I<T> i){return i;}
|
||||
|
||||
{
|
||||
Test2.<String>bar((Y<St<caret>ring> y) -> y.t);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Remove redundant types" "true"
|
||||
class ReturnTypeCompatibility {
|
||||
|
||||
interface I1<L> {
|
||||
L m(L x);
|
||||
}
|
||||
|
||||
static <P> void call(P p, I1<P> i2) {
|
||||
i2.m(null);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
call("", (Str<caret>ing i) -> "");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user