RFR: 8249783: Simplify DerValue and DerInputStream [v2]

Weijun Wang weijun at openjdk.java.net
Tue Sep 29 05:32:17 UTC 2020


On Tue, 29 Sep 2020 02:46:48 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> public for compatibility, and final because it won't need to change. I'll see how many `@deprecated` I can add. Or,
>> I'll see if I can move all will-be-deprecated code together.
>
> Yeah, it'd be nice if all will-be-deprecated code are together. Easier to spot and less chance for them to be picked up
> and used.

I'll try to put the will-be-deprecated field and methods together. There are still other methods referencing them for
compatibility.

>> There are a lot of classes calling this method and it's different from `data()`. `data()` returns a new stream always
>> pointing to the 1st sub-value in the content, but `getData()` returns the data field which could advance after a read
>> call. This means you can call `getData().getDerValue()` to read the 1st sub-value, and then `getData().getDerValue()`
>> again to read the 2nd. Quite unobvious but the actual behavior. I can add some comments. I named the new method
>> `data()` because I want the future nice-behavior method looks simple.
>
> Both the data field and `getData()`are public and seems interchangeable (redundant?). With this new method named
> data(), it sounds like a replacement for the data field which I am not sure if this is your intention or not. Do we
> really needs data()? There is the subs() method for returning the sub values, no?

I suggest future app uses data() only. subs() might not be easy to use (Ex: when dealing with OPTIONAL fields),
otherwise DerInputStream will be useless.

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

PR: https://git.openjdk.java.net/jdk/pull/232



More information about the security-dev mailing list