catch some Error fixed #11

This commit is contained in:
林万程
2022-10-23 14:35:45 +08:00
parent 9adc3775b7
commit b42cf813ed
3 changed files with 10 additions and 2 deletions

View File

@@ -23,8 +23,12 @@ public class CopyReferenceSimple extends CopyReferenceAction {
private static final Pattern QUALIFIED_PATTERN = Pattern.compile("[\\w.]+\\.");
@Override
protected String getQualifiedName(Editor editor, List<PsiElement> elements) {
String qualifiedName = super.getQualifiedName(editor, elements);
if (qualifiedName == null) {
return null;
}
int i = qualifiedName.indexOf("(");
if (i > 0) {
return QUALIFIED_PATTERN.matcher(qualifiedName).replaceAll("").replace('#', '.');

View File

@@ -50,7 +50,11 @@ public class PsiClassUtils {
@NotNull
public static PsiClass[] fullNameToClass(@NotNull String className, @NotNull Project project) {
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
return javaPsiFacade.findClasses(className, GlobalSearchScope.allScope(project));
try {
return javaPsiFacade.findClasses(className, GlobalSearchScope.allScope(project));
} catch (Throwable e) {
return PsiClass.EMPTY_ARRAY;
}
}
@NotNull

View File

@@ -78,7 +78,7 @@ class NewCallRefToPsiDoc {
if (methodComment != null) {
return methodComment;
}
} catch (Exception ignored) {
} catch (Throwable ignored) {
// ignored
}
return null;