GROOVY-6358: @CompileStatic doesn't determine correct type for return from generic static method

added non regression test