checker-framework
checker-framework copied to clipboard
isVariableTreeDeclaredUsingVar assumes var types don't have start positions, is broken by changes in JDK-8329951
isVariableTreeDeclaredUsingVar assumes that the type of a VariableTree declared using var will not have a start position set:
https://github.com/typetools/checker-framework/blob/988f6fc5204337da25d85dc0e7433eaf5d6068c5/javacutil/src/main/java/org/checkerframework/javacutil/TreeUtils.java#L2588-L2591
After an upcoming javac change in https://github.com/openjdk/jdk/commit/e2f736658fbd03d2dc2186dbd9ba9b13b1f1a8ac, start positions are set for types of variables declared using var, so this approach no longer works.
isVariableTreeDeclaredUsingVar could be fixed by also checking for JCVariableDecl#declaredUsingVar
The relevant upstream bugs are:
- https://bugs.openjdk.org/browse/JDK-8329951 (JDK 25), adds start position information to variable tree types for
var - https://bugs.openjdk.org/browse/JDK-8358604 (pending), may add end positions