[records] customized accessor returning subtype

Dmitry Bessonov dmitry.bessonov at oracle.com
Mon Dec 9 19:09:59 UTC 2019


Is there any reason for not allowing a customized accessor to return rc subtype:

record R(Number number) {
    public Integer number() {
        return 42;
    }
}

Error: java: invalid accessor method in record R
  (return type of accessor method number() is not compatible with type of record component number)


dmitry



More information about the amber-dev mailing list