mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
IDEA-64612 Autocasting from completion is not inserted after "assert X instanceof T" (and before another assignment)
This commit is contained in:
@@ -680,8 +680,8 @@ public class JavaCompletionUtil {
|
||||
final Document document = context.getEditor().getDocument();
|
||||
PsiDocumentManager.getInstance(project).commitDocument(document);
|
||||
final PsiFile file = context.getFile();
|
||||
final PsiReferenceExpression ref =
|
||||
PsiTreeUtil.findElementOfClassAtOffset(file, context.getStartOffset(), PsiReferenceExpression.class, false);
|
||||
final PsiJavaCodeReferenceElement ref =
|
||||
PsiTreeUtil.findElementOfClassAtOffset(file, context.getStartOffset(), PsiJavaCodeReferenceElement.class, false);
|
||||
if (ref != null) {
|
||||
final PsiElement qualifier = ref.getQualifier();
|
||||
if (qualifier != null) {
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Bar {
|
||||
|
||||
static class CellWrapper {
|
||||
public boolean isSeparator() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static class MyRenderer extends DefaultListCellRenderer {
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean s, boolean focus) {
|
||||
assert value instanceof CellWrapper;
|
||||
|
||||
value.is<caret>
|
||||
|
||||
mySelected = isSelected;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Bar {
|
||||
|
||||
static class CellWrapper {
|
||||
public boolean isSeparator() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static class MyRenderer extends DefaultListCellRenderer {
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean s, boolean focus) {
|
||||
assert value instanceof CellWrapper;
|
||||
|
||||
((CellWrapper) value).isSeparator()<caret>
|
||||
|
||||
mySelected = isSelected;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -787,6 +787,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
|
||||
public void testCastTooComplexInstanceofedQualifier() throws Throwable { doAntiTest(); }
|
||||
public void testDontCastInstanceofedQualifier() throws Throwable { doTest(); }
|
||||
public void testQualifierCastingWithUnknownAssignments() throws Throwable { doTest(); }
|
||||
|
||||
public void testWildcardsInLookup() throws Exception {
|
||||
configure()
|
||||
|
||||
Reference in New Issue
Block a user