{"record":{"id":"e2f72bbb57666bd6","repo":"apache/cassandra","slug":"todo","errorCode":null,"errorMessage":"todo","messagePattern":"todo","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/utils/btree/BTreeMap.java","lineNumber":178,"sourceCode":"                              new KeyComparator<>(reversed), new AsymmetricKeyComparator<>(reversed));\n    }\n\n    @Override\n    public NavigableSet<K> navigableKeySet()\n    {\n        throw new UnsupportedOperationException(\"todo\");\n    }\n\n    @Override\n    public NavigableSet<K> descendingKeySet()\n    {\n        throw new UnsupportedOperationException(\"todo\");\n    }\n\n    @Override\n    public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)\n    {\n        throw new UnsupportedOperationException(\"todo\");\n    }\n\n    @Override\n    public NavigableMap<K, V> headMap(K toKey, boolean inclusive)\n    {\n        throw new UnsupportedOperationException(\"todo\");\n    }\n\n    @Override\n    public NavigableMap<K, V> tailMap(K fromKey, boolean inclusive)\n    {\n        throw new UnsupportedOperationException(\"todo\");\n    }\n\n    @Override\n    public Comparator<K> comparator()\n    {\n        return comparator.keyComparator;","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/utils/btree/BTreeMap.java#L160-L196","documentation":"BTreeMap's NavigableMap subMap(fromKey, fromInclusive, toKey, toInclusive) is an unimplemented stub that unconditionally throws UnsupportedOperationException with the placeholder message \"todo\". The btree-based immutable map implements only a subset of the NavigableMap API.","triggerScenarios":"Calling btreeMap.subMap(fromKey, fromInclusive, toKey, toInclusive) — the 4-argument inclusive/exclusive range view — on any BTreeMap instance.","commonSituations":"Code written against the general NavigableMap interface being passed a BTreeMap; refactoring code that previously used TreeMap to use BTreeMap; generic utility code iterating map ranges.","solutions":["Do not call the ranged subMap on BTreeMap; use BTree.slice() utilities or iterate the map's entrySet with your own bounds check.","Replace BTreeMap with java.util.TreeMap where ranged views are required.","Implement the method if you control the fork — it should return a bounded view over BTree.slice(tree, lower, lowerInclusive, upper, upperInclusive).","Guard the call site with an instanceof check and fall back to a copy-based approach."],"exampleFix":"// before\nNavigableMap<K,V> view = btreeMap.subMap(from, true, to, false); // throws\n// after\nIterator<Map.Entry<K,V>> it = BTree.slice(btreeTree, comparator, from, true, to, false, true);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"boolean supportsRanges(Map<?,?> m) { return !(m instanceof BTreeMap) && (m instanceof NavigableMap); }","tryCatchPattern":"try { return map.subMap(from, true, to, false); } catch (UnsupportedOperationException e) { /* fall back to filtered iteration */ }","preventionTips":["Never rely on full NavigableMap/SortedMap semantics for BTreeMap.","Check the class's supported API surface before generic refactors.","Use BTree iteration utilities for range queries.","Add tests that exercise ranged views if you swap map implementations."],"tags":["unsupported-operation","collections","btree"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}