tolerate malformed fqns in java completion (EA-63095 - IOE: PsiJavaParserFacadeImpl.createExpressionFromText)

This commit is contained in:
peter
2015-07-20 20:18:13 +02:00
parent a68b1ab38b
commit d4eebb6401
@@ -665,9 +665,15 @@ public class JavaCompletionUtil {
if (psiClass.isValid() && !psiClass.getManager().areElementsEquivalent(psiClass, resolveReference(ref))) {
final boolean staticImport = ref instanceof PsiImportStaticReferenceElement;
PsiElement newElement = staticImport
? ((PsiImportStaticReferenceElement)ref).bindToTargetClass(psiClass)
: ref.bindToElement(psiClass);
PsiElement newElement;
try {
newElement = staticImport
? ((PsiImportStaticReferenceElement)ref).bindToTargetClass(psiClass)
: ref.bindToElement(psiClass);
}
catch (IncorrectOperationException e) {
return endOffset; // can happen if fqn contains reserved words, for example
}
final RangeMarker rangeMarker = document.createRangeMarker(newElement.getTextRange());
documentManager.doPostponedOperationsAndUnblockDocument(document);