Follow up to
GROOVY-7691. When getter generated for property is used, return type check fails.
"[Static type checking] - Cannot return value of type N on method returning type L"
StaticTypeCheckingVisitor has set the wrong declaring class for getNumber and so generics resolution from N to Long fails.