{"record":{"id":"8d8e43625b5d4164","repo":"antlr/antlr4","slug":"edgemap-of-type-0-is-supported-yet","errorCode":null,"errorMessage":"EdgeMap of type {0} is supported yet.","messagePattern":"EdgeMap of type (.+?) is supported yet\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"warning","filePath":"runtime/CSharp/src/Dfa/ArrayEdgeMap.cs","lineNumber":132,"sourceCode":"                {\n                    if (m is SparseEdgeMap<T>)\n                    {\n                        SparseEdgeMap<T> other = (SparseEdgeMap<T>)m;\n                        lock (other)\n                        {\n                            int[] keys = other.Keys;\n                            IList<T> values = other.Values;\n                            Antlr4.Runtime.Dfa.ArrayEdgeMap<T> result = this;\n                            for (int i = 0; i < values.Count; i++)\n                            {\n                                result = ((Antlr4.Runtime.Dfa.ArrayEdgeMap<T>)result.Put(keys[i], values[i]));\n                            }\n                            return result;\n                        }\n                    }\n                    else\n                    {\n                        throw new NotSupportedException(string.Format(\"EdgeMap of type {0} is supported yet.\", m.GetType().FullName));\n                    }\n                }\n            }\n        }\n\n        public override AbstractEdgeMap<T> Clear()\n        {\n            return new EmptyEdgeMap<T>(minIndex, maxIndex);\n        }\n\n        public override IReadOnlyDictionary<int, T> ToMap()\n        {\n            if (IsEmpty)\n            {\n                return Sharpen.Collections.EmptyMap<int, T>();\n            }\n\n            IDictionary<int, T> result = new SortedDictionary<int, T>();","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/antlr/antlr4/blob/7d5770395bb7b02eb56e7c62662cb1d7c08f42a3/runtime/CSharp/src/Dfa/ArrayEdgeMap.cs#L114-L150","documentation":"AbstractEdgeMap.PutAll switches on the concrete type of the source map; ArrayEdgeMap handles EmptyEdgeMap and fellow ArrayEdgeMap instances, and any other AbstractEdgeMap subclass falls into the default branch and throws NotSupportedException. The message ('EdgeMap of type {0} is supported yet.') is even missing an 'not' — the intent is 'is not supported yet'. Edge maps are internal DFA adjacency structures; user code normally never touches them.","triggerScenarios":"Calling PutAll on an ArrayEdgeMap with a source map that is neither EmptyEdgeMap nor ArrayEdgeMap (in practice a SingularEdgeMap from the same internal hierarchy). This requires directly using the internal Antlr4.Runtime.Dfa edge-map API, e.g. in custom DFA cache implementations or ATN experiments.","commonSituations":"Custom DFA/edge-map experiments; code copied from a different ANTLR runtime port where PutAll supports more map types; none in normal generated-parser usage.","solutions":["Do not mix edge map implementations in PutAll; iterate the other map's entries and call Put(key, value) instead","If you need full PutAll support, implement the merge loop yourself over ToMap()/entries of the source map","Treat the Antlr4.Runtime.Dfa edge-map classes as internal — build your own dictionary-based adjacency structure for custom work"],"exampleFix":"// before\nArrayEdgeMap<DFAState> merged = (ArrayEdgeMap<DFAState>)map.PutAll(otherMap); // throws for SingularEdgeMap\n\n// after\nAbstractEdgeMap<DFAState> merged = map;\nforeach (var kv in otherMap.ToMap())\n    merged = merged.Put(kv.Key, kv.Value);","handlingStrategy":"fallback","validationCode":null,"typeGuard":"static bool IsSupportedMergeSource(AbstractEdgeMap<DFAState> m) => m is EmptyEdgeMap<DFAState> || m is ArrayEdgeMap<DFAState>;","tryCatchPattern":null,"preventionTips":["Merge edge maps by iterating entries and calling Put instead of PutAll when types differ","Treat the Antlr4.Runtime.Dfa edge-map hierarchy as internal API; don't build on it"],"tags":["antlr","csharp","dfa","edge-map","internal-api"],"backgroundTag":null,"analyzedSha":"7d5770395bb7b02eb56e7c62662cb1d7c08f42a3","analyzedAt":"2026-08-14T14:47:56.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}