mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
add quickfix for non-disjoint multi-catch
This commit is contained in:
+6
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -2373,8 +2373,11 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
final String name1 = PsiFormatUtil.formatClass(class1, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_FQ_NAME);
|
||||
final String name2 = PsiFormatUtil.formatClass(class2, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_FQ_NAME);
|
||||
final String message = JavaErrorMessages.message("exception.must.be.disjoint", sub ? name1 : name2, sub ? name2 : name1);
|
||||
PsiElement element = typeElements.get(sub ? i : j);
|
||||
result.add(HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(element).descriptionAndTooltip(message).create());
|
||||
final PsiTypeElement element = typeElements.get(sub ? i : j);
|
||||
final HighlightInfo highlight =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(element).descriptionAndTooltip(message).create();
|
||||
QuickFixAction.registerQuickFixAction(highlight, QUICK_FIX_FACTORY.createDeleteMultiCatchFix(element));
|
||||
result.add(highlight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Delete catch for 'java.lang.RuntimeException'" "true"
|
||||
import java.io.*;
|
||||
|
||||
class C {
|
||||
void m() {
|
||||
try {
|
||||
int p = 0;
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Delete catch for 'java.lang.RuntimeException'" "true"
|
||||
import java.io.*;
|
||||
|
||||
class C {
|
||||
void m() {
|
||||
try {
|
||||
int p = 0;
|
||||
}
|
||||
catch (<caret>RuntimeException | Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user