tolerate non local inspection tools returned from InspectionToolPRovider when configu...
[idea/community.git] / platform / testFramework / src / com / intellij / testFramework / fixtures / impl / CodeInsightTestFixtureImpl.java
index 12a52ff7399c9fd98bebe1705c6ee05bb0e67262..8326f588c41d4ff4576df9c94a09ea015d7122f6 100644 (file)
@@ -254,11 +254,14 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
     for (InspectionToolProvider provider: providers) {
       for (Class clazz: provider.getInspectionClasses()) {
         try {
-          LocalInspectionTool inspection = (LocalInspectionTool)clazz.getConstructor().newInstance();
-          tools.add(inspection);
+          Object o = clazz.getConstructor().newInstance();
+          if (o instanceof LocalInspectionTool) {
+            LocalInspectionTool inspection = (LocalInspectionTool)o;
+            tools.add(inspection);
+          }
         }
         catch (Exception e) {
-          throw new RuntimeException("Cannot instantiate " + clazz);
+          throw new RuntimeException("Cannot instantiate " + clazz, e);
         }
       }
     }