getDiameter() return a LineString. As Adam advise you can use LineString instead of Geometry in return type.