new inference: caching resolve result during getTargetType inference (IDEA-142733; IDEA-140035; IDEA-133385)

This commit is contained in:
Anna Kozlova
2015-09-02 13:30:05 +03:00
parent 7612cfe350
commit 9a7d951e1e
4 changed files with 110 additions and 10 deletions

View File

@@ -0,0 +1,24 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Collectors;
class Test {
static class A {
static class Row {
public String get(int index) {
return "test";
}
}
void foo(List<Row> list) {
list.stream().collect(Collectors.toMap(a -> String.valueOf(a.ge<caret>t(0)),
a -> String.valueOf(a.get(1))));
}
}
}

View File

@@ -0,0 +1,49 @@
import java.util.ArrayList;
import java.util.function.Function;
import java.util.stream.Collector;
class Test {
void f() {
JSONObject deviceTokenJson = new ArrayList<DeviceToken>()
.stream()
.collect(JSON.toObject(
token -> Hex.encodeHexString(token.get<caret>Token()) ,
token -> new JSONObject()
.put("application_id", token.getAppId())
.put("sandbox", token.isSandbox())));
}
static class JSONObject {
public JSONObject put(String var1, Object var2) {
return this;
}
}
static class JSON {
static <T, R> Collector<T, ?, R> toObject(Function<DeviceToken, String> f, Function<T, R> ff) {
return null;
}
}
static private class Hex {
static String encodeHexString(byte[] t) {
return new String(t);
}
}
private static class DeviceToken {
public byte[] getToken() {
return null;
}
public String getAppId() {
return "";
}
public boolean isSandbox() {
return true;
}
}
}