RFR: 8299193: Declare Buffer.capacity final

Roger Riggs rriggs at openjdk.org
Thu Dec 22 17:37:48 UTC 2022


On Wed, 21 Dec 2022 12:22:33 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> It is possible to declare the field `capacity` in `java.nio.Buffer` `final` as the value never changes outside the constructors.

The contribution of capacity being final is minimal in the perf results, being only used as the limit in the for-loops. Regardless, the field should be final.
Thanks

-------------

Marked as reviewed by rriggs (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11755


More information about the nio-dev mailing list