Subject: bug#15465: CC-mode misaligns enums that implement an interface in Java

From: Alan Mackenzie <[email-masked]>
Date: Sat, 28 Sep 2013 17:33:23 +0000

Hi, Paul.

Paul Pogonyshev <[email-masked]>, wrote:

> Since Java mode finally got some improvements recently, maybe someone
> can solve this too. In Java, enumerations can implement interfaces.
> However, CC-mode doesn't handle that well. Compare this indentation,
> for example:

> public enum X
> {
>     A,
>     B;
> }

> vs.

> public enum X implements Y
> {
>     A,
>         B;
> }

Yes, that is a bug.  It happens because the code that checks for being
inside an "enum" body only searches a maximum of two tokens backwards from
the "{" for the "enum" keyword.

> Fontification of 'A' and 'B' also changes when I add 'implements'
> keyword.

This was happening on any buffer change near the "{" for basically the
same reason.

I've committed a fix, revision #114474, to the bzr trunk.  Could you try
out the change, please, and either confirm it fixes the bug properly, or
tell me what hasn't yet been fixed.

Thanks for taking the trouble to report this, and thanks even more that
the report was so crisp, concise and to the point.

Paul

-- 
Alan Mackenzie (Nuremberg, Germany).