package nullnessAnnotations.returnValue;

import java.util.Collection;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.ExpectWarning;
import edu.umd.cs.findbugs.annotations.NonNull;

public class TestReturnOverride {

    void a(ACSI o) {
        o.get().toString();
    }

    static class A {
        @CheckForNull
        Object a() {
            return null;
        }
    }

    static class B extends A {
        @Override
        String a() {
            return "B";
        }

        @ExpectWarning("NP")
        int b() {
            return a().hashCode();
        }
    }

    static interface I<K, T extends I.N> {
        @CheckForNull
        T get();

        @CheckForNull
        T get(@NonNull K k);

        interface N {
        }
    }

    static interface SI<K, T> {
        @CheckForNull
        public T get();
    }

    static interface CSI<K, T> extends SI<K, Collection<T>> {
        @NonNull
        @Override
        public Collection<T> get();
    }

    static class ACSI implements CSI<Object, String> {

        @ExpectWarning("NP")
        @Override
        public Collection<String> get() {
            return null;
        }

    }

    static class AI implements I<String, AI.AN> {
        @Override
        public AN get(String k) {
            return null;
        }

        @Override
        public AN get() {
            return null;
        }

        @ExpectWarning("NP")
        int ai() {
            return get().hashCode();
        }

        @ExpectWarning("NP")
        Object ai2() {
            return get(null);
        }

        static class AN implements I.N {
        }
    }
}

@@ -72,35 +72,21 @@
 %0Aimport 
-edu.umd.cs.findbugs
+javax
 .annotat
@@ -88,17 +88,16 @@
 notation
-s
 .CheckFo
@@ -103,16 +103,50 @@
 orNull;%0A
+import javax.annotation.Nonnull;%0A%0A
 import e
@@ -195,55 +195,8 @@
 ng;%0A
-import edu.umd.cs.findbugs.annotations.NonNull;
 %0A%0Apu
@@ -717,17 +717,17 @@
 get(@Non
-N
+n
 ull K k)
@@ -927,17 +927,17 @@
     @Non
-N
+n
 ull%0A    

Move to JSR 305 annotations