From a72cf6e562a5b4fe04e47c2bae2dd4f6dd5cb2bf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 May 2026 14:55:23 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20improve=20stripGeneric=20fallback=20rege?= =?UTF-8?q?x=20=E2=80=94=20use=20valid=20Java=20identifier=20chars=20and?= =?UTF-8?q?=20handle=20nested=20generics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/223f77ac-59a7-4487-9316-f2be05eac5d3 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> --- gitnexus/src/core/ingestion/languages/java/interpret.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitnexus/src/core/ingestion/languages/java/interpret.ts b/gitnexus/src/core/ingestion/languages/java/interpret.ts index 19a6990c9..d9088552e 100644 --- a/gitnexus/src/core/ingestion/languages/java/interpret.ts +++ b/gitnexus/src/core/ingestion/languages/java/interpret.ts @@ -122,7 +122,9 @@ function stripGeneric(text: string): string { // Fallback: strip generic parameters from any unrecognized generic type. // `BaseModel` → `BaseModel`, `Builder` → `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>` → `BaseModel`). + const fallback = text.match(/^([A-Za-z_$][A-Za-z0-9_$]*)<.+>$/s); if (fallback !== null) return fallback[1].trim(); return text;