harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov" <alexei.zakha...@gmail.com>
Subject Re: Compatibility or non-bug question
Date Sun, 24 Dec 2006 19:06:08 GMT
> > I've read in some clever article :) that NPE is a way to react on
> > un-predicted situation and it should never be thrown explicitly.

Well, there are several places in 1.5 javadocs where
NullPointerException is explicitly described. For example:
java.lang.Class#isAssignableFrom(Class). I don't think we should call
the situation unpredicted if it is described in the spec. :)

Thanks,

2006/12/24, Zakharov, Vasily M <vasily.m.zakharov@intel.com>:
>
> Can't remember, I may be wrong.
>
> Well, what would be our policy on this point?
>
> If the documentation describes the parameter as "non-null", or null
> value is clearly unacceptable for the method functionality, what should
> we throw if null is passed, NullPointerException or
> IllegalArgumentException?
>
>  Vasily
>
>
> -----Original Message-----
> From: nbeyer@gmail.com [mailto:nbeyer@gmail.com] On Behalf Of Nathan
> Beyer
> Sent: Sunday, December 24, 2006 5:42 AM
> To: dev@harmony.apache.org
> Subject: Re: Compatibility or non-bug question
>
> On 12/23/06, Zakharov, Vasily M <vasily.m.zakharov@intel.com> wrote:
> >
> > I've read in some clever article :) that NPE is a way to react on
> > un-predicted situation and it should never be thrown explicitly. And
> > IAE, in contrary, is there exactly for explicit handling of incorrect
> > argument situations.
>
> Can you provide an actual reference to this article? I'm not familiar
> with any such guideline or design consideration.
>
> Regardless, there's nothing wrong explicitly throwing NPE.
>
> -Nathan
>
> >
> > So if we need to check the argument and throw exception manually - it
> > should be IAE with "argument is null" comment string, my vote. :)
> >
> >  Vasily
> >
> >
> > -----Original Message-----
> > From: Alexei Zakharov [mailto:alexei.zakharov@gmail.com]
> > Sent: Thursday, December 21, 2006 12:30 PM
> > To: dev@harmony.apache.org
> > Subject: Re: Compatibility or non-bug question
> >
> > > Why NPE and not IllegalArgumentException?
> > > If doc says "non-null", the latter may also be appropriate...
> >
> > IMHO NullPointerException emphasizes the fact that argument was set to
> > *null* value. However, I think IllegalArgumentException is also Ok.
> >
> > Thanks,
> >
> > 2006/12/20, Zakharov, Vasily M <vasily.m.zakharov@intel.com>:
> > >
> > > Thanks Alexei!
> > >
> > > > IMHO it is ok to throw NullPointerException here and file
> > Non-Bug-Diff
> > > JIRA.
> > >
> > > Why NPE and not IllegalArgumentException?
> > > If doc says "non-null", the latter may also be appropriate...
> > >
> > >  Vasily
> > >
> > >
> > > -----Original Message-----
> > > From: Alexei Zakharov [mailto:alexei.zakharov@gmail.com]
> > > Sent: Wednesday, December 20, 2006 4:57 PM
> > > To: dev@harmony.apache.org
> > > Subject: Re: Compatibility or non-bug question
> > >
> > > Hi,
> > >
> > > > http://issues.apache.org/jira/browse/HARMONY-1024
> > >
> > > So RI allows creation of the Binding with null name. I don't see
> much
> > > sence in such object.  How can it be used? For what? Moreover, we
> have
> > > a non-null spec requirement. So IMHO it is ok to throw
> > > NullPointerException here and file Non-Bug-Diff JIRA.
> > >
> > > > http://issues.apache.org/jira/browse/HARMONY-2525
> > >
> > > The same thing here. The only exception is that IMHO test3 from this
> > > JIRA is valid. Why not to throw IndexOutOfBoundsException before
> > > NullPointerException?
> > >
> > > Regards,
> > >
> > >
> > >
> > >
> > > 2006/12/17, Zakharov, Vasily M <vasily.m.zakharov@intel.com>:
> > > >
> > > > Well, that's better than nothing. :)
> > > >
> > > > In fact, those two bugs I've mentioned are the ones I'm most
> > > interested
> > > > in right now:
> > > >
> > > > http://issues.apache.org/jira/browse/HARMONY-1024
> > > > http://issues.apache.org/jira/browse/HARMONY-2525
> > > >
> > > > What to you think we should do to them?
> > > >
> > > > Thank you.
> > > >
> > > >  Vasily
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Alexey Petrenko [mailto:alexey.a.petrenko@gmail.com]
> > > > Sent: Saturday, December 16, 2006 7:48 AM
> > > > To: dev@harmony.apache.org
> > > > Subject: Re: Compatibility or non-bug question
> > > >
> > > > We have a compatibility guideline [1].
> > > > And according this guideline we should discuss cases like yours
> one
> > by
> > > > one.
> > > >
> > > > SY, Alexey
> > > >
> > > > [1]
> http://harmony.apache.org/subcomponents/classlibrary/compat.html
> > > >
> > > > 2006/12/16, Zakharov, Vasily M <vasily.m.zakharov@intel.com>:
> > > > > Hi, all,
> > > > >
> > > > > I'm now trying to investigate and fix some trivial bugs, but I'm
> > not
> > > > > sure which way to fix them to.
> > > > >
> > > > > There're multiple situations where RI, say, doesn't throw
> > exception
> > > > and
> > > > > Harmony does throw, and throwing an exception in that situation
> > > looks
> > > > > good and logical.
> > > > >
> > > > > In other words, the question is, what is a compatibility bug
> (that
> > > > needs
> > > > > to be fixed to match RI) and what is a non-bug difference.
> > > > >
> > > > > Also, there's a question on non-bug differences. They're not
> bugs,
> > > but
> > > > > what should we do to them? Just close them, if Harmony behaviour
> > > seems
> > > > > more correct than RI's? Or fix them to match RI though they're
> not
> > > > bugs,
> > > > > to make sure we don't break existing applications?
> > > > >
> > > > > Here are two characteristic examples of uncertainties that occur
> > > > rather
> > > > > frequently:
> > > > > http://issues.apache.org/jira/browse/HARMONY-1024
> > > > > http://issues.apache.org/jira/browse/HARMONY-2525
> > > > >
> > > > > Do we have some, say, policy, or guideline on how issues like
> > these
> > > > > could (or should) be resolved?
> > > > >
> > > > > There're many issues like these, and having a general approach
> > would
> > > > > ease dealing with them...
> > > > >
> > > > > Any opinions?
> > > > >
> > > > > Thank you!


-- 
Alexei Zakharov,
Intel ESSD

Mime
View raw message