SameParameterValueInspection: local inspection shouldn't inspect non-source content
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Tue, 11 Oct 2016 13:52:35 +0000 (16:52 +0300)
committerDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Tue, 11 Oct 2016 13:53:12 +0000 (16:53 +0300)
java/java-analysis-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspectionBase.java

index 7a0ade4c627a6f10e3994b4fd1d1fc1c651cb76b..27065f26d5fd9e2c2c1637c6b6b02d7c71831516 100644 (file)
@@ -22,6 +22,8 @@ import com.intellij.codeInspection.*;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase;
 import com.intellij.codeInspection.reference.*;
 import com.intellij.openapi.progress.EmptyProgressIndicator;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
 import com.intellij.psi.*;
 import com.intellij.util.ObjectUtils;
@@ -179,6 +181,8 @@ public class SameParameterValueInspectionBase extends GlobalJavaBatchInspectionT
           if (method.isConstructor()) return;
           PsiParameter[] parameters = method.getParameterList().getParameters();
           if (parameters.length == 0) return;
+          final VirtualFile file = method.getContainingFile().getVirtualFile();
+          if (!ProjectRootManager.getInstance(holder.getProject()).getFileIndex().isInSourceContent(file)) return;
 
           if (myDeadCodeTool.isEntryPoint(method)) return;
           if (!method.getHierarchicalMethodSignature().getSuperSignatures().isEmpty()) return;