summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2019-01-05 13:20:05 -0800
committerGeorge Fraser <george@fivetran.com>2019-01-05 13:20:05 -0800
commit9d0a24f07815030b3a0738475f2084b152d78796 (patch)
treeaf22b724bdf34df84e5499926e33d6f42863a7ee
parent9b5383d79cb759b40f74a072c0e34debd253db83 (diff)
downloadjava-language-server-9d0a24f07815030b3a0738475f2084b152d78796.zip
Warn on unused privates
-rw-r--r--src/test/java/org/javacs/WarningsTest.java3
-rw-r--r--src/test/test-project/workspace/src/org/javacs/warn/Unused.java2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/test/java/org/javacs/WarningsTest.java b/src/test/java/org/javacs/WarningsTest.java
index 7619f25..696eed2 100644
--- a/src/test/java/org/javacs/WarningsTest.java
+++ b/src/test/java/org/javacs/WarningsTest.java
@@ -31,7 +31,8 @@ public class WarningsTest {
@Test
public void unusedLocal() {
server.reportErrors(List.of(FindResource.uri("org/javacs/warn/Unused.java")));
- assertThat(errors, hasItem("unused(5)"));
+ assertThat(errors, hasItem("unused(5)")); // int unusedLocal
+ assertThat(errors, hasItem("unused(8)")); // int unusedPrivate
assertThat(errors, not(hasItem("unused(4)")));
}
}
diff --git a/src/test/test-project/workspace/src/org/javacs/warn/Unused.java b/src/test/test-project/workspace/src/org/javacs/warn/Unused.java
index f03012d..94e04b7 100644
--- a/src/test/test-project/workspace/src/org/javacs/warn/Unused.java
+++ b/src/test/test-project/workspace/src/org/javacs/warn/Unused.java
@@ -4,4 +4,6 @@ class Unused {
void test(int unusedParam) {
int unusedLocal = 1;
}
+
+ private int unusedPrivate;
} \ No newline at end of file