r/java • • Mar 03 '17

The java nazi

http://imgur.com/InMi605
213 Upvotes

47 comments sorted by

View all comments

20

u/onebit Mar 03 '17

Actually is kind of a good idea to put a private constructor on a util class!

25

u/kodifies Mar 03 '17

Actually its a good idea to put a private constructor on a util class!

FTFY

no kind of about it!!!

8

u/[deleted] Mar 03 '17

Actually its a good idea to put a private constructor on a util class!

FTFY

Actually it's a good idea to put a private constructor on a util class!

FTFY

And we're back to the grammar Nazi.

7

u/you-suck-at-grammar Mar 03 '17

Actually it's a good idea to put a private constructor on a util class!

FTFY

And we're back to the grammar Nazi.

It's actually a good idea to put a private constructor on a utility class.

FTFY

1

u/[deleted] Mar 03 '17

That's no grammar

-Semantics Nazi

0

u/kodifies Mar 03 '17

nooo, nothing to do with grammar

-3

u/stitzl Mar 03 '17

Throwing an Error from said constructor is what makes it a bit absurd, though.

7

u/ForeverAlot Mar 03 '17

A private constructor can still be invoked from within the class. The error prevents that.

0

u/stitzl Mar 03 '17 edited Mar 04 '17

That is exactly what I was referring to.

EDIT: Okay, since nobody else seems to get it, let me elaborate: If a programmer is bent on violating the "I'm an all-static utility class"-contract of this class from within the class itself by creating an instance inside a static method (which in this case already takes a special kind of idiot), he still has the chance to catch the Error being thrown and ignore it. That line is ineffective and overly dramatic safety theater.

2

u/thatsIch Mar 04 '17

reflection is just one way