mirror of
https://github.com/github/codeql.git
synced 2026-06-30 09:05:28 +02:00
Why this is needed: - Under K2, binary Java symbols are represented differently from K1: JavaSourceElement metadata is often absent and sources are exposed through VirtualFileBasedSourceElement. - Without recovery logic, callable matching can miss declared Java methods, callable labels can drift (primitive vs boxed reference types), and external Java declaration stubs can gain wildcard noise when Java signatures are not available. - These differences produced Kotlin 2.0 parity drift in tests that rely on stable Java/Kotlin cross-extractor callable identity. What this changes: - Add K2-aware Java binary inspection helpers (ASM-based fallback) to detect declared methods and parameter/return reference-vs-primitive shape when JavaSourceElement metadata is unavailable. - Recover Java callables more reliably in KotlinUsesExtractor, including a binary-class fallback path. - Normalise callable labels and call result typing to boxed Java classes when K2 enhanced reference types appear as Kotlin primitives. - Accept K2's `Any` form for Object.equals(Object) and keep binary declaration checks stable. - Suppress default wildcard insertion for external Java declaration stubs when no Java callable metadata is available, preventing synthetic wildcard drift. This commit restores Java interop parity for Kotlin 2.0 extraction paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>