Revert "[platform] Make HighlightInfo#toolId final"

This reverts commit da96aeda8dd7835e85005f423aac25ad22581e69.

(cherry picked from commit 4c0ed0b16c6f10cdac2d92f6d5a89d2583b65bbe)

IJ-CR-127534

GitOrigin-RevId: 2b8625c395186f57908237329e5d38563295751e
This commit is contained in:
Mikhail Shagvaliev
2024-02-29 15:14:05 +01:00
committed by intellij-monorepo-bot
parent fc1b5ba67d
commit be1663de9d
4 changed files with 5 additions and 13 deletions

View File

@@ -88,9 +88,9 @@ final class DefaultHighlightVisitor implements HighlightVisitor, DumbAware {
for (ErrorQuickFixProvider provider : providers) {
provider.registerErrorQuickFix(element, builder);
}
builder.toolId(DefaultHighlightVisitor.class);
HighlightInfo info = builder.create();
if (info != null) {
info.toolId = DefaultHighlightVisitor.class;
for (ErrorQuickFixProvider provider : providers) {
provider.registerErrorQuickFix(element, info);
}

View File

@@ -134,7 +134,7 @@ public class HighlightInfo implements Segment {
private final @NotNull HighlightSeverity severity;
private final GutterMark gutterIconRenderer;
private final ProblemGroup myProblemGroup;
final Object toolId; // inspection.getShortName() in case when the inspection generated this info
volatile Object toolId; // inspection.getShortName() in case when the inspection generated this info
private int group;
/**
* Quick fix text range: the range within which the Alt-Enter should open the quick fix popup.
@@ -539,8 +539,6 @@ public class HighlightInfo implements Segment {
@NotNull Builder inspectionToolId(@NotNull String inspectionTool);
@NotNull Builder toolId(@Nullable Object toolId);
// only one allowed
@NotNull Builder description(@DetailedDescription @NotNull String description);

View File

@@ -83,13 +83,6 @@ final class HighlightInfoB implements HighlightInfo.Builder {
return this;
}
@Override
public @NotNull HighlightInfo.Builder toolId(@Nullable Object toolId) {
assertNotCreated();
this.toolId = toolId;
return this;
}
@Override
public @NotNull HighlightInfo.Builder description(@NotNull String description) {
assertNotCreated();

View File

@@ -300,11 +300,12 @@ public final class LocalInspectionsPass extends ProgressableTextEditorHighlighti
PluginException.logPluginError(LOG, errorMessage, null, toolWrapper.getTool().getClass());
}
boolean isInInjected = myInspectInjectedPsi && file.getViewProvider() instanceof InjectedFileViewProvider;
HighlightInfo info = builder.toolId(toolWrapper.getShortName()).create();
HighlightInfo info = builder.create();
if (info == null || !UpdateHighlightersUtil.HighlightInfoPostFilters.accept(myProject, info)) {
return;
}
info.toolId = toolWrapper.getShortName();
if (isInInjected) {
Document documentRange = documentManager.getDocument(file);
if (documentRange != null) {
@@ -351,9 +352,9 @@ public final class LocalInspectionsPass extends ProgressableTextEditorHighlighti
}
if (start != end || info.startOffset == info.endOffset) {
registerQuickFixes(builder, fixes, shortName);
builder.toolId(info.toolId);
HighlightInfo patched = builder.createUnconditionally();
patched.markFromInjection();
patched.toolId = info.toolId;
outInfos.accept(patched);
}
}