Sex register questioned as judge criticises mandatory requirement