bowbahdoe opened a new pull request, #1182: URL: https://github.com/apache/commons-lang/pull/1182
There is only one place in commons-lang where anything from `java.desktop` is used, and that is `AbstractCircuitBreaker`. This changes that code to lazily initialize its internal `PropertyChangeSupport`. This makes it so that it is safe to initialize and use that class without `java.desktop` on the module-path. Upsides: * Smaller jlinked images for every apache commons library * No binary compatibility changes Downsides: * Likely a small performance hit * It is possible for a user to give a `null` instance of `PropertyChangeListener` without depending on the `java.desktop` module, in which case the behavior of the method will change from "ignores null" to "fails" * I do not know how to add a test for this to the junit suite. We'd have to run a subset of the tests without `java.desktop` present. Currently I am validating manually like so ``` $ mvn clean compile package $ jlink --module-path target/commons-lang3-3.15.0-SNAPSHOT.jar --add-modules org.apache.commons.lang3,jdk.jshell --output jre $ ./jre/bin/java --list-modules [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] $ ./jre/bin/jshell jshell> var breaker = new EventCountCircuitBreaker(1000, 1, java.util.concurrent.TimeUnit.SECONDS); breaker ==> org.apache.commons.lang3.concurrent.EventCountCircuitBreaker@1ce92674 jshell> breaker.addChangeListener(null); | Error: | cannot access java.beans.PropertyChangeListener | class file for java.beans.PropertyChangeListener not found | breaker.addChangeListener(null); | ^-----------------------------^ ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
