Commit dcae4e0a authored by peter's avatar peter
Browse files

[^ann] java completion: no inaccessible methods when qualifier has intersection type (IDEA-187481)

(cherry picked from commit 4a8038fc)
parent 7629dc9c
Showing with 11 additions and 1 deletion
+11 -1
......@@ -220,7 +220,9 @@ public class JavaCompletionProcessor implements PsiScopeProcessor, ElementClassH
public void setQualifierType(@Nullable PsiType qualifierType) {
myQualifierType = qualifierType;
myQualifierClass = PsiUtil.resolveClassInClassTypeOnly(qualifierType);
myQualifierClass = PsiUtil.resolveClassInClassTypeOnly(qualifierType instanceof PsiIntersectionType
? ((PsiIntersectionType)qualifierType).getRepresentative()
: qualifierType);
}
@Nullable
......
......@@ -342,4 +342,12 @@ class Test88 {
private checkResultByFileName() {
checkResultByFile(getTestName(false) + "_after.java")
}
void "test intersection type members"() {
myFixture.configureByText 'a.java',
'import java.util.*; class F { { (true ? new LinkedList<>() : new ArrayList<>()).<caret> }}'
myFixture.completeBasic()
assert !('finalize' in myFixture.lookupElementStrings)
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment