Menu

#240 Ctags does not handle Java annotations for method parameters

closed-fixed
None
5
2008-12-13
2008-09-18
Paolo
No

Suppose you have in Java this constructor declaration (it is code generated by SableCC, and it compiles fine - I use the ajc compiler, but I believe this is standard Java):

public AAssignmentExp(@SuppressWarnings("hiding") TAssign _token_,
@SuppressWarnings("hiding") PLvalue _lvalue_,
@SuppressWarnings("hiding") PExp _exp_)
{
setToken(_token_);
setLvalue(_lvalue_);
setExp(_exp_);
}
Such a construct (annotations for parameters) are also valid for normal methods:
@Override void removeChild(@SuppressWarnings("unused") Node child) {
...
}

Ctags 5.7 does not handle this. With the attached patch, it does - but note I wrote it with a minimum understanding of ctags source code, in about half an hour (after about as much time before looking at the source code). It should just skip an annotation whenever it is found inside a parameter list - the intent is to skip it when it is before or after the type identifier (I don't believe it can come after the name identifier, however I didn't check).

Discussion

  • Paolo

    Paolo - 2008-09-18

    Patch to fix the problem.

     
  • Elliott Hughes

    Elliott Hughes - 2008-12-13
    • assigned_to: nobody --> elliotth
     
  • Elliott Hughes

    Elliott Hughes - 2008-12-13

    the patch looks good to me. committed to Subversion, along with this test case, and the test case from another bug.

    thanks! (and sorry it took so long to take a look. annoyingly, the development mailing list doesn't automatically get notified of new bug reports.)

    you'll be credited in the NEWS file as "blaisorblade". comment here if you'd like me to use a different name, or if you'd prefer no credit.

     
  • Elliott Hughes

    Elliott Hughes - 2008-12-13
    • status: open --> closed-fixed
     
  • Paolo

    Paolo - 2008-12-15

    Thanks for the answer.
    Please credit me as "Paolo 'Blaisorblade' Giarrusso <p (dot) giarrusso (at) gmail (dot) com", (with antispam encoding removed).

    Bye!

     
  • Elliott Hughes

    Elliott Hughes - 2008-12-15

    done.

     

Log in to post a comment.