}
final JavaResolveResult result = properties != null ? properties.getInfo() : ((PsiCallExpression)gParent).resolveMethodGenerics();
final boolean varargs = properties != null && properties.isVarargs() || result instanceof MethodCandidateInfo && ((MethodCandidateInfo)result).isVarargs();
- return getTypeByMethod(context, argumentList, result.getElement(),
- varargs,
- PsiResolveHelper.ourGraphGuard.doPreventingRecursion(argumentList.getParent(), false,
- new Computable<PsiSubstitutor>() {
- @Override
- public PsiSubstitutor compute() {
- return result.getSubstitutor();
- }
- }
- )
+ PsiSubstitutor substitutor = PsiResolveHelper.ourGraphGuard.doPreventingRecursion(context, false,
+ new Computable<PsiSubstitutor>() {
+ @Override
+ public PsiSubstitutor compute() {
+ return result.getSubstitutor();
+ }
+ }
);
+ if (substitutor == null && properties != null) {
+ substitutor = properties.getSubstitutor();
+ }
+ return getTypeByMethod(context, argumentList, result.getElement(), varargs, substitutor);
}
}
} else if (parent instanceof PsiConditionalExpression) {
--- /dev/null
+
+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))));
+ }
+
+ }
+}
\ No newline at end of file
--- /dev/null
+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;
+ }
+ }
+}
\ No newline at end of file
package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
public class Java8ExpressionsCheckTest extends LightDaemonAnalyzerTestCase {
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/expressions";
doTestAllMethodCallExpressions();
}
+ public void testCachedUnresolvedMethods() throws Exception {
+ doTestCachedUnresolved();
+ }
+
+ public void testCacheUnresolvedMethods2() throws Exception {
+ doTestCachedUnresolved();
+ }
+
+ private void doTestCachedUnresolved() {
+ configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+ PsiMethodCallExpression callExpression =
+ PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiMethodCallExpression.class);
+
+ assertNotNull(callExpression);
+ assertNotNull(callExpression.getType());
+
+ final Collection<PsiCallExpression> methodCallExpressions = PsiTreeUtil.findChildrenOfType(getFile(), PsiCallExpression.class);
+ for (PsiCallExpression expression : methodCallExpressions) {
+ assertNotNull("Failed inference for: " + expression.getText(), expression.getType());
+ }
+ }
+
public void testIDEA140035() throws Exception {
doTestAllMethodCallExpressions();
final Collection<PsiParameter> parameterLists = PsiTreeUtil.findChildrenOfType(getFile(), PsiParameter.class);