Repository navigation
fix(java): support qualified generic type arguments - #4455
Conversation
Build Size ReportChanges to minified artifacts in 5 files changedTotal change +19 B View Changes
|
joshgoebel
left a comment
There was a problem hiding this comment.
Optional nits only — LGTM overall.
| interface FooBar { | ||
| List<String> foo(); | ||
| List<java.lang.String> bar(); | ||
| } |
There was a problem hiding this comment.
Optional: one more case covering FQNs inside nested/wildcard type args would lock the TYPE_ARG_RE path a bit harder, e.g.:
| } | |
| interface FooBar { | |
| List<String> foo(); | |
| List<java.lang.String> bar(); | |
| Map<java.lang.String, java.util.List<String>> nested(); | |
| List<? extends java.lang.Number> bounded(); | |
| } |
(and matching lines in generics.expect.txt after a rebuild/ONLY_LANGUAGES=java npm run test-markup.)
| // A simple Java type: a type name, optionally followed by type arguments and/or array brackets | ||
| // '<@@@>' is replaced with the pattern for optional type arguments by recurRegex below. | ||
| const SIMPLE_TYPE_RE = JAVA_IDENT_RE + '<@@@>' + ARRAY_BRACKETS_OPTIONAL_RE; | ||
| const SIMPLE_TYPE_RE = JAVA_IDENT_RE + '(?:\\.' + JAVA_IDENT_RE + ')*<@@@>' + ARRAY_BRACKETS_OPTIONAL_RE; |
There was a problem hiding this comment.
Nit: worth updating the comment so it mentions qualified names:
| // A simple Java type: a type name, optionally followed by type arguments and/or array brackets | |
| // '<@@@>' is replaced with the pattern for optional type arguments by recurRegex below. | |
| const SIMPLE_TYPE_RE = JAVA_IDENT_RE + '<@@@>' + ARRAY_BRACKETS_OPTIONAL_RE; | |
| const SIMPLE_TYPE_RE = JAVA_IDENT_RE + '(?:\\.' + JAVA_IDENT_RE + ')*<@@@>' + ARRAY_BRACKETS_OPTIONAL_RE; | |
| // A simple Java type: a type name (optionally package-qualified), optionally followed by type arguments and/or array brackets | |
| // '<@@@>' is replaced with the pattern for optional type arguments by recurRegex below. | |
| const SIMPLE_TYPE_RE = JAVA_IDENT_RE + '(?:\.' + JAVA_IDENT_RE + ')*<@@@>' + ARRAY_BRACKETS_OPTIONAL_RE; |
- update comment to mention package-qualified names - add nested/wildcard FQN fixtures: Map<java.lang.String, java.util.List<String>> and List<? extends java.lang.Number> Co-authored-by: joshgoebel <[email protected]>
Build Size ReportChanges to minified artifacts in 5 files changedTotal change +10 B View Changes
|
68a1faa to
2bf8d51
Compare
Build Size ReportChanges to minified artifacts in 2 files changedTotal change +15 B View Changes
|
… issue highlightjs#3677 Co-authored-by: joshgoebel <[email protected]>
2bf8d51 to
6a56382
Compare
Build Size ReportChanges to minified artifacts in 3 files changedTotal change -3 B View Changes
|
Changes
The Java grammar accepted only one identifier inside a generic type argument, so a declaration such as
List<java.lang.String> bar()was not recognized as a method.This change:
List<java.lang.String>regression to the existing Java generics fixture; andCHANGES.md.The behavior introduced by #4346 remains covered: all 11 Java markup fixtures pass, and top-level qualified declarations are unchanged.
Fixes #3677
Verification
npm run buildONLY_LANGUAGES=java npm run test-markup— 11 passingnpm run lint-languages— passednpm run lint— passed with one existing ignored-vendor warningnpm test— 1,583 passing, 3 pendinggit diff --check— passedsrc/languages/java.jsreproduced the focused failure; restoring it returned all 11 Java fixtures to green.A fresh
npm ciwas unavailable because registry DNS failed in the isolated Linux environment. Verification reused the exact unchanged lockfile dependency tree plus the official lock-resolved Rollup Linux package;npm ls --allreported 782 nodes and no problems.Checklist
CHANGES.mdAssistance disclosure
This patch and its verification were prepared with OpenAI Codex assistance. The final diff and test outputs were reviewed before publication.