On Sat, 15 Jun 2024 03:22:47 GMT, Ethan McCue <d...@openjdk.org> wrote:
> To reiterate, I'm still not the biggest fan of the constant names given > > * The parameter name they are being used for is `responseLength`. "The > responseLength is CHUNKED_CONTENT" feels jank and `lengthOrChunked` doesn't > inspire joy. > > * I'm not convinced the audience that we presumably care the most about > for this API won't be helped too much by them I posted a response to this and then deleted it because I hadn't considered your suggestion of changing the parameter name. I think the biggest win this change can achieve (for the least impact) is to reduce the easy to make error of using the value 0 to mean zero length. I agree it's not ideal that the constants have CONTENT in their name. But, the alternative of using something like LENGTH would see us define a constant like this public static final int ZERO_LENGTH = -1; which would provoke even more confusion (if not worse) imo. I suggest we stick with the constant names but refer to them explicitly in the apidoc for sendResponseHeaders along the lines I suggested above. But, also change the name of the parameter from `responseLength` to something more generic like `responseBody`. That would force the developer to read further to learn that values > 0 mean an explicit number of bytes but there are two additional symbolic values which denote no content, and chunked content. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18955#issuecomment-2180230303