RFR: 8249783: Simplify DerValue and DerInputStream [v2]
Valerie Peng
valeriep at openjdk.java.net
Tue Sep 29 03:55:58 UTC 2020
On Sat, 26 Sep 2020 00:18:11 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> src/java.base/share/classes/sun/security/util/DerValue.java line 446:
>>
>>> 444: }
>>> 445:
>>> 446: public final DerInputStream getData() {
>>
>> Mark this method as deprecated javadoc tag? Is it possible to just change this method impl with the new impl under
>> data()? The data field is already public, can't we just update the impl of this method? Having the data field,
>> getData() method and now data() looks very confusing.
>
> 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?
-------------
PR: https://git.openjdk.java.net/jdk/pull/232
More information about the security-dev
mailing list