From deadf38a44e70b7496f67f8a5d1a6dfddddf85e9 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 29 Jul 2010 21:03:17 +0400 Subject: [PATCH] fix compilation of sample plugin; cleanup --- .../ComparingReferencesInspection.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesInspection.java b/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesInspection.java index 5532b0b6e44a..4c99465a2176 100644 --- a/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesInspection.java +++ b/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesInspection.java @@ -3,6 +3,7 @@ package com.intellij.codeInspection; import com.intellij.codeInsight.daemon.GroupNames; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Ref; import com.intellij.psi.*; import com.intellij.psi.tree.IElementType; import com.intellij.ui.DocumentAdapter; @@ -78,7 +79,7 @@ public class ComparingReferencesInspection extends BaseJavaLocalInspectionTool { private ProblemDescriptor[] analyzeCode(PsiElement where, final InspectionManager manager) { if (where == null) return null; - final ArrayList[] problemList = new ArrayList[]{null}; + final Ref> problemList = new Ref>(); where.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitMethod(PsiMethod method) {} @@ -96,18 +97,18 @@ public class ComparingReferencesInspection extends BaseJavaLocalInspectionTool { PsiType rType = rOperand.getType(); if (isCheckedType(lType) || isCheckedType(rType)) { - if (problemList[0] == null) problemList[0] = new ArrayList(); - problemList[0].add(manager.createProblemDescriptor(expression, DESCRIPTION_TEMPLATE, + if (problemList.get() == null) problemList.set(new ArrayList()); + problemList.get().add(manager.createProblemDescriptor(expression, DESCRIPTION_TEMPLATE, myQuickFix, - ProblemHighlightType.GENERIC_ERROR_OR_WARNING, onTheFly)); + ProblemHighlightType.GENERIC_ERROR_OR_WARNING)); } } } }); - return problemList[0] == null + return problemList.get() == null ? null - : (ProblemDescriptor[])problemList[0].toArray(new ProblemDescriptor[problemList[0].size()]); + : problemList.get().toArray(new ProblemDescriptor[problemList.get().size()]); } private static boolean isNullLiteral(PsiExpression expr) {