Recalculating Scripts - Dynamic Attributes

Jmix 2.6. Recalculation scripts look promising. How can I set the value of a dynamic attribute based on calculation between mutiple other attributes.

the following works
return dynamicAttributes[‘baseEntityCategoryValue1’]

The following does not work
def kw1 = dynamicAttributes[‘baseEntityCategoryValue1’]
def kw2 = dynamicAttributes[‘baseEntityCategoryValue2’]
def kw3 = kw1+kw2
return kw3

GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#plus.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.Character]
[class java.lang.String]
[class java.lang.Number]

I get runtime errors.

A very simplistic example to get feedback on what I could be doing wrong.