RFR: 8329951: `var` emits deprecation warnings that do not point to the file or position [v2]
Archie Cobbs
acobbs at openjdk.org
Mon Jun 2 23:46:16 UTC 2025
On Mon, 2 Jun 2025 23:19:36 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>>
>> - Merge branch 'master' into JDK-8329951
>> - Fix bug where some warnings didn't have a source file position.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java line 369:
>
>> 367:
>> 368: boolean isImplicitlyTyped(JCVariableDecl decl) {
>> 369: return decl.declaredUsingVar();
>
> an argument of an implicit lambda is implicitly typed but not declared using `var`, I guess we should at least add a note to this method
In fact, this method `isImplicitlyTyped()` is misleadingly named - it appears to be simply testing for whether the variable is declared using `var` (and so maybe it should have been named `isDeclaredUsingVar()`).
But now that `JCVariableDecl.declaredUsingVar()` exists, we can just use that method directly and get rid of the intermediate method, which is not adding any value.
See if 151d9882bef looks better - thanks.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23683#discussion_r2122342164
More information about the compiler-dev
mailing list