tolerate non local inspection tools returned from InspectionToolPRovider when configu...
authorMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Thu, 11 Mar 2010 12:44:41 +0000 (15:44 +0300)
committerMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Thu, 11 Mar 2010 12:44:41 +0000 (15:44 +0300)
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 {
     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) {
         }
         catch (Exception e) {
-          throw new RuntimeException("Cannot instantiate " + clazz);
+          throw new RuntimeException("Cannot instantiate " + clazz, e);
         }
       }
     }
         }
       }
     }