Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8065219

Deprecated warning in method reference are missing in some cases.

XMLWordPrintable

    • b86
    • Verified

        There are some cases, in which deprecated warnings are expected but are missing.

        First mini case:
        Method reference of void method:
        class A {
            @Deprecated
            public static int foo(){ return 1;}

            public void run(){
                Func b = A::foo;
            }
        }
        @FunctionalInterface
        interface Func{
            int meth();
        }

        Second mini case:
        Method reference of constructor:
        class A {
            
            public void run(){
                Func b = Deprec::new;
            }
        }
        @FunctionalInterface
        interface Func{
            Deprec meth();
        }

        class Deprec {
            @Deprecated
            public Deprec(){}
        }

        First case works only if method foo() and run() are in the same class,
        but second works only if constructor and run() are from different classes.

              sadayapalam Srikanth Adayapalam (Inactive)
              kbarzilovich Konstantin Barzilovich (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: