Syntax for calling super

Paul Benedict pbenedict at apache.org
Wed Aug 22 14:41:40 PDT 2012


This syntax caught my eye:

interface K {
  int m() default { return 88; }
}

interface J extends K {
  int m() default { return K.super.m(); }
}

I really don't think it is is appropriate to code "K.super.m()". An
natural English reading of "K.super" would be "superclass of K" since
it is K that is qualified.... but that's not what the code intends to
be.

I would recommend a casting syntax to make the intention clearer:
interface J extends K {
  int m() default { return ((K) super).m(); }
}

Paul


More information about the lambda-dev mailing list