mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
new inference: raw inner class method qualifier fixed (IDEA-121909)
(cherry picked from commit 012fcf6e95030e673f24307cb3527e0ea82f5c72)
This commit is contained in:
@@ -208,7 +208,6 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
|
||||
if (res instanceof PsiClass) {
|
||||
PsiClass containingClass = (PsiClass)res;
|
||||
final boolean isRawSubst = !myExpression.isConstructor() &&
|
||||
PsiTreeUtil.isAncestor(containingClass, myExpression, true) &&
|
||||
PsiUtil.isRawSubstitutor(containingClass, resolveResult.getSubstitutor());
|
||||
qualifierType = JavaPsiFacade.getElementFactory(res.getProject()).createType(containingClass, isRawSubst ? PsiSubstitutor.EMPTY : resolveResult.getSubstitutor());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
class StreamMain {
|
||||
public static void main(final String... args) {
|
||||
x(Collections.<Integer, String>emptyMap().entrySet().stream().
|
||||
filter(entry -> 0 == entry.getKey() % 2).
|
||||
findFirst().
|
||||
map(Map.Entry::getValue).
|
||||
orElse("Bob!"), true);
|
||||
}
|
||||
|
||||
public static void x(final String s, final boolean b) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
||||
class StreamMainSimplified {
|
||||
public static void main(Optional<Map.Entry<Integer, String>> first) {
|
||||
String s = first.map(Map.Entry::getValue).orElse("Bob!");
|
||||
String s1 = first.map((e) -> e.getValue()).orElse("Bob!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -193,6 +193,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testRawInnerClassQualifier() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user