Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-6
-
Fix Version/s: 1.0-beta-8
-
Component/s: None
-
Labels:None
-
Environment:All
-
Number of attachments :
Description
From <oni> on #groovy
>
>
> println ( buffer + key + value);
>
> results in an error of No signature of method
> java.lang.StringBuffer.plus() is applicable
>
> buffer is of type StringBuffer
> if i use buffer.toString()
> it works fine
I assume the java compiler turns all the (buffer + key + value) into (buffer.append(key).append(value))
but the groovy plus() isn't quite as smart...?
either a compiler change, or a new DGM plus method perhaps..?
Thanks for this oni.
I added a plus method for this. This method allows to do StringBuffer+String. But I didn't add a method for Object or other classes because in Java StringBuffer+c works only if c.getClass() is String. Even StringBuffer+Stringbuffer is not allowed in Java.