inspections: introduce empty tool wrapper array

This commit is contained in:
Dmitry Batkovich
2017-09-01 19:48:48 +03:00
parent fc65d05fd1
commit d91635bdc8
3 changed files with 4 additions and 3 deletions
@@ -37,6 +37,8 @@ import java.net.URL;
* Date: 9/28/11
*/
public abstract class InspectionToolWrapper<T extends InspectionProfileEntry, E extends InspectionEP> {
public static final InspectionToolWrapper[] EMPTY_ARRAY = new InspectionToolWrapper[0];
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.InspectionToolWrapper");
protected T myTool;
@@ -35,7 +35,6 @@ import java.util.Map;
* @author Konstantin Bulenkov
*/
public class GotoInspectionModel extends SimpleChooseByNameModel {
private static final InspectionToolWrapper[] EMPTY_WRAPPERS_ARRAY = new InspectionToolWrapper[0];
private final Map<String, InspectionToolWrapper> myToolNames = new HashMap<>();
private final String[] myNames;
private final InspectionListCellRenderer myListCellRenderer = new InspectionListCellRenderer();
@@ -69,7 +68,7 @@ public class GotoInspectionModel extends SimpleChooseByNameModel {
public Object[] getElementsByName(final String name, final String pattern) {
final InspectionToolWrapper tool = myToolNames.get(name);
if (tool == null) {
return EMPTY_WRAPPERS_ARRAY;
return InspectionToolWrapper.EMPTY_ARRAY;
}
return new InspectionToolWrapper[] {tool};
}
@@ -29,7 +29,7 @@ import java.util.Set;
* @author peter
*/
public class MockInspectionProfile extends InspectionProfileImpl {
private InspectionToolWrapper[] myInspectionTools = new InspectionToolWrapper[0];
private InspectionToolWrapper[] myInspectionTools = InspectionToolWrapper.EMPTY_ARRAY;
private final Set<InspectionToolWrapper> myDisabledTools = new THashSet<>();
public MockInspectionProfile() {