Before talking about Static Initializer, I wanna talk a little bit about what is this static thingy in Java.
What is This Code Coverage Thing?
Good question if you really don’t know what it means :) I’ve more than 7 years of software development experience and to be honest, I’ve never seen a company who uses code coverage as a metric unfortunately. We’re developing a lot of beautiful software and in most cases we’re ending up with lots of code messes :( You can argue on why it happens like this, but I’m not gonna go into that today. Let’s get back to the main topic:
Varargs Collection Factory Method
If you read my double brace post, you might find it very handy. However, sometimes you might be warned by PMD or Checkstyle for this kind of usage. Because they don’t like this kind of usages. One way to fix this problem is putting either //no pmd or suppressing method for PMD.NonStaticInitializer.
