RFR: 8294062: Improve parsing performance of j.l.c.MethodTypeDesc

Paul Sandoz psandoz at openjdk.org
Wed Sep 21 15:13:14 UTC 2022


On Wed, 21 Sep 2022 08:38:19 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/constant/ConstantUtils.java line 217:
>> 
>>> 215:                             }
>>> 216:                             case '/' -> {
>>> 217:                                 if (!legal) return 0;
>> 
>> IIUC that works to reject `//` and trailing `/`, but does not reject leading `/`? which the previous code rejected.
>
> `legal` is initially set to false, so leading `/` is also rejected

Doh! Could you add a comment with the case block, something like?
// Rejects a leading `/`, any "//", and a trailing '/' (by exit from the loop)

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

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


More information about the core-libs-dev mailing list