Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #36813 > unrolled thread

null checks

Started byEric Douglas <e.d.programmer@gmail.com>
First post2017-07-07 08:03 -0700
Last post2017-07-11 20:30 -0400
Articles 4 on this page of 24 — 9 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 08:03 -0700
    Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-07 11:49 -0400
      Re: null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 08:54 -0700
        Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-07 12:12 -0400
          Re: null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 10:16 -0700
          Re: null checks Joerg Meier <joergmmeier@arcor.de> - 2017-07-08 22:33 +0200
            Re: null checks Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-08 21:14 +0000
              Re: null checks Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-08 17:51 -0400
                Re: null checks Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-08 22:26 +0000
              Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-08 18:28 -0400
              Re: null checks Joerg Meier <joergmmeier@arcor.de> - 2017-07-25 07:26 +0200
                Re: null checks Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-25 12:12 +0000
            Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-08 18:20 -0400
              Re: null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-10 05:35 -0700
          Re: null checks Robert Klemme <shortcutter@googlemail.com> - 2017-07-09 13:10 +0200
        Re: null checks Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 12:53 -0400
          Re: null checks lewbloch@gmail.com - 2017-07-26 11:16 -0700
            Re: null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-26 11:40 -0700
              Re: null checks Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-26 16:40 -0400
              Re: null checks lewbloch@gmail.com - 2017-07-28 18:47 -0700
    Re: null checks Wayne <wayne@nospam.invalid> - 2017-07-07 16:24 -0400
    Re: null checks Joerg Meier <joergmmeier@arcor.de> - 2017-07-08 22:32 +0200
    Re: null checks Lothar Kimmeringer <news201705@kimmeringer.de> - 2017-07-09 15:59 +0200
      Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-11 20:30 -0400

Page 2 of 2 — ← Prev page 1 [2]


#36827

FromWayne <wayne@nospam.invalid>
Date2017-07-07 16:24 -0400
Message-ID<ojoqe0$fvq$1@dont-email.me>
In reply to#36813
On 7/7/2017 11:03 AM, Eric Douglas wrote:
> Correct me if I'm wrong but the NonNull is pointless?

No, it's pointerless.

-- 
Wayne

[toc] | [prev] | [next] | [standalone]


#36834

FromJoerg Meier <joergmmeier@arcor.de>
Date2017-07-08 22:32 +0200
Message-ID<13wn1ta547tse.1rq2lmmpousnb.dlg@40tude.net>
In reply to#36813
On Fri, 7 Jul 2017 08:03:15 -0700 (PDT), Eric Douglas wrote:

> Correct me if I'm wrong but the NonNull is pointless?

It is not. Consider it a voluntary increase of Javas static typing. It
basically allows you to do compile time null checking, removing the need to
have null checks littered all over your code. It is less useful for
libraries, as someone could use the API without the checking enabled,
although even then, it could reduce null checks by limiting them to the
user facing API as kind of a barrier.

I found it makes internal projects more readable, and that's really all one
can ask for from something like this.

Liebe Gruesse,
		Joerg

[toc] | [prev] | [next] | [standalone]


#36844

FromLothar Kimmeringer <news201705@kimmeringer.de>
Date2017-07-09 15:59 +0200
Message-ID<3ubp2nji6vw$.dlg@kimmeringer.de>
In reply to#36813
Eric Douglas wrote:

> Correct me if I'm wrong but the NonNull is pointless?
> 
> https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_null_type_annotations.htm
> 
> We should just use the null check?
> 
> https://docs.oracle.com/javase/8/docs/api/java/util/Objects.html#requireNonNull-T-

In addition to all that has been said about this already I might
add the argument that an annotation also is some kind of
documentation for the user of a library. The annotation shows
up in Javadoc and e.g. within Eclipse when you use the
autocompletiton so you as a programmer know that null is not
accepted as parameter value.

You still need the check for null within the actual implementation
of the method but with the annotation you don't realize your
error when a NPE shows up but you can use your eyes and brain
to get a heads-up beforehand and can use tools showing you
errors/warnings before you put your code into production.


Cheers, Lothar
-- 
Lothar Kimmeringer                E-Mail: spamfang@kimmeringer.de
               PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
                 questions!

[toc] | [prev] | [next] | [standalone]


#36854

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-07-11 20:30 -0400
Message-ID<ok3qk1$k0p$1@gioia.aioe.org>
In reply to#36844
On 7/9/2017 9:59 AM, Lothar Kimmeringer wrote:
> In addition to all that has been said about this already I might
> add the argument that an annotation also is some kind of
> documentation for the user of a library. The annotation shows
> up in Javadoc and e.g. within Eclipse when you use the
> autocompletiton so you as a programmer know that null is not
> accepted as parameter value.
> 
> You still need the check for null within the actual implementation
> of the method but with the annotation you don't realize your
> error when a NPE shows up but you can use your eyes and brain
> to get a heads-up beforehand and can use tools showing you
> errors/warnings before you put your code into production.

And it would be even more cool if the javadoc tool
inserted a let us call it very clear sentence in the description
about what not do and the consequences of doing it anyway.

I can think of several serious and some funny texts.

Arne

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.java.programmer


csiph-web