RFR: 8375646: Some parser flags seem unused [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Jan 19 20:02:00 UTC 2026
On Mon, 19 Jan 2026 18:04:04 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Drop redundant local var
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 1443:
>
>> 1441: switch (token.kind) {
>> 1442: case QUES:
>> 1443: if (isMode(TYPE) && isMode(TYPEARG) && !isMode(NOPARAMS)) {
>
> Not sure if I read the code right, but `TYPEARG` is never set, so `isMode(TYPEARG)` is always `false`, and the whole "then" section of the if should be removed and only the "else" section preserved? Or, quite possibly, the this whole `case QUES` can be removed (and `?` handled by `default`)?
yeah -- I believe you are correct -- we should never attempt to parse a type argument here. Since TYPEARG was never set, we just can't enter this branch.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29302#discussion_r2705941852
More information about the compiler-dev
mailing list