RFR: 8370688: java.util.jar.JarEntry.getCodeSigners() and getCertificates() should specify that they return a copy of the arrays
Jaikiran Pai
jpai at openjdk.org
Wed Dec 3 09:46:07 UTC 2025
On Wed, 3 Dec 2025 09:28:39 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
> As far as I remember, we have similar text in some API specification for methods that return a copy of the array, reusing that text might be useful (I'll try and find such an instance).
`javax.net.ssl.SSLParameters` has a few APIs which word this in a couple of different ways:
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/javax/net/ssl/SSLParameters.html#getCipherSuites()
Returns:
a copy of the array of ciphersuites or null if none have been set.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/javax/net/ssl/SSLParameters.html#getApplicationProtocols()
This method will return a new array each time it is invoked.
I prefer the "a copy of the array of ..." style, but I'll let Sean and others decide how to word this.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28615#issuecomment-3605950544
More information about the core-libs-dev
mailing list