diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/testOnly/TestOnlyInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/testOnly/TestOnlyInspection.java index c7862042e061..9b6c54797b6e 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/testOnly/TestOnlyInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/testOnly/TestOnlyInspection.java @@ -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. @@ -171,7 +171,8 @@ public class TestOnlyInspection extends BaseJavaBatchLocalInspectionTool { private static void reportProblem(PsiElement e, PsiMember target, ProblemsHolder h) { String message = InspectionsBundle.message(target instanceof PsiClass ? "inspection.test.only.problems.test.only.class.reference" - : "inspection.test.only.problems.test.only.method.call"); + : target instanceof PsiField ? "inspection.test.only.problems.test.only.field.reference" + : "inspection.test.only.problems.test.only.method.call"); h.registerProblem(e, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } } diff --git a/java/java-tests/testData/inspection/testOnly/class/expected.xml b/java/java-tests/testData/inspection/testOnly/class/expected.xml index e1b4b8056d4c..c9aadb095e3a 100644 --- a/java/java-tests/testData/inspection/testOnly/class/expected.xml +++ b/java/java-tests/testData/inspection/testOnly/class/expected.xml @@ -16,7 +16,7 @@ B.java 11 <default> - Test-only method is called in production code + Test-only field is referenced in production code @@ -55,19 +55,19 @@ B.java 18 <default> - Test-only method is called in production code + Test-only field is referenced in production code B.java 19 <default> - Test-only method is called in production code + Test-only field is referenced in production code B.java 20 <default> - Test-only method is called in production code + Test-only field is referenced in production code diff --git a/java/java-tests/testData/inspection/testOnly/insideField/expected.xml b/java/java-tests/testData/inspection/testOnly/insideField/expected.xml index bf29b442fde9..2e24645d1723 100644 --- a/java/java-tests/testData/inspection/testOnly/insideField/expected.xml +++ b/java/java-tests/testData/inspection/testOnly/insideField/expected.xml @@ -6,7 +6,7 @@ testInsideField <default> - Test-only method is called in production code + Test-only field is referenced in production code diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties index 1c43cfe52b88..0b9e98ef4fe7 100644 --- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties +++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties @@ -163,6 +163,7 @@ inspection.nullable.problems.NotNull.parameter.receives.null.literal=Parameter a inspection.test.only.problems.display.name=Test-only class or method call in production code inspection.test.only.problems.test.only.method.call=Test-only method is called in production code inspection.test.only.problems.test.only.class.reference=Test-only class is referenced in production code +inspection.test.only.problems.test.only.field.reference=Test-only field is referenced in production code inspection.visibility.display.name=Declaration access can be weaker inspection.visibility.option=Suggest package-private visibility level for class members