PluginException (@NotNull String errorMessage, @Nullable Throwable cause, @NotNull Class<?> pluginClass) { ClassLoader classLoader = pluginClass.getClassLoader(); PluginId pluginId; if (classLoader instanceof PluginAwareClassLoader) { pluginId = ((PluginAwareClassLoader)classLoader).getPluginId(); } else { pluginId = PluginManager.getPluginByClassNameAsNoAccessToClass(pluginClass.getName()); } return new PluginException(errorMessage, cause, pluginId); }