[groovy] highlight unnecessary 'def' as unused (IDEA-141044)
authorDaniil Ovchinnikov <daniil.ovchinnikov@jetbrains.com>
Wed, 10 Aug 2016 12:57:15 +0000 (15:57 +0300)
committerDaniil Ovchinnikov <daniil.ovchinnikov@jetbrains.com>
Wed, 10 Aug 2016 12:57:15 +0000 (15:57 +0300)
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/style/GrUnnecessaryDefModifierInspection.java
plugins/groovy/src/META-INF/plugin.xml
plugins/groovy/test/org/jetbrains/plugins/groovy/codeInspection/style/GrUnnecessaryDefModifierInspectionTest.groovy

index 1f2b9b889bf36f05a5d48de6fe80c329e1f27015..d05cbe5a478e720e2cafcef4bd9ec600cbc13d18 100644 (file)
@@ -52,7 +52,7 @@ public class GrUnnecessaryDefModifierInspection extends GroovySuppressableInspec
         if (parent instanceof GrMethod && ((GrMethod)parent).getReturnTypeElementGroovy() != null ||
             parent instanceof GrVariable && ((GrVariable)parent).getTypeElementGroovy() != null ||
             parent instanceof GrVariableDeclaration && ((GrVariableDeclaration)parent).getTypeElementGroovy() != null) {
-          holder.registerProblem(modifier, "'def' is not necessary", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, FIX);
+          holder.registerProblem(modifier, "'def' is not necessary", ProblemHighlightType.LIKE_UNUSED_SYMBOL, FIX);
         }
       }
     });
index c68272bca24fef5bc822516b1bbb6a9dfa4c68f3..0469920a727a973af5961f35c8b8d8990738e4d9 100644 (file)
                      groupName="Style" enabledByDefault="false" level="WARNING"
                      implementationClass="org.jetbrains.plugins.groovy.codeInspection.style.JavaStylePropertiesInvocationInspection"/>
     <localInspection language="Groovy" groupPath="Groovy" groupName="Style"
-                     displayName="Unnecessary 'def'" enabledByDefault="true" level="WEAK WARNING"
+                     displayName="Unnecessary 'def'" enabledByDefault="true"
                      implementationClass="org.jetbrains.plugins.groovy.codeInspection.style.GrUnnecessaryDefModifierInspection"/>
     <localInspection language="Groovy" groupPath="Groovy" shortName="ChangeToOperator"
                      displayName="Change to operator"
index d779174890a6b61633831c19f412dc7d414ba982..7376bc73c347f24eebc74b43b6136c335ba2813f 100644 (file)
@@ -29,9 +29,9 @@ public class GrUnnecessaryDefModifierInspectionTest extends LightGroovyTestCase
     fixture.with {
       enableInspections GrUnnecessaryDefModifierInspection
       configureByText '_.groovy', '''\
-def foo(<weak_warning descr="'def' is not necessary">def</weak_warning> Object a) {}
-<weak_warning descr="'def' is not necessary">d<caret>ef</weak_warning> boolean baz(def a) {}
-<weak_warning descr="'def' is not necessary">def</weak_warning> Object bar
+def foo(<warning descr="'def' is not necessary">def</warning> Object a) {}
+<warning descr="'def' is not necessary">d<caret>ef</warning> boolean baz(def a) {}
+<warning descr="'def' is not necessary">def</warning> Object bar
 def baf
 def (int a, b) = [1, 2]
 '''