Interesting generic related differences between javac and the eclipse ide compiler

I have an interesting difference between javac and the eclipse ide compiler, and I can't figure out who is right Therefore, the following code is compiled in javac, but eclipse tells me that it is wrong for the static initializer to call "exportall". The reason is:

Who is right? Javac or eclipse?

import java.util.Map;

public class X {
  interface Stat<T> {
  }

  public static void exportAll(Iterable<Stat<? extends Number>> vars) {
  }

  public static Map<Double,? extends Stat> getpercentiles() {
    return null;
  }

static {
  exportAll(getpercentiles().values());
}

}

Solution

It cannot be compiled in javac (add static after getpercentiles)

Understand the facts directly; Don't waste other people's time

Today's children, add too much

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>