Java: Moved text message to the resource bundle in the inspection "Non-accessible...
authorPavel Dolgov <pavel.dolgov@jetbrains.com>
Fri, 11 Nov 2016 15:48:10 +0000 (18:48 +0300)
committerPavel Dolgov <pavel.dolgov@jetbrains.com>
Fri, 11 Nov 2016 15:48:45 +0000 (18:48 +0300)
java/java-analysis-impl/src/com/intellij/codeInspection/java19modules/Java9NonAccessibleTypeExposedInspection.java
platform/platform-resources-en/src/messages/InspectionsBundle.properties

index 773d54d39a2d90e62214f972396f3c5821b23417..b46e4b46d0b8f058028f1cf460728aabb688aa6a 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.codeInspection.java19modules;
 
 import com.intellij.codeInsight.daemon.impl.analysis.JavaModuleGraphUtil;
 import com.intellij.codeInspection.BaseJavaLocalInspectionTool;
+import com.intellij.codeInspection.InspectionsBundle;
 import com.intellij.codeInspection.ProblemsHolder;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.roots.ModuleFileIndex;
@@ -66,7 +67,6 @@ public class Java9NonAccessibleTypeExposedInspection extends BaseJavaLocalInspec
   }
 
   private static class NonAccessibleTypeExposedVisitor extends JavaElementVisitor {
-    public static final String CLASS_IS_NOT_EXPORTED = "The class is not exported from the module";
     private final ProblemsHolder myHolder;
     private final ModuleFileIndex myModuleFileIndex;
     private final Set<String> myExportedPackageNames;
@@ -118,12 +118,12 @@ public class Java9NonAccessibleTypeExposedInspection extends BaseJavaLocalInspec
           if (isInModuleSource(annotationClass) && !isModulePublicApi(annotationClass)) {
             PsiAnnotationOwner owner = annotation.getOwner();
             if (isModulePublicApi(owner)) {
-              myHolder.registerProblem(referenceElement, CLASS_IS_NOT_EXPORTED);
+              registerProblem(referenceElement);
             }
             if (owner instanceof PsiParameter) {
               PsiElement parent = ((PsiParameter)owner).getParent();
               if (parent instanceof PsiMember && isModulePublicApi((PsiMember)parent)) {
-                myHolder.registerProblem(referenceElement, CLASS_IS_NOT_EXPORTED);
+                registerProblem(referenceElement);
               }
             }
           }
@@ -161,7 +161,7 @@ public class Java9NonAccessibleTypeExposedInspection extends BaseJavaLocalInspec
 
     private void checkType(@Nullable PsiClass psiClass, @NotNull PsiElement typeElement) {
       if (psiClass != null && !(psiClass instanceof PsiTypeParameter) && isInModuleSource(psiClass) && !isModulePublicApi(psiClass)) {
-        myHolder.registerProblem(typeElement, CLASS_IS_NOT_EXPORTED);
+        registerProblem(typeElement);
       }
     }
 
@@ -250,5 +250,9 @@ public class Java9NonAccessibleTypeExposedInspection extends BaseJavaLocalInspec
       }
       return false;
     }
+
+    private void registerProblem(PsiElement element) {
+      myHolder.registerProblem(element, InspectionsBundle.message("inspection.non.accessible.type.exposed.name"));
+    }
   }
 }
index 3621d0745433c70600635683edc85c5425892b4b..b6a59deb04490a53fcb08fb24e6483ca579a808b 100644 (file)
@@ -466,6 +466,8 @@ inspection.compiler.javac.quirks.anno.array.comma.fix=Remove trailing comma
 inspection.compiler.javac.quirks.qualifier.type.args.problem=Generics in qualifier reference may cause compilation error in some Javac versions (e.g. JDK 5 and JDK 6).
 inspection.compiler.javac.quirks.qualifier.type.args.fix=Remove generic parameter
 
+inspection.non.accessible.type.exposed.name=The class is not exported from the module
+
 inspection.root.node.title=Inspections
 
 # inspection tools list actions: