This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: merge File.toURI() from Classpath


Dalibor Topic wrote:

Bryce McKinlay wrote:

Again, these exceptions should be documented as part of our API documentation. They are exceptions that should _never_ happen. No call from the application should cause them to be thrown, thus they are not part of the API. If they are ever thrown, then there is a bug in classpath. Nevertheless, applications should have the ability to try and continue in the face of classpath bugs if they need fault tolerance.


Can't we just use assertions for things that should never happen?


In this case I think its better not to, because assertions may be disabled in production builds. In this case we're just rethrowing exceptions that occured within classpath, and although these exceptions arn't supposed to happen, we _do_ want to know about them if they do.

On the other hand, I think assertions are the best bet in cases where the check itself makes the code more expensive, and you want to add some extra sanity tests to debug builds.

Regards

Bryce


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]