fix: improve stripGeneric fallback regex — use valid Java identifier chars and handle nested generics

Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/223f77ac-59a7-4487-9316-f2be05eac5d3

Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-11 14:55:23 +00:00 • committed by GitHub
parent 928ec54a42
commit a72cf6e562
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -122,7 +122,9 @@ function stripGeneric(text: string): string {
// Fallback: strip generic parameters from any unrecognized generic type.
// `BaseModel<T>` → `BaseModel`, `Builder<Self>` → `Builder`.
// This mirrors JVM type erasure — the raw class name is the resolvable symbol.
const fallback = text.match(/^([A-Za-z_][A-Za-z0-9_.]*)<.+>$/);
// The pattern matches up to the first `<` to handle nested generics safely
// (e.g. `BaseModel<List<String>>` → `BaseModel`).
const fallback = text.match(/^([A-Za-z_$][A-Za-z0-9_$]*)<.+>$/s);
if (fallback !== null) return fallback[1].trim();
return text;