On Mon, 26 Jan 2026 12:09:47 GMT, Liam Miller-Cushon <[email protected]> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java line 
>> 675:
>> 
>>> 673:             case PREINC:
>>> 674:             case PREDEC:
>>> 675:                 return getEndPos(((JCOperatorExpression) 
>>> tree).getOperand(RIGHT));
>> 
>> Is this big switch still needed? When would an end position not be set in 
>> this new world?
>
> `JavacParser` is still only recording end positions for the trees where it 
> calls `storeEnd`, so the same kinds of trees have end positions recorded in 
> the new world. I think that potentially `JavacParser` could start recording 
> end positions for all trees, and then this switch could be removed. I will 
> investigate that more. If it works out, I wonder if it might be better as a 
> separate follow-up change, to keep the initial refactoring to remove the end 
> pos table as behaviour preserving as possible. What do you think?

I think it's ok to start simple and refine as we go. As part of this change it 
would be perhaps helpful to at least simplify the method so that "unreachable 
cases" are removed?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28610#discussion_r2728246474

Reply via email to