Revert "[json] IJPL-157032 Prefer storing resolved tree nodes in a set to avoid processing the effective same branches multiple times"

This reverts commit 14f06c419ff394383dd974da36c34da91b8c488a.

The change in the MatchResult cannot be used so far because ancient allOf/anyOf resolve relies on having several equal-by-pointer json schema objects in a collection.

GitOrigin-RevId: 48bda04351f25fd783d1e051bf61115876e0739e
This commit is contained in:
Nikita Katkov
2024-06-21 10:31:00 +02:00
committed by intellij-monorepo-bot
parent f587af6ada
commit 30eb459a35

View File

@@ -2,7 +2,6 @@
package com.jetbrains.jsonSchema.impl;
import com.intellij.util.Processor;
import com.intellij.util.SmartList;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.jetbrains.annotations.NotNull;
@@ -13,13 +12,13 @@ public final class MatchResult {
public final List<JsonSchemaObject> mySchemas;
public final List<Collection<? extends JsonSchemaObject>> myExcludingSchemas;
private MatchResult(final @NotNull Collection<JsonSchemaObject> schemas, final @NotNull List<Collection<? extends JsonSchemaObject>> excludingSchemas) {
mySchemas = Collections.unmodifiableList(new SmartList<>(schemas));
private MatchResult(final @NotNull List<JsonSchemaObject> schemas, final @NotNull List<Collection<? extends JsonSchemaObject>> excludingSchemas) {
mySchemas = Collections.unmodifiableList(schemas);
myExcludingSchemas = Collections.unmodifiableList(excludingSchemas);
}
public static MatchResult create(@NotNull JsonSchemaTreeNode root) {
Collection<JsonSchemaObject> schemas = new LinkedHashSet<>();
List<JsonSchemaObject> schemas = new ArrayList<>();
Int2ObjectMap<List<JsonSchemaObject>> oneOfGroups = new Int2ObjectOpenHashMap<>();
iterateTree(root, node -> {
if (node.isAny()) return true;