On Wed, 21 Oct 2026 14:58:51 GMT, Matthias Baesken <[email protected]> wrote:

> While testing new MSVC warning flags, a number of unused but initialized 
> variables in java.desktop have been found.
> A lot of them can be removed. A few are needed for special build variants 
> like (fast)debug only so they have to stay.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp line 76:

> 74:     int length = env->GetStringLength(filterDescription);
> 75:     DASSERT(length + 1 < MAX_FILTER_STRING);
> 76: #endif

how is this un-used ?

src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp line 1742:

> 1740:     }
> 1741: 
> 1742:     [[maybe_unused]] int technology = GetDeviceCaps(realHDC, 
> TECHNOLOGY);

why did you not delete this one ?

src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp line 1818:

> 1816:         bitMapHeader.bmiHeader.biCompression = BI_RGB;
> 1817: 
> 1818:         [[maybe_unused]] int result =

why, in these cases, do you need [[maybe_unused]] for these return values, but 
not at line 1675 -- above -- in the same source file ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33495#discussion_r4416392472
PR Review Comment: https://git.openjdk.org/jdk/pull/33495#discussion_r4416416539
PR Review Comment: https://git.openjdk.org/jdk/pull/33495#discussion_r4416435123

Reply via email to