Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Guava - why isn't IncomparableValueException public?

Tags:

java

guava

I am using Guava's Ordering in order to sort a list of entities based on the ordering of a list of id's corresponding to the entities. In some cases, there is a mismatch between the two lists (the id's come from the web GUI, while the entities from the database), since multiple users can manipulate the same enitity.

In these cases, Ordering throws a IncomparableValueException. I would like to catch this exception, in order to present the user with an informative error message. But, I am unable to, since the exception is package-local, not public. This leads to exception-handling code that is more messy than it should be (I have to catch ClassCastException instead..)

Why isn't this exception public in the first place? Since it's being thrown out of the Guava framework, I would expect to be able to catch it.

Might also add that in my original version (13.0.2), the exception had javadoc + a TODO saying "make public and document", in the newest version (18.0), both the javadoc and the TODO is gone, exception is still package-local.

like image 284
Tobb Avatar asked Dec 10 '14 13:12

Tobb


1 Answers

One reason is simply that I never got around to it. Can you file that issue please? Thanks!

like image 109
Kevin Bourrillion Avatar answered Oct 24 '22 01:10

Kevin Bourrillion