Inspectopedia Help

Local variable type can be omitted

Reports redundant local variable types.

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

Example:

void test(InputStream s) { try (InputStream in = s) {} }

After the fix is applied:

void test(InputStream s) { try (var in = s) {} }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023