Integrating Java and Prolog through Generic Methods and Type Inference