Overloads warnings overly agressive?
Henry Jen
henry.jen at oracle.com
Tue Sep 24 18:17:55 UTC 2013
Forgot that attachment is not allowed, the test code is following,
> public class TestOverload {
> interface Foo<T> {
> void m(T arg);
> }
>
> interface IntFoo {
> void m(int arg);
> }
>
> interface Bar<T> {
> void bar(Foo<T> arg);
> }
>
> interface IntBar extends Bar<Integer> {
> @SuppressWarnings("overloads")
> default void bar(IntFoo arg) {
> System.out.print("Primitive: ");
> }
>
> @SuppressWarnings("overloads")
> default void bar(Foo<Integer> arg) {
> System.out.print("Boxed: ");
> bar((IntFoo) arg::m);
> }
> }
>
> public static void main(String[] args) {
> class Impl implements IntBar {
> @Override
> public void bar(IntFoo foo) {
> IntBar.super.bar(foo);
> System.out.print("Overload: ");
> for (String arg: args) {
> Integer n = Integer.valueOf(arg);
> foo.m(n.intValue());
> }
> }
> }
> Impl impl = new Impl();
> impl.bar((int n) -> System.out.println(n + 100));
> impl.bar((Integer n) -> System.out.println(n));
> }
> }
On Sep 24, 2013, at 11:11 AM, Henry Jen <henry.jen at oracle.com> wrote:
> Hi,
>
> I had reported this issue with attached test with behavior I observed, Brian and me agreed that SuppressWarnings on either one as in this test case should be sufficient.
>
> Cheers,
> Henry
>
More information about the core-libs-dev
mailing list