{"id":164,"date":"2006-04-20T16:11:35","date_gmt":"2006-04-20T16:11:35","guid":{"rendered":"http:\/\/kubasek.com\/blog\/pragmatic_craftsman\/?p=164"},"modified":"2006-04-20T16:11:35","modified_gmt":"2006-04-20T16:11:35","slug":"assertions","status":"publish","type":"post","link":"https:\/\/pragmaticcraftsman.kubasek.com\/2006\/04\/20\/assertions\/","title":{"rendered":"Assertions"},"content":{"rendered":"<p>Are you using them?<\/p>\n<p>I only found out about them recently &#8212; they&#8217;ve been available since JDK 1.4. I think they&#8217;re vastly underutilized&#8230;. But they can be really helpful in debugging situations and don&#8217;t incur any performance hit.<\/p>\n<p>You can enable them in your JDK by adding &#8220;-enableassertions&#8221; to default VM arguments (type &#8220;jre&#8221; in filters in Eclipse and edit it there).<\/p>\n<p>Then in your code, whenever you have a feeling &#8220;this can never be null or false&#8221; add the assertion, as in<code>assert thisField != null;<\/code> and you&#8217;re done.<\/p>\n<p>Assertions are a great debugging tool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you using them? I only found out about them recently &#8212; they&#8217;ve been available since JDK 1.4. I think they&#8217;re vastly underutilized&#8230;. But they can be really helpful in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-164","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/pragmaticcraftsman.kubasek.com\/wp-json\/wp\/v2\/posts\/164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pragmaticcraftsman.kubasek.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pragmaticcraftsman.kubasek.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pragmaticcraftsman.kubasek.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pragmaticcraftsman.kubasek.com\/wp-json\/wp\/v2\/comments?post=164"}],"version-history":[{"count":0,"href":"https:\/\/pragmaticcraftsman.kubasek.com\/wp-json\/wp\/v2\/posts\/164\/revisions"}],"wp:attachment":[{"href":"https:\/\/pragmaticcraftsman.kubasek.com\/wp-json\/wp\/v2\/media?parent=164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pragmaticcraftsman.kubasek.com\/wp-json\/wp\/v2\/categories?post=164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pragmaticcraftsman.kubasek.com\/wp-json\/wp\/v2\/tags?post=164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}