Thanks to visit codestin.com
Credit goes to github.com

Skip to content

(java) Improve detection of types, including generic and array types#4346

Draft
hns wants to merge 7 commits intohighlightjs:mainfrom
hns:java-generics-and-arrays
Draft

(java) Improve detection of types, including generic and array types#4346
hns wants to merge 7 commits intohighlightjs:mainfrom
hns:java-generics-and-arrays

Conversation

@hns
Copy link

@hns hns commented Dec 5, 2025

This improves detection of types in Java variable and method declarations, including support for generic and array types.

Resolves #3678
Resolves #4017
Resolves #4345

Changes

  • The regexes for type name and type parameters for generic types are split so they can be highlighted independently.
  • The regex for type parameters in generic types is improved to support wildcards and bounded types.
  • A regex for array brackets is added to support array types.
  • Regexes for type parameters and array brackets are added to variable and method declarations so they support generic and array types.
  • Like types of variable declarations, return types in methods are highlighted as hljs-type, including the void type.

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

@hns hns changed the title improve detection of types, including generic and array types (java) Improve detection of types, including generic and array types Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant