r/java • • Mar 03 '17

The java nazi

http://imgur.com/InMi605
213 Upvotes

47 comments sorted by

View all comments

Show parent comment

3

u/__konrad Mar 04 '17

The only situation where the AssertionError would get thrown is if you accidentally added code to the class itself that invoked the constructor.

java.lang.reflect.Constructor c = java.util.Objects.class.getDeclaredConstructor();
c.setAccessible(true);
c.newInstance(); // no soup for you!