private static @NotNull FeatureUsagesCollector createCounterCollector(
    @NotNull CounterUsageCollectorEP ep,
    @NotNull PluginDescriptor pluginDescriptor
  ) {
    Class<Object> aClass;
    try {
      aClass = ApplicationManager.getApplication().loadClass(ep.implementationClass, pluginDescriptor);
    }
    catch (ClassNotFoundException e) {
      throw new PluginException(e, pluginDescriptor.getPluginId());
    }

    Field instanceField;
    try {
      instanceField = aClass.getDeclaredField("INSTANCE");
    }
    catch (NoSuchFieldException e) {
      return ApplicationManager.getApplication().instantiateClass(ep.implementationClass, pluginDescriptor);
    }

    instanceField.setAccessible(true);
    try {
      return (FeatureUsagesCollector)instanceField.get(null);
    }
    catch (IllegalAccessException e) {
      throw new PluginException(e, pluginDescriptor.getPluginId());
    }
  }
private static @NotNull FeatureUsagesCollector createCounterCollector(
    @NotNull CounterUsageCollectorEP ep,
    @NotNull PluginDescriptor pluginDescriptor
  )