Shevek (shevek) wrote,

Today I learned of the existence of the little used syntax for a conjunctive type bound <T extends Foo & Bar>. It seems that if one is a class and one an interface, the class must be specified first; also as documented, the erasure is the first specified type. This means that you cannot erase to an interface if you need a class in the conjunction.

I have also decided that other than in cases where one is updating a backwards compatible library where strict control of the erasure of an interface is required, this syntax should not be used because there is always a better solution.
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.