On Sat, 26 Sep 2020 00:52:38 GMT, Weijun Wang <wei...@openjdk.org> wrote:
>> src/java.base/share/classes/sun/security/util/DerValue.java line 1154: >> >>> 1152: * @return a new DerValue >>> 1153: */ >>> 1154: public DerValue withTag(byte newTag) { >> >> Seems like a somewhat dangerous method. The value may not match the new tag? >> The caller is expected to know what it's >> doing? > > I intend to use it to turn back IMPLICIT element to its original tag, > otherwise getXyz() calls would fail because they > are checking the tag. In the old design, checking the tag (in DerValue) and > reading the value (in DerInputBuffer) are > separated but now they are in a single method (in DerValue). The caller > pattern should always look like > `withTag(INTEGER).getInteger()`. Hmm, I see, maybe add more comments then. ------------- PR: https://git.openjdk.java.net/jdk/pull/232