B&W print-friendly diagrams + tinkerpop-0001 + wave-3 proof sections. Squash of 94 local commits onto remote master.
1.3 KiB
1.3 KiB
| id | repo | severity | status | created | patched | patch |
|---|---|---|---|---|---|---|
| kotlin-0001 | kotlin | HIGH | PATCHED | 2026-03-23 | 2026-03-23 | defects/kotlin/patch/kotlin-0001-collectreachable-hashset.patch |
Defect
File: compiler/frontend/src/org/jetbrains/kotlin/resolve/NonExpansiveInheritanceRestrictionChecker.kt:150
Pattern: in List after DFS
Complexity: O(E×V)
Language: Kotlin
Description
The non-expansive inheritance restriction checker performs a DFS and then tests membership in a result list using the in operator, which triggers a linear scan. This post-DFS membership check is applied for each edge E during verification, and each check scans up to V entries, yielding O(E×V) total cost. For deeply nested inheritance hierarchies this becomes a significant performance bottleneck.
Fix
Replace: node in visitedList
With: node in visitedSet
Data structure change: visitedList: MutableList<TypeParameterDescriptor> → visitedSet: MutableSet<TypeParameterDescriptor>
Work required
- Patch in
defects/kotlin/patch/ - Unit test — asserts exact operation counts before/after (in
defects/kotlin/unit/) - Integration test (in
defects/kotlin/integration/) - Benchmark — before/after on V=100,200,400,800 (in
defects/kotlin/bench/) - White paper section