I don't think changing 'kind == ReplPane.ViewableElementName' to
'kind.equals(ReplPane.ViewableElementName)' is needed unless Swing
behind-the-scenes makes a copy of the incoming String. I guess in
theory Swing might do that (perhaps internally Swing might use UTF-8
byte arrays - like javac does), and the code is not performance-critical,
so it may be reasonable to use equals.
Ah, I might have made a mistake here, I was worried that this condition
might not have been what was intended, since I thought the object
references might have been different, even though the contents of the
strings were the same.
Please may someone explain why this is done,
public static final String ViewableElementName = "Viewable";
public static final Object ViewableAttribute =
new String(ViewableElementName);
Why bother with the String constructor?