Skip to content

Commit e033190

Browse files
xdavidwugeorgewfraser
authored andcommitted
test(WarningsTest): add cases for interface/abstract/native throws
1 parent 4cb2aa1 commit e033190

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/test/examples/maven-project/src/org/javacs/warn/Unused.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,14 @@ void referenceUsedByUnusedVar() {
4444
}
4545

4646
void notActuallyThrown() throws Exception { }
47-
}
47+
48+
interface Throws {
49+
void interfaceThrows() throws Exception;
50+
}
51+
52+
abstract class AbstractThrows {
53+
abstract void abstractThrows() throws Exception;
54+
}
55+
56+
native void nativeThrows() throws Exception;
57+
}

src/test/java/org/javacs/WarningsTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ public void unused() {
9393
assertThat(errors, hasItem("unused_method(34)")); // private void unusedMutuallyRecursive2() { ... }
9494
assertThat(errors, not(hasItem("unused_method(38)"))); // private int usedByUnusedVar() { ... }
9595
assertThat(errors, hasItem("unused_throws(46)")); // void notActuallyThrown() throws Exception { }
96+
assertThat(errors, not(hasItem("unused_throws(49)"))); // void interfaceThrows() throws Exception;
97+
assertThat(errors, not(hasItem("unused_throws(53)"))); // abstract void abstractThrows() throws Exception;
98+
assertThat(errors, not(hasItem("unused_throws(56)"))); // native void nativeThrows() throws Exception;
9699
}
97100

98101
@Test

0 commit comments

Comments
 (0)