On Wed, Dec 4, 2024 at 3:47 PM Eirik Bjørsnøs <eir...@gmail.com> wrote:
> 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. > 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: First, some definitions: a) A *boolean system property *(BSP) is one whose value is evaluated to either true or false. b) A BSP *defaults* to either true or false*.*The default value is used when a system property has no configured value. c) A system property is either *case sensitive* or *case insensitive*. A case insensitive property ignores the case when comparing configured values with "true or "false". d) The *normalized value* of a BSP is one of TRUE, FALSE, EMPTY or OTHER. e) The normalized value is evaluated to true or false using a *definition of truth*. This is the set of normalized values which are considered as true. 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: isTrue: {TRUE} isTrueOrEmpty: {TRUE, EMPTY} isNotFalse: {TRUE, EMPTY, OTHER} Additionally, there is the "isSet" definition which considers any set value as true, including "false". *Some stats:* Total number of BSPs found in java.base: 83 *Default values:* Default false: 66 Default true: 17 *Case sensitivity:* Case sensitive: 5 Case insensitive: 76 *Definitions of truth:* isTrue: 61 isTrueOrEmpty: 15 isNotFalse: 5 isSet: 2 *Positive or negative name:* 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: Positive: 65 Negative: 8 Hope this was useful! Thanks, Eirik.