diff --git a/lib/winp.dll b/lib/winp.dll new file mode 100644 index 000000000000..f5e4ca8f8f6c Binary files /dev/null and b/lib/winp.dll differ diff --git a/plugins/groovy/resources/inspectionDescriptions/GroovyUnusedSymbol.html b/plugins/groovy/resources/inspectionDescriptions/GroovyUnusedSymbol.html new file mode 100644 index 000000000000..243d806709fd --- /dev/null +++ b/plugins/groovy/resources/inspectionDescriptions/GroovyUnusedSymbol.html @@ -0,0 +1,5 @@ + + +Detects local variables and private members that are declared but not used, never accessed for reading or not initialized in a class. + + \ No newline at end of file diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index 6226695b0628..c04542deb5f8 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -407,6 +407,9 @@ implementationClass="org.jetbrains.plugins.groovy.codeInspection.secondUnsafeCall.SecondUnsafeCallInspection"/> + > engine = new DFAEngine>(flow, dfaInstance, lattice); + final List> dfaResult = engine.performDFAWithTimeout(); + if (dfaResult == null) { + return; + } + + final TIntHashSet unusedDefs = new TIntHashSet(); + for (Instruction instruction : flow) { + if (instruction instanceof ReadWriteVariableInstruction && ((ReadWriteVariableInstruction) instruction).isWrite()) { + unusedDefs.add(instruction.num()); + } + } + + for (int i = 0; i < dfaResult.size(); i++) { + final Instruction instruction = flow[i]; + if (instruction instanceof ReadWriteVariableInstruction) { + final ReadWriteVariableInstruction varInst = (ReadWriteVariableInstruction) instruction; + if (!varInst.isWrite()) { + final String varName = varInst.getVariableName(); + TIntObjectHashMap e = dfaResult.get(i); + e.forEachValue(new TObjectProcedure() { + public boolean execute(TIntHashSet reaching) { + reaching.forEach(new TIntProcedure() { + public boolean execute(int defNum) { + final String defName = ((ReadWriteVariableInstruction) flow[defNum]).getVariableName(); + if (varName.equals(defName)) { + unusedDefs.remove(defNum); + } + return true; + } + }); + return true; + } + }); + } + } + } + + unusedDefs.forEach(new TIntProcedure() { + public boolean execute(int num) { + final ReadWriteVariableInstruction instruction = (ReadWriteVariableInstruction)flow[num]; + final PsiElement element = instruction.getElement(); + if (element == null) return true; + if (isLocalAssignment(element) && isUsedInTopLevelFlowOnly(element) && !isIncOrDec(element)) { + PsiElement toHighlight = getHighlightElement(element); + problemsHolder.registerProblem(toHighlight, GroovyInspectionBundle.message("unused.assignment.tooltip"), + ProblemHighlightType.LIKE_UNUSED_SYMBOL); + } + return true; + } + }); + } + + private static PsiElement getHighlightElement(PsiElement element) { + PsiElement toHighlight = null; + if (element instanceof GrReferenceExpression) { + PsiElement parent = element.getParent(); + if (parent instanceof GrAssignmentExpression) { + toHighlight = ((GrAssignmentExpression)parent).getLValue(); + } + if (parent instanceof GrUnaryExpression && ((GrUnaryExpression)parent).isPostfix()) { + toHighlight = parent; + } + } + else if (element instanceof GrVariable) { + toHighlight = ((GrVariable)element).getNameIdentifierGroovy(); + } + if (toHighlight == null) toHighlight = element; + return toHighlight; + } + + private static boolean isIncOrDec(PsiElement element) { + PsiElement parent = element.getParent(); + if (!(parent instanceof GrUnaryExpression)) return false; + + IElementType type = ((GrUnaryExpression)parent).getOperationTokenType(); + return type == GroovyTokenTypes.mINC || type == GroovyTokenTypes.mDEC; + } + + private static boolean isUsedInTopLevelFlowOnly(PsiElement element) { + GrVariable var = null; + if (element instanceof GrVariable) { + var = (GrVariable)element; + } + else if (element instanceof GrReferenceExpression) { + final PsiElement resolved = ((GrReferenceExpression)element).resolve(); + if (resolved instanceof GrVariable) var = (GrVariable)resolved; + } + + if (var != null) { + final GroovyPsiElement scope = ControlFlowUtils.findControlFlowOwner(var); + if (scope == null) { + PsiFile file = var.getContainingFile(); + LOG.error(file == null ? "no file??? var of type" + var.getClass().getCanonicalName() : DebugUtil.psiToString(file, true, false)); + } + + return ReferencesSearch.search(var, new LocalSearchScope(scope)).forEach(new Processor() { + public boolean process(PsiReference ref) { + return ControlFlowUtils.findControlFlowOwner(ref.getElement()) == scope; + } + }); + } + + return true; + } + + + private static boolean isLocalAssignment(PsiElement element) { + if (element instanceof GrVariable) { + return isLocalVariable((GrVariable)element, false); + } + else if (element instanceof GrReferenceExpression) { + final PsiElement resolved = ((GrReferenceExpression)element).resolve(); + return resolved instanceof GrVariable && isLocalVariable((GrVariable)resolved, true); + } + + return false; + } + + private static boolean isLocalVariable(GrVariable var, boolean parametersAllowed) { + return !(var instanceof GrField || var instanceof GrParameter && !parametersAllowed); + } + + public boolean isEnabledByDefault() { + return true; + } +} diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/unusedDef/UnusedDefInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/unusedDef/UnusedDefInspection.java index 4bb6ad43dfae..4a49c578fe68 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/unusedDef/UnusedDefInspection.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/unusedDef/UnusedDefInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -15,49 +15,38 @@ */ package org.jetbrains.plugins.groovy.codeInspection.unusedDef; +import com.intellij.codeInspection.LocalQuickFix; +import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.codeInspection.ProblemHighlightType; -import com.intellij.codeInspection.ProblemsHolder; -import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.application.AccessToken; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; import com.intellij.psi.PsiReference; -import com.intellij.psi.impl.DebugUtil; -import com.intellij.psi.search.LocalSearchScope; import com.intellij.psi.search.searches.ReferencesSearch; -import com.intellij.psi.tree.IElementType; import com.intellij.util.Processor; -import gnu.trove.TIntHashSet; -import gnu.trove.TIntObjectHashMap; -import gnu.trove.TIntProcedure; -import gnu.trove.TObjectProcedure; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.plugins.groovy.codeInspection.BaseInspection; +import org.jetbrains.plugins.groovy.codeInspection.BaseInspectionVisitor; import org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle; -import org.jetbrains.plugins.groovy.codeInspection.GroovyLocalInspectionBase; -import org.jetbrains.plugins.groovy.codeInspection.utils.ControlFlowUtils; -import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; -import org.jetbrains.plugins.groovy.lang.psi.GrControlFlowOwner; -import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement; import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField; import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrAssignmentExpression; +import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrUnaryExpression; import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter; -import org.jetbrains.plugins.groovy.lang.psi.controlFlow.Instruction; -import org.jetbrains.plugins.groovy.lang.psi.controlFlow.ReadWriteVariableInstruction; -import org.jetbrains.plugins.groovy.lang.psi.dataFlow.DFAEngine; -import org.jetbrains.plugins.groovy.lang.psi.dataFlow.reachingDefs.ReachingDefinitionsDfaInstance; -import org.jetbrains.plugins.groovy.lang.psi.dataFlow.reachingDefs.ReachingDefinitionsSemilattice; +import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod; +import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil; +import org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringUtil; -import java.util.List; +import java.util.Collection; /** - & @author ven + * @author Max Medvedev */ -public class UnusedDefInspection extends GroovyLocalInspectionBase { - private static final Logger LOG = Logger.getInstance("#org.jetbrains.plugins.groovy.codeInspection.unusedDef.UnusedDefInspection"); +public class UnusedDefInspection extends BaseInspection { @Nls @NotNull @@ -68,144 +57,116 @@ public class UnusedDefInspection extends GroovyLocalInspectionBase { @Nls @NotNull public String getDisplayName() { - return GroovyInspectionBundle.message("unused.assignment"); + return GroovyInspectionBundle.message("unused.symbol"); } @NonNls @NotNull public String getShortName() { - return "GroovyUnusedAssignment"; + return "GroovyUnusedSymbol"; } + @Override + protected BaseInspectionVisitor buildVisitor() { + return new BaseInspectionVisitor() { + @Override + public void visitVariable(GrVariable variable) { + super.visitVariable(variable); + if (variable instanceof GrParameter) { + PsiElement scope = ((GrParameter)variable).getDeclarationScope(); + if (scope instanceof GrMethod) { + if (((GrMethod)scope).getBlock() == null) return; - protected void check(final GrControlFlowOwner owner, final ProblemsHolder problemsHolder) { - final Instruction[] flow = owner.getControlFlow(); - final ReachingDefinitionsDfaInstance dfaInstance = new ReachingDefinitionsDfaInstance(flow); - final ReachingDefinitionsSemilattice lattice = new ReachingDefinitionsSemilattice(); - final DFAEngine> engine = new DFAEngine>(flow, dfaInstance, lattice); - final List> dfaResult = engine.performDFAWithTimeout(); - if (dfaResult == null) { - return; - } + if (((GrMethod)scope).getHierarchicalMethodSignature().getSuperSignatures().size() > 0) { + return; + } + } + } - final TIntHashSet unusedDefs = new TIntHashSet(); - for (Instruction instruction : flow) { - if (instruction instanceof ReadWriteVariableInstruction && ((ReadWriteVariableInstruction) instruction).isWrite()) { - unusedDefs.add(instruction.num()); + if (!(variable instanceof GrField)) { + checkVar(variable); + } } - } - for (int i = 0; i < dfaResult.size(); i++) { - final Instruction instruction = flow[i]; - if (instruction instanceof ReadWriteVariableInstruction) { - final ReadWriteVariableInstruction varInst = (ReadWriteVariableInstruction) instruction; - if (!varInst.isWrite()) { - final String varName = varInst.getVariableName(); - TIntObjectHashMap e = dfaResult.get(i); - e.forEachValue(new TObjectProcedure() { - public boolean execute(TIntHashSet reaching) { - reaching.forEach(new TIntProcedure() { - public boolean execute(int defNum) { - final String defName = ((ReadWriteVariableInstruction) flow[defNum]).getVariableName(); - if (varName.equals(defName)) { - unusedDefs.remove(defNum); - } - return true; - } - }); - return true; + private void checkVar(GrVariable var) { + AccessToken lock = ApplicationManager.getApplication().acquireReadActionLock(); + try { + boolean isNotAccessedForRead = ReferencesSearch.search(var).forEach(new Processor() { + @Override + public boolean process(PsiReference reference) { + PsiElement element = reference.getElement(); + return !(element instanceof GrExpression && PsiUtil.isAccessedForReading((GrExpression)element)); } }); + if (isNotAccessedForRead) { + registerError(var.getNameIdentifierGroovy(), GroovyInspectionBundle.message("unused.symbol"), + getFixes(var), + ProblemHighlightType.LIKE_UNUSED_SYMBOL); + } + } + finally { + lock.finish(); } } - } - - unusedDefs.forEach(new TIntProcedure() { - public boolean execute(int num) { - final ReadWriteVariableInstruction instruction = (ReadWriteVariableInstruction)flow[num]; - final PsiElement element = instruction.getElement(); - if (element == null) return true; - if (isLocalAssignment(element) && isUsedInTopLevelFlowOnly(element) && !isIncOrDec(element)) { - PsiElement toHighlight = getHighlightElement(element); - problemsHolder.registerProblem(toHighlight, GroovyInspectionBundle.message("unused.assignment.tooltip"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL); - } - return true; - } - }); + }; } - private static PsiElement getHighlightElement(PsiElement element) { - PsiElement toHighlight = null; - if (element instanceof GrReferenceExpression) { - PsiElement parent = element.getParent(); - if (parent instanceof GrAssignmentExpression) { - toHighlight = ((GrAssignmentExpression)parent).getLValue(); - } - if (parent instanceof GrUnaryExpression && ((GrUnaryExpression)parent).isPostfix()) { - toHighlight = parent; - } + private static LocalQuickFix[] getFixes(GrVariable var) { + if (GroovyRefactoringUtil.isLocalVariable(var)) { + return new LocalQuickFix[]{new RemoveVarFix(var.getName())}; } - else if (element instanceof GrVariable) { - toHighlight = ((GrVariable)element).getNameIdentifierGroovy(); - } - if (toHighlight == null) toHighlight = element; - return toHighlight; - } - - private static boolean isIncOrDec(PsiElement element) { - PsiElement parent = element.getParent(); - if (!(parent instanceof GrUnaryExpression)) return false; - - IElementType type = ((GrUnaryExpression)parent).getOperationTokenType(); - return type == GroovyTokenTypes.mINC || type == GroovyTokenTypes.mDEC; - } - - private static boolean isUsedInTopLevelFlowOnly(PsiElement element) { - GrVariable var = null; - if (element instanceof GrVariable) { - var = (GrVariable)element; - } - else if (element instanceof GrReferenceExpression) { - final PsiElement resolved = ((GrReferenceExpression)element).resolve(); - if (resolved instanceof GrVariable) var = (GrVariable)resolved; - } - - if (var != null) { - final GroovyPsiElement scope = ControlFlowUtils.findControlFlowOwner(var); - if (scope == null) { - PsiFile file = var.getContainingFile(); - LOG.error(file == null ? "no file??? var of type" + var.getClass().getCanonicalName() : DebugUtil.psiToString(file, true, false)); - } - - return ReferencesSearch.search(var, new LocalSearchScope(scope)).forEach(new Processor() { - public boolean process(PsiReference ref) { - return ControlFlowUtils.findControlFlowOwner(ref.getElement()) == scope; - } - }); - } - - return true; - } - - - private static boolean isLocalAssignment(PsiElement element) { - if (element instanceof GrVariable) { - return isLocalVariable((GrVariable)element, false); - } - else if (element instanceof GrReferenceExpression) { - final PsiElement resolved = ((GrReferenceExpression)element).resolve(); - return resolved instanceof GrVariable && isLocalVariable((GrVariable)resolved, true); - } - - return false; - } - - private static boolean isLocalVariable(GrVariable var, boolean parametersAllowed) { - return !(var instanceof GrField || var instanceof GrParameter && !parametersAllowed); + return LocalQuickFix.EMPTY_ARRAY; } public boolean isEnabledByDefault() { return true; } + + private static class RemoveVarFix implements LocalQuickFix { + private String myName; + + public RemoveVarFix(String name) { + myName = name; + } + + @NotNull + @Override + public String getName() { + return GroovyInspectionBundle.message("remove.variable", myName); + } + + @NotNull + @Override + public String getFamilyName() { + return GroovyInspectionBundle.message("remove.unused.variable"); + } + + @Override + public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { + PsiElement element = descriptor.getPsiElement(); + PsiElement parent = element.getParent(); + if (parent instanceof GrVariable) { + Collection all = ReferencesSearch.search(parent).findAll(); + + for (PsiReference reference : all) { + PsiElement e = reference.getElement(); + if (e instanceof GrReferenceExpression) { + PsiElement p = e.getParent(); + if (p instanceof GrAssignmentExpression) { + if (PsiUtil.isExpressionUsed(p)) { + ((GrAssignmentExpression)p).replaceWithExpression(((GrAssignmentExpression)p).getRValue(), true); + } + else { + p.delete(); + } + } + } + else { + e.delete(); + } + } + parent.delete(); + } + } + } } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy index 2f13efb141e7..2c4d05a1c101 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy @@ -33,6 +33,8 @@ import com.intellij.debugger.ui.DebuggerPanelsManager import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor import com.intellij.debugger.ui.tree.render.DescriptorLabelListener import com.intellij.execution.executors.DefaultDebugExecutor +import com.intellij.execution.process.OSProcessHandler +import com.intellij.execution.process.OSProcessManager import com.intellij.execution.process.ProcessAdapter import com.intellij.execution.runners.ProgramRunner import com.intellij.openapi.Disposable @@ -47,8 +49,6 @@ import com.intellij.testFramework.builders.JavaModuleFixtureBuilder import com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl import com.intellij.util.SystemProperties import com.intellij.util.concurrency.Semaphore -import com.intellij.execution.process.OSProcessManager -import com.intellij.execution.process.OSProcessHandler /** * @author peter @@ -115,7 +115,8 @@ class GroovyDebuggerTest extends GroovyCompilerTestCase { } public void testVariableInScript() { - myFixture.addFileToProject("Foo.groovy", """def a = 2 + myFixture.addFileToProject("Foo.groovy", """\ +def a = 2 a"""); addBreakpoint 'Foo.groovy', 1 runDebugger 'Foo', { @@ -241,6 +242,7 @@ new Runnable() { } } + private def addBreakpoint(String fileName, int line) { VirtualFile file = null edt { @@ -291,7 +293,7 @@ new Runnable() { semaphore.up() } }) - def finished = semaphore.waitFor(20000) + def finished = semaphore.waitFor(200000) assert finished : 'Too long debugger action' return result } @@ -309,7 +311,7 @@ new Runnable() { item.setContext(ctx) item.updateRepresentation(ctx, { semaphore.up() } as DescriptorLabelListener) } - assert semaphore.waitFor(10000): "too long evaluation: $item.label $item.evaluateException" + assert semaphore.waitFor(200000): "too long evaluation: $item.label $item.evaluateException" String result = managed { DebuggerUtils.getValueAsString(ctx, item.value) } assert result == expected diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.groovy index 575ad2e4d3c1..cbe941166c3c 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.groovy @@ -43,7 +43,7 @@ import org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyOverlyLongMetho import org.jetbrains.plugins.groovy.codeInspection.unassignedVariable.UnassignedVariableAccessInspection import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUnresolvedAccessInspection import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUntypedAccessInspection -import org.jetbrains.plugins.groovy.codeInspection.unusedDef.UnusedDefInspection +import org.jetbrains.plugins.groovy.codeInspection.unusedDef.UnusedAssignmentInspection import org.jetbrains.plugins.groovy.util.TestUtils import org.jetbrains.plugins.groovy.codeInspection.bugs.* import org.jetbrains.plugins.groovy.codeInspection.confusing.* @@ -186,10 +186,10 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase { public void testUnassigned3() throws Exception { doTest(new UnassignedVariableAccessInspection()); } public void testUnassignedTryFinally() throws Exception { doTest(new UnassignedVariableAccessInspection()); } - public void testUnusedVariable() throws Exception { doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()); } - public void testDefinitionUsedInClosure() throws Exception { doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()); } - public void testDefinitionUsedInClosure2() throws Exception { doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()); } - public void testDefinitionUsedInSwitchCase() throws Exception { doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()); } + public void testUnusedVariable() throws Exception { doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } + public void testDefinitionUsedInClosure() throws Exception { doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } + public void testDefinitionUsedInClosure2() throws Exception { doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } + public void testDefinitionUsedInSwitchCase() throws Exception { doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } public void testDuplicateInnerClass() throws Throwable{doTest();} public void testThisInStaticContext() throws Throwable {doTest();} @@ -246,8 +246,8 @@ class A { public void testByteArrayArgument() throws Exception {doTest(new GroovyAssignabilityCheckInspection());} public void testForLoopWithNestedEndlessLoop() throws Exception {doTest(new UnassignedVariableAccessInspection());} - public void testPrefixIncrementCfa() throws Exception {doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection());} - public void testIfIncrementElseReturn() throws Exception {doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()); } + public void testPrefixIncrementCfa() throws Exception {doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection());} + public void testIfIncrementElseReturn() throws Exception {doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } public void testArrayLikeAccess() throws Exception {doTest();} @@ -313,7 +313,7 @@ class A { public void testBuiltInTypeInstantiation() {doTest();} - public void testSwitchControlFlow() {doTest(new UnusedDefInspection(), new GroovyResultOfAssignmentUsedInspection(), new GrUnusedIncDecInspection());} + public void testSwitchControlFlow() {doTest(new UnusedAssignmentInspection(), new GroovyResultOfAssignmentUsedInspection(), new GrUnusedIncDecInspection());} public void testRawTypeInAssignment() {doTest(new GroovyAssignabilityCheckInspection());} @@ -323,7 +323,7 @@ class A { IdeaTestUtil.assertTiming("", 10000, 1, new Runnable() { @Override public void run() { - doTest(new GroovyAssignabilityCheckInspection(), new UnusedDefInspection(), new GrUnusedIncDecInspection()); + doTest(new GroovyAssignabilityCheckInspection(), new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } }); } @@ -395,7 +395,7 @@ class A { doTest(new GroovyUnresolvedAccessInspection(), new GroovyUntypedAccessInspection()); } - public void testUsageInInjection() { doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()); } + public void testUsageInInjection() { doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } public void testDuplicatedNamedArgs() {doTest();} @@ -417,19 +417,19 @@ class A { } public void testUnusedDefsForArgs() { - doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()); + doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } public void testUsedDefBeforeTry1() { - doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()); + doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } public void testUsedDefBeforeTry2() { - doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()); + doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()); } public void testUnusedInc() { - doTest(new UnusedDefInspection(), new GrUnusedIncDecInspection()) + doTest(new UnusedAssignmentInspection(), new GrUnusedIncDecInspection()) } public void testStringAssignableToChar() {