1. Georg Brandl
  2. pygments-main
  3. Issues
Issue #771 resolved

Java generic methods lexer is wrong.

Anonymous created an issue

Simply put, try and have these two methods in an interface; {{{

!java

public void hello(); public Map<String> helloTwo(); }}}

Comments (2)

  1. Markus Holtermann

    I came across this issue today too. The simplest solution would be to add < and > to the regarding regular expression:

    (r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
    (r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]\<\>]*\s+)+?)' # return arguments
    

    This, obviously, does not take care of correct syntax, hence public Map<<<String> helloTwo(); would be marked correctly, even if it is wrong.

  2. Log in to comment