Skip to content

Commit f1c9376

Browse files
Equinox-angelozerr
authored andcommitted
Use nested maps instead of guava table
1 parent d1e719c commit f1c9376

File tree

1 file changed

+8
-6
lines changed
  • org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/xsd/contentmodel

1 file changed

+8
-6
lines changed

org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/xsd/contentmodel/CMXSDDocument.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import java.util.logging.Level;
2323
import java.util.logging.Logger;
2424

25-
import com.google.common.collect.HashBasedTable;
26-
import com.google.common.collect.Table;
2725
import org.apache.xerces.impl.dv.XSSimpleType;
2826
import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
2927
import org.apache.xerces.impl.xs.SchemaGrammar;
@@ -84,7 +82,7 @@ public class CMXSDDocument implements CMDocument, XSElementDeclHelper {
8482
private final XSModel model;
8583

8684
private final Map<XSElementDeclaration, CMXSDElementDeclaration> elementMappings;
87-
private final Table<CMXSDElementDeclaration, XSTypeDefinition, CMXSDElementDeclaration> refinedElementMappings;
85+
private final Map<CMXSDElementDeclaration, Map<XSTypeDefinition, CMXSDElementDeclaration>> refinedElementMappings;
8886

8987
private Collection<CMElementDeclaration> elements;
9088

@@ -96,7 +94,7 @@ public CMXSDDocument(XSModel model, XSLoaderImpl xsLoaderImpl) {
9694
this.model = model;
9795
this.xsLoader = xsLoaderImpl;
9896
this.elementMappings = new HashMap<>();
99-
this.refinedElementMappings = HashBasedTable.create();
97+
this.refinedElementMappings = new HashMap<>();
10098
this.tracker = createFilesChangedTracker(model);
10199
}
102100

@@ -196,10 +194,14 @@ public CMElementDeclaration findCMElement(DOMElement element, String namespace)
196194
XSTypeDefinition exactType = findXsiType(elt);
197195
if (exactType != null) {
198196
CMXSDElementDeclaration baseDeclaration = declaration;
199-
declaration = refinedElementMappings.get(baseDeclaration, exactType);
197+
Map<XSTypeDefinition, CMXSDElementDeclaration> refinedElementMappingsForDeclaration =
198+
refinedElementMappings.computeIfAbsent(baseDeclaration,
199+
_key -> new HashMap<>());
200+
201+
declaration = refinedElementMappingsForDeclaration.get(exactType);
200202
if (declaration == null) {
201203
declaration = baseDeclaration.refineType(exactType);
202-
refinedElementMappings.put(baseDeclaration, exactType, declaration);
204+
refinedElementMappingsForDeclaration.put(exactType, declaration);
203205
}
204206
}
205207
}

0 commit comments

Comments
 (0)