<div dir="ltr"><div dir="ltr"><div dir="ltr">On Wed, Dec 4, 2024 at 3:47 PM Eirik Bjørsnøs <<a href="mailto:eirbjo@gmail.com" target="_blank">eirbjo@gmail.com</a>> wrote:</div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>The OpenJDK includes many boolean flags in the form of system properties. These toggle different behavior such as debug logging, verification, caching, compatibility and conditional features.</div></div></div></blockquote><div><br></div><div>To learn more about how the JDK uses boolean system properties, I conducted a survey of the ones I could identify in java.base and thought it could be useful to share the observations:</div><div><br></div><div>First, some definitions:</div><div><br></div><div>a) A <b>boolean system property </b>(BSP) is one whose value is evaluated to either true or false.</div><div>b) A BSP <b>defaults</b> to either true or false<i>.</i>The default value is used when a system property has no configured value.</div><div><div>c) A system property is either <b>case sensitive</b> or <b>case insensitive</b>. A case insensitive property ignores the case when comparing configured values with "true or "false".</div></div><div>d) The <b>normalized value</b> of a BSP is one of TRUE, FALSE, EMPTY or OTHER.</div><div>e) The normalized value is evaluated to true or false using a <b>definition of truth</b>. This is the set of normalized values which are considered as true. </div><div><br></div><div>Theoretically, there are 14 possible definitions of truth (sets of size 1-3). However, given that we want TRUE and FALSE be stable, there are not many practical ones, and in fact, the JDK uses only three:</div><div><br></div><div>isTrue: {TRUE} </div><div>isTrueOrEmpty: {TRUE, EMPTY} </div><div>isNotFalse: {TRUE, EMPTY, OTHER} </div><div><br></div><div>Additionally, there is the "isSet" definition which considers any set value as true, including "false".</div><div><br></div><div><b>Some stats:</b></div><div><br></div><div>Total number of BSPs found in java.base: 83</div><div><br></div><div><div><b>Default values:</b></div><div><br></div><div>Default false: 66</div><div>Default true: 17</div><div><br></div></div><div><div><b>Case sensitivity:</b></div><div><br></div><div>Case sensitive: 5</div><div>Case insensitive: 76</div><div><br></div></div><div><b>Definitions of truth:</b></div><div><br></div><div>isTrue: 61</div><div>isTrueOrEmpty: 15</div><div>isNotFalse: 5</div><div>isSet: 2</div><div><br></div><div><b>Positive or negative name:</b></div><div><br></div><div>Additionally, I looked into whether a system property name has a positive or negative name. Names such as "allow" or "enable" are considered positive, while names like "disable" or "inhibit" are considered negative:</div><div><br></div><div>Positive: 65</div><div>Negative: 8</div><div><br></div><div>Hope this was useful!</div><div><br></div><div>Thanks,</div><div>Eirik. </div><div><br></div><div> </div><div><br></div><div><br></div><div> </div></div></div>
</div>