mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
IDEA-224056 - handle unused local declarations in lambda expressions
GitOrigin-RevId: 5861b958e9ca05deec08ec9ae8f271b60a6b8a16
This commit is contained in:
committed by
intellij-monorepo-bot
parent
221b986314
commit
12b7de5e77
@@ -2,8 +2,33 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>3</line>
|
||||
<line>5</line>
|
||||
<description>Variable <code>i</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>7</line>
|
||||
<description>Variable <code>k</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>10</line>
|
||||
<description>Variable <code>unusedStr1</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>13</line>
|
||||
<description>Variable <code>unusedStr3</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>18</line>
|
||||
<description>Variable <code>unusedStr5</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>21</line>
|
||||
<description>Variable <code>unusedStr7</code> is never used</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
|
||||
@@ -1,7 +1,35 @@
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
public static void main(String[] args) {
|
||||
int i = 0;
|
||||
@SuppressWarnings("unused") int j = 0;
|
||||
int k;
|
||||
|
||||
initializeCons(value -> {
|
||||
String unusedStr1 = "s";
|
||||
@SuppressWarnings("unused") String unusedStr2 = "s";
|
||||
{
|
||||
String unusedStr3;
|
||||
}
|
||||
String unusedStr4 = "str";
|
||||
initializeCons(innerValue1 -> {
|
||||
{
|
||||
String unusedStr5 = unusedStr4;
|
||||
}
|
||||
String unusedStr6 = "s";
|
||||
String unusedStr7;
|
||||
initializeSup(() -> unusedStr6);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static void initializeCons(Consumer<String> consumer) {
|
||||
consumer.accept("String to test");
|
||||
}
|
||||
|
||||
private static void initializeSup(Supplier<String> supplier) {
|
||||
supplier.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user