highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

(java) Highlighting breaks on Generics with fully-qualified-name

Open Elewyth opened this issue 2 years ago • 0 comments

Describe the issue When the type inside of a generic (i.e. inside of <>) includes . as part of a fully qualified class name, the highlighter no longer seems to parse the rest of the line.

Which language seems to have the issue? Java

Are you using highlight or highlightAuto? hljs.highlightAll() with class="language-java" on the <code>-element ...

Sample Code to Reproduce

<pre><code class="language-java">
interface FooBar {
  List&lt;String&gt; foo();
  List&lt;java.lang.String&gt; bar();
}
</code></pre>

http://jsfiddle.net/zwg2sp4x/

Only "foo" is highlighted as a function name, "bar" is not.

Expected behavior both "foo" and "bar" should be highlighted as a function name.

Additional context Tested with versions 11.7.0 and 10.5.0 with same behavior on each

Elewyth avatar Dec 12 '22 16:12 Elewyth