mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
paste reference: ignore binding if reference was not created as it could be e.g. groovy method name = invalid java identifier
EA-89854 - IOE: PsiJavaParserFacadeImpl.createExpressionFromText
This commit is contained in:
@@ -219,30 +219,27 @@ public class JavaQualifiedNameProvider implements QualifiedNameProvider {
|
||||
final PsiExpression expression;
|
||||
try {
|
||||
expression = factory.createExpressionFromText(toInsert + suffix, elementAtCaret);
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
LOG.error(e);
|
||||
return;
|
||||
}
|
||||
final PsiReferenceExpression referenceExpression = expression instanceof PsiMethodCallExpression
|
||||
? ((PsiMethodCallExpression)expression).getMethodExpression()
|
||||
: expression instanceof PsiReferenceExpression
|
||||
? (PsiReferenceExpression)expression
|
||||
: null;
|
||||
if (referenceExpression == null || !referenceExpression.isValid()) {
|
||||
toInsert = fqn;
|
||||
}
|
||||
else if (!isReferencedTo(referenceExpression, targetElement)) {
|
||||
try {
|
||||
referenceExpression.bindToElement(targetElement);
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
// failed to bind
|
||||
}
|
||||
if (!referenceExpression.isValid() || !isReferencedTo(referenceExpression, targetElement)) {
|
||||
final PsiReferenceExpression referenceExpression = expression instanceof PsiMethodCallExpression
|
||||
? ((PsiMethodCallExpression)expression).getMethodExpression()
|
||||
: expression instanceof PsiReferenceExpression
|
||||
? (PsiReferenceExpression)expression
|
||||
: null;
|
||||
if (referenceExpression == null || !referenceExpression.isValid()) {
|
||||
toInsert = fqn;
|
||||
}
|
||||
else if (!isReferencedTo(referenceExpression, targetElement)) {
|
||||
try {
|
||||
referenceExpression.bindToElement(targetElement);
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
// failed to bind
|
||||
}
|
||||
if (!referenceExpression.isValid() || !isReferencedTo(referenceExpression, targetElement)) {
|
||||
toInsert = fqn;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IncorrectOperationException ignored) {}
|
||||
}
|
||||
if (toInsert == null) toInsert = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user