InvalidFacet (@NotNull Module module, @NotNull FacetState state, @Nullable Facet<?> underlyingFacet, @NotNull @NlsContexts.DialogMessage String errorMessage, boolean unknownType, boolean reportError) { Project project = module.getProject(); final InvalidFacetType type = InvalidFacetType.getInstance(); final InvalidFacetConfiguration configuration = new InvalidFacetConfiguration(state, errorMessage); final InvalidFacet facet = createFacet(module, type, StringUtil.notNullize(state.getName()), configuration, underlyingFacet); if (reportError) { InvalidFacetManager invalidFacetManager = InvalidFacetManager.getInstance(project); if (!invalidFacetManager.isIgnored(facet)) { FacetLoadingErrorDescription description = new FacetLoadingErrorDescription(facet); ProjectLoadingErrorsNotifier.getInstance(project).registerError(description); if (unknownType) { UnknownFeaturesCollector.getInstance(project) .registerUnknownFeature(new UnknownFeature(description.getErrorType().getFeatureType(), ProjectBundle.message("plugins.advertiser.feature.facet"), state.getFacetType())); } } } return facet; }