Inspectopedia
 
2024.3

Local variable type can be omitted

Info
New
Last modified: 03 December 2024

Reports redundant local variable types.

These types can be inferred from the context and thus replaced with var.

Example:

After the fix is applied:

This inspection depends on the Java feature 'Local variable type inference', which is available since Java 10.