Re: [lang] NPE vs IAE

2020-03-05 Thread sebb
On Thu, 5 Mar 2020 at 19:29, Gilles Sadowski wrote: > > Le jeu. 5 mars 2020 à 16:12, sebb a écrit : > > > > On Wed, 4 Mar 2020 at 14:20, Gilles Sadowski wrote: > > > > > > Le mer. 4 mars 2020 à 15:16, sebb a écrit : > > > > > > > > On Wed, 4 Mar 2020 at 14:09, Gary Gregory > > > > wrote: > >

Re: [lang] NPE vs IAE

2020-03-05 Thread Gilles Sadowski
Le jeu. 5 mars 2020 à 19:04, Peter Verhas a écrit : > > Just my 2c: > > When you have an assertion in the code that throws an exception, be it NPE > or IAE then your code is less prone to errors during maintenance. In that > case, the assertion is there is the code, kind of documenting it. If the

Re: [lang] NPE vs IAE

2020-03-05 Thread Gilles Sadowski
Le jeu. 5 mars 2020 à 16:12, sebb a écrit : > > On Wed, 4 Mar 2020 at 14:20, Gilles Sadowski wrote: > > > > Le mer. 4 mars 2020 à 15:16, sebb a écrit : > > > > > > On Wed, 4 Mar 2020 at 14:09, Gary Gregory wrote: > > > > > > > > IMO, until we are all on Java 14 and benefit from its more detaile

Re: [lang] NPE vs IAE

2020-03-05 Thread Peter Verhas
Just my 2c: When you have an assertion in the code that throws an exception, be it NPE or IAE then your code is less prone to errors during maintenance. In that case, the assertion is there is the code, kind of documenting it. If the assertion is not there with the reasoning that the subsequent co

Re: [lang] NPE vs IAE

2020-03-05 Thread sebb
On Wed, 4 Mar 2020 at 14:20, Gilles Sadowski wrote: > > Le mer. 4 mars 2020 à 15:16, sebb a écrit : > > > > On Wed, 4 Mar 2020 at 14:09, Gary Gregory wrote: > > > > > > IMO, until we are all on Java 14 and benefit from its more detailed NPE > > > message, we need to call Validate.notNull _with a

Re: [lang] NPE vs IAE

2020-03-04 Thread Gilles Sadowski
Le mer. 4 mars 2020 à 15:16, Gilles Sadowski a écrit : > > Le mer. 4 mars 2020 à 15:09, Gary Gregory a écrit : > > > > IMO, until we are all on Java 14 and benefit from its more detailed NPE > > message, we need to call Validate.notNull _with a message_ that says what > > variable blew up. > > No

Re: [lang] NPE vs IAE

2020-03-04 Thread Gilles Sadowski
Le mer. 4 mars 2020 à 15:16, sebb a écrit : > > On Wed, 4 Mar 2020 at 14:09, Gary Gregory wrote: > > > > IMO, until we are all on Java 14 and benefit from its more detailed NPE > > message, we need to call Validate.notNull _with a message_ that says what > > variable blew up. > > +1 > > That is a

Re: [lang] NPE vs IAE

2020-03-04 Thread sebb
On Wed, 4 Mar 2020 at 14:09, Gary Gregory wrote: > > IMO, until we are all on Java 14 and benefit from its more detailed NPE > message, we need to call Validate.notNull _with a message_ that says what > variable blew up. +1 That is another good point. Unless one has access to the exact same ver

Re: [lang] NPE vs IAE

2020-03-04 Thread Gilles Sadowski
Le mer. 4 mars 2020 à 15:09, Gary Gregory a écrit : > > IMO, until we are all on Java 14 and benefit from its more detailed NPE > message, we need to call Validate.notNull _with a message_ that says what > variable blew up. No, we don't *need* to (for the reason stated previously), but you may *w

Re: [lang] NPE vs IAE

2020-03-04 Thread Gary Gregory
IMO, until we are all on Java 14 and benefit from its more detailed NPE message, we need to call Validate.notNull _with a message_ that says what variable blew up. Gary On Wed, Mar 4, 2020 at 9:01 AM Gilles Sadowski wrote: > Le mer. 4 mars 2020 à 14:19, Gary Gregory a > écrit : > > > > On Wed,

Re: [lang] NPE vs IAE

2020-03-04 Thread Gilles Sadowski
Le mer. 4 mars 2020 à 14:19, Gary Gregory a écrit : > > On Wed, Mar 4, 2020 at 7:58 AM sebb wrote: > > > On Sat, 29 Feb 2020 at 18:09, Gilles Sadowski > > wrote: > > > > > > Le sam. 29 févr. 2020 à 18:39, Gary Gregory a > > écrit : > > > > > > > > On Sat, Feb 22, 2020 at 5:25 PM Gary Gregory >

Re: [lang] NPE vs IAE

2020-03-04 Thread Gary Gregory
On Wed, Mar 4, 2020 at 7:58 AM sebb wrote: > On Sat, 29 Feb 2020 at 18:09, Gilles Sadowski > wrote: > > > > Le sam. 29 févr. 2020 à 18:39, Gary Gregory a > écrit : > > > > > > On Sat, Feb 22, 2020 at 5:25 PM Gary Gregory > wrote: > > > > > > > I would like to do the same in Lang as with Collec

Re: [lang] NPE vs IAE

2020-03-04 Thread sebb
On Sat, 29 Feb 2020 at 18:09, Gilles Sadowski wrote: > > Le sam. 29 févr. 2020 à 18:39, Gary Gregory a écrit : > > > > On Sat, Feb 22, 2020 at 5:25 PM Gary Gregory wrote: > > > > > I would like to do the same in Lang as with Collections (see below.)\ > > > > > > We currently perform checks like:

Re: [lang] NPE vs IAE

2020-02-29 Thread Gilles Sadowski
Le sam. 29 févr. 2020 à 18:39, Gary Gregory a écrit : > > On Sat, Feb 22, 2020 at 5:25 PM Gary Gregory wrote: > > > I would like to do the same in Lang as with Collections (see below.)\ > > > > We currently perform checks like: > > > > Validate.isTrue(foo != null, ...) > > > > Which should be IMO

Re: [lang] NPE vs IAE

2020-02-29 Thread Gary Gregory
On Sat, Feb 22, 2020 at 5:25 PM Gary Gregory wrote: > I would like to do the same in Lang as with Collections (see below.)\ > > We currently perform checks like: > > Validate.isTrue(foo != null, ...) > > Which should be IMO: > > Validate.notNull(foo, ...); > > The difference being that the former

[lang] NPE vs IAE

2020-02-22 Thread Gary Gregory
I would like to do the same in Lang as with Collections (see below.)\ We currently perform checks like: Validate.isTrue(foo != null, ...) Which should be IMO: Validate.notNull(foo, ...); The difference being that the former throws IAE and the later NPE. As with [collections], my argument is t