problem here is, that you are using raw type:
But you should really use:
This would produce compile time error.
What happens in your case is what you actually mentioned - Comparable takes any Object and then at runtime it fails to cast that Object into your desired one.
In your example concrete type is infered from the first parameter - Float. And Float class has its compareTo method defined as follows:
which obviously fails cast Long to Float.
Hope this helps and is correct
Best regards, Robert.