/*
 * User: anna
 * Date: 19-Feb-2010
 */
package com.intellij.coverage.listeners;

import com.intellij.util.ArrayUtil;

public abstract class CoverageListener {
  private static final Class[] EMPTY_CLASS_ARRAY = ArrayUtil.EMPTY_CLASS_ARRAY;
  private Object myProjectData;

  protected static String sanitize(String className, String methodName) {
    final StringBuilder result = new StringBuilder();
    final String fileName = className + "." + methodName;
    for (int i = 0; i < fileName.length(); i++) {
      final char ch = fileName.charAt(i);

      if (ch > 0 && ch < 255) {
        if (Character.isLetterOrDigit(ch)) {
          result.append(ch);
        }
        else {
          result.append("_");
        }
      }

    }

    return result.toString();
  }

  protected Object getData() {
    try {

     return Class.forName("com.intellij.rt.coverage.data.ProjectData").getMethod("getProjectData", EMPTY_CLASS_ARRAY).invoke(null);

    }
    catch (Exception e) {
      return null; //should not happen
    }
  }
}

@@ -81,45 +81,8 @@
 s;%0A%0A
-import com.intellij.util.ArrayUtil;%0A%0A
 publ
@@ -173,35 +173,20 @@
 Y = 
-ArrayUtil.EMPTY_CLASS_ARRAY
+new Class%5B0%5D
 ;%0A  

revert cleanup (IDEA-65853)