Skip to main content
1 of 4
Wayne Conrad
  • 3.3k
  • 13
  • 6

Edit a question to add comments to the code?

In this question, an edit to the code (by other than the asker) added this block of comments to the code:

    // duplication
    //     ||
    //    \||/
    //     \/
    try {
        listener = (SomeListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement SomeListener");
    }

This appears to be an answer or comment, of sorts. I've never seen this done; it's pretty clever. However, my understanding is that the code may be edited to, for example, fix obvious indentation errors caused by cut-and-paste. Putting an answer or comment into the code itself seems counter to my understand of accepted practice.

Is this good practice? Should I flag it for moderator attention?

Wayne Conrad
  • 3.3k
  • 13
  • 6