@@ -0,0 +1,925 @@
+package sfBugsNew;%0A%0Aimport annotations.DetectorUnderTest;%0Aimport edu.umd.cs.findbugs.annotations.DesireNoWarning;%0Aimport edu.umd.cs.findbugs.annotations.ExpectWarning;%0Aimport edu.umd.cs.findbugs.annotations.NoWarning;%0Aimport edu.umd.cs.findbugs.detect.UnreadFields;%0A%0A@DetectorUnderTest(UnreadFields.class)%0Apublic final class Bug1307 %7B%0A%0A    // Findbugs has an issue with javac Java 8 compiled code here.%0A    // Compiling the code with ecj target 8 or javac 8 but target 7 is OK.%0A    // @NoWarning(%22UWF_UNWRITTEN_FIELD%22)%0A    @DesireNoWarning(%22UWF_UNWRITTEN_FIELD%22)%0A    private static final String NOBUG = %22nobug%22;%0A%0A    public static boolean bug(String s) %7B%0A        return %22nobug%22.equals(s.isEmpty() ? NOBUG : s);%0A    %7D%0A%0A    @ExpectWarning(%22UWF_UNWRITTEN_FIELD%22)%0A    private static String BUG;%0A%0A    public static boolean bug2(String s) %7B%0A        return %22bug%22.equals(s.isEmpty() ? BUG : s);%0A    %7D%0A%0A    private Bug1307() %7B%0A    %7D%0A%7D

Test case for bug #1307: false positive for UWF_UNWRITTEN_FIELD on Java 8 compiled code