Wednesday, November 14, 2007

An Interesting Bug

Sometimes I run across an interesting/intriguing software bug, sometimes almost fun! Eclipse Bug 207631, "[Content Assist] Autocompletion fails after use of binary right-shift operators" is one of them.

The Eclipse IDE has a pretty nice autocomplete / code completion feature. I commonly use it to finish off class names to save typing, and in Eclipse, this also automatically adds the import statement at the top of the file.

So one day I'm working on some code, hit Ctrl+Spacebar, and expect Eclipse to work its magic - but nothing happens. No real surprise there, there could be numerous reasons - from a changed shortcut key preference to a corrupt index. The surprising / fun part is the very limited set of requirements needed to reproduce the bug. Apparently a right-shift binary operator is needed to reproduce, but not a left-shift or any other tested operator. (View the bug report for full details.)

The following is a minimal (and rather pointless) test case needed to reproduce: (Tested under 3.3 and 3.4M2.)

int x = 0;
int y = (x >> (1));

The bug was since bumped to major severity and P2 priority, making it one of the 34 most "serious" bugs for Eclipse as of 2007-11-14. (Interesting!)

No comments: