guava type migration: convert anonymous Function-s with runtime retention policy annotations to anonymous classes except @javax.annotations.Nullable (can be configured in settings)

This commit is contained in:
Dmitry Batkovich
2016-03-22 14:46:28 +03:00
parent b19935c978
commit 0790362737
21 changed files with 323 additions and 58 deletions
@@ -0,0 +1,29 @@
import com.google.common.base.Function;
import com.google.common.collect.FluentIterable;
import javax.annotations.Nullable;
import static com.google.common.collect.FluentIterable.from
import java.util.ArrayList;
import java.util.List;
class A {
void m(List<String> l) {
Function<String, String> function = new Function<String, String>() {
@Nullable
@Override
public String apply(@Nullable String x) {
return x;
}
};
boolean strings = FluentIterable.from(l).transform(new Function<String, String>() {
@Nullable
@Override
public String apply(@Nullable String x) {
return x;
}
}).first().isPresent();
}
}
@@ -0,0 +1,29 @@
import com.google.common.base.Function;
import com.google.common.collect.FluentIterable;
import javax.annotations.Nullable;
import static com.google.common.collect.FluentIterable.from
import java.util.ArrayList;
import java.util.List;
class A {
void m(List<String> l) {
Function<String, String> function = new Function<String, String>() {
@Nullable
@Override
public String apply(@Nullable String x) {
return x;
}
};
boolean strings = FluentIterable.from(l).transform(new Function<String, String>() {
@Nullable
@Override
public String apply(@Nullable String x) {
return x;
}
}).first().isPresent();
}
}
@@ -0,0 +1,12 @@
import java.util.List;
import java.util.function.Function;
class A {
void m(List<String> l) {
Function<String, String> function = x -> x;
boolean strings = l.stream().map(x -> x).findFirst().isPresent();
}
}
@@ -0,0 +1,12 @@
import java.util.List;
import java.util.function.Function;
class A {
void m(List<String> l) {
Function<String, String> function = x -> x;
boolean strings = l.stream().map(x -> x).findFirst().isPresent();
}
}