Government bonds issued by Japan – the world's second biggest economy – have been downgraded to the same status as those from Latvia and Poland.