This seems pretty stupid, but it can happen to anyone.
This, of course, works:
boolean something = true
prinltn "The value of something is: " + something
But, this, strangely (at first) DOES NOT work:
def something = true
prinltn something + ", is the value of something"
If you notice, it fails with: MissingMethodException: No signature of method: java.lang.Boolean.plus()
That's because the +
in Groovy calls the plus()
method on the first item, and only numbers and strings know that you want to concatenate.
So, you have two options. One is to call the toString()
method on the first item and the other is to use GStrings like this:
def something = true
prinltn "${something}, is the value of something"