Fixed Java types to compile correctly

Fixed the typedef in XS file (same as the Cni.XS)

Also, fixed the Java return types where Generics were involved