mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
java [unused declaration] - switch on functional ref nodes
GitOrigin-RevId: b79fa6d91931bcc2c47f6f363f4a099736000d44
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b2bbb963d6
commit
4572835609
@@ -1,5 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>Lambda_UnusedMethod.java</file>
|
||||
<line>12</line>
|
||||
<description>Method is never used.</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>MethodRef_UnusedMethod.java</file>
|
||||
<line>12</line>
|
||||
<description>Method is never used.</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Lambda_UnusedMethodInHierarchy.java</file>
|
||||
<line>12</line>
|
||||
|
||||
+6
-2
@@ -1,10 +1,14 @@
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
final Memento m = () -> isPlaying;
|
||||
final Memento m = () -> isPlaying();
|
||||
System.out.println(m);
|
||||
}
|
||||
|
||||
private static boolean isPlaying() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static interface Memento {
|
||||
boolean isPlaying();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,105 @@
|
||||
<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>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>26</line>
|
||||
<description>Variable <code>unusedStr8</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>27</line>
|
||||
<description>Variable <code>unusedStr9</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>34</line>
|
||||
<description>Variable <code>unusedStr10</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>35</line>
|
||||
<description>Variable <code>unusedStr11</code> is never used</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>Lambda.java</file>
|
||||
<line>6</line>
|
||||
<description>Field has no usages.</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Lambda.java</file>
|
||||
<line>7</line>
|
||||
<description>Variable <code>i1</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Lambda.java</file>
|
||||
<line>12</line>
|
||||
<description>Variable <code>i3</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Lambda.java</file>
|
||||
<line>24</line>
|
||||
<description>Variable <code>i1</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Lambda.java</file>
|
||||
<line>29</line>
|
||||
<description>Variable <code>i3</code> is never used</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>AnonymousClass.java</file>
|
||||
<line>6</line>
|
||||
<description>Field has no usages.</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>AnonymousClass.java</file>
|
||||
<line>10</line>
|
||||
<description>Variable <code>i1</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>AnonymousClass.java</file>
|
||||
<line>21</line>
|
||||
<description>Variable <code>i3</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>AnonymousClass.java</file>
|
||||
<line>39</line>
|
||||
<description>Variable <code>i1</code> is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>AnonymousClass.java</file>
|
||||
<line>50</line>
|
||||
<description>Variable <code>i3</code> is never used</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
|
||||
@@ -1,7 +1,51 @@
|
||||
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);
|
||||
|
||||
class Local {
|
||||
void test() {
|
||||
String unusedStr8;
|
||||
String unusedStr9 = "Str";
|
||||
}
|
||||
}
|
||||
new Local().test();
|
||||
|
||||
Local o = new Local() {
|
||||
void test() {
|
||||
String unusedStr10;
|
||||
String unusedStr11 = "Str";
|
||||
}
|
||||
}
|
||||
System.out.println(o);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static void initializeCons(Consumer<String> consumer) {
|
||||
consumer.accept("String to test");
|
||||
}
|
||||
|
||||
private static void initializeSup(Supplier<String> supplier) {
|
||||
supplier.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
interface Unused {
|
||||
boolean test();
|
||||
}
|
||||
|
||||
class Test {
|
||||
Unused lambda1 = new Unused() {
|
||||
|
||||
@java.lang.Override
|
||||
public boolean test() {
|
||||
int i1 = 1;
|
||||
Unused lambda2 = new Unused() {
|
||||
|
||||
@java.lang.Override
|
||||
public boolean test() {
|
||||
int i2 = 1;
|
||||
Unused lambda3 = new Unused() {
|
||||
|
||||
@java.lang.Override
|
||||
public boolean test() {
|
||||
System.out.println(i2);
|
||||
int i3 = 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
System.out.println(lambda3);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
System.out.println(lambda2);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public static void main(String[] args) {
|
||||
bar(new Unused() {
|
||||
|
||||
@java.lang.Override
|
||||
public boolean test() {
|
||||
int i1 = 1;
|
||||
Unused lambda2 = new Unused() {
|
||||
|
||||
@java.lang.Override
|
||||
public boolean test() {
|
||||
int i2 = 1;
|
||||
Unused lambda3 = new Unused() {
|
||||
|
||||
@java.lang.Override
|
||||
public boolean test() {
|
||||
System.out.println(i2);
|
||||
int i3 = 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
System.out.println(lambda3);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
System.out.println(lambda2);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void bar(Unused unused) {
|
||||
unused.test();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
interface Unused {
|
||||
boolean test();
|
||||
}
|
||||
|
||||
class Test {
|
||||
Unused lambda1 = () -> {
|
||||
int i1 = 1;
|
||||
Unused lambda2 = () -> {
|
||||
int i2 = 1;
|
||||
Unused lambda3 = () -> {
|
||||
System.out.println(i2);
|
||||
int i3 = 1;
|
||||
return true;
|
||||
}
|
||||
System.out.println(lambda3);
|
||||
return false;
|
||||
};
|
||||
System.out.println(lambda2);
|
||||
return false;
|
||||
};
|
||||
|
||||
public static void main(String[] args) {
|
||||
bar(() -> {
|
||||
int i1 = 1;
|
||||
Unused lambda2 = () -> {
|
||||
int i2 = 1;
|
||||
Unused lambda3 = () -> {
|
||||
System.out.println(i2);
|
||||
int i3 = 1;
|
||||
return true;
|
||||
}
|
||||
System.out.println(lambda3);
|
||||
return false;
|
||||
};
|
||||
System.out.println(lambda2);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
static void bar(Unused unused) {
|
||||
unused.test();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user