2222import java .util .logging .Level ;
2323import java .util .logging .Logger ;
2424
25- import com .google .common .collect .HashBasedTable ;
26- import com .google .common .collect .Table ;
2725import org .apache .xerces .impl .dv .XSSimpleType ;
2826import org .apache .xerces .impl .dv .xs .XSSimpleTypeDecl ;
2927import 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