java highlight doesn't understand generics

Issue #524 on hold
Alexander Kjäll
created an issue

This piece of code doesn't get highlighted properly:

public interface myDAO { List<String> getValue(String kind);

String getCategory(String id); }

The first function doesn't get hilighted as a function.

Comments (3)

  1. Tim Hatch

    Agreed. We've historically had problems keeping function detection regexes to be fast, so this may require some thought. IIRC Java syntax allows the same sort of nesting as C++, so you might have a

    Foo<Map<Integer, String>, Double> func(String x);

    Needs some more thought.

  2. Steven Bethard

    While you can't solve all of the cases, lots of instances of Java generics are not recursive; they look like the List<String> example above. What about a special-case for this very common, non-recursive pattern, something like r"(<[^>]*>)?"?

    FWIW, I ran into a similar issue with new Something<X, Y>() not being recognized as a constructor call (via Jekyll, which is using pygments.rb 0.6.1 == Pygments 2.0 AFAICT).

  3. Log in to comment