mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-04 02:31:36 +00:00
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:
parent
928ec54a42
commit
a72cf6e562
1 changed files with 3 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue