I had the same problem with this code:
@Test public void testSomething() { @SuppressWarnings("unused") @SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE") final SomeMockClass mock = new SomeMockClass(); ... } }
@SuppressFBWarnings doesn't work here.
The solution here was to move @SuppressFBWarnings to the method level:
@Test @SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE") public void testSomething() { @SuppressWarnings("unused") final SomeMockClass mock = new SomeMockClass(); ... } }
I like to limit the volume of these annotations as little as possible, so they do not suppress real problems. Here, it seems necessary to annotate the whole method.
source share