Inline Record

Brian Goetz brian.goetz at oracle.com
Wed May 6 22:42:16 UTC 2020


Eventually, inline classes will inherit eq/hashCode from Object.

On 5/6/2020 6:13 PM, Remi Forax wrote:
> records adds equals/hashCode/toString and inline adds equals/hashCode/toString,
> so what an inline record does ?
>    @__inline__ record Foo(int x) {}
>
> answer, you get all methods twice.
>
> javac --enable-preview --source 15 Hello.java
> Hello.java:2: error: method hashCode() is already defined in record Foo
>    @__inline__ record Foo(int x) {}
>                ^
> In my opinion, records and inline should use the same BSM, so if an inline is already a record, no need to add the methods again.
>
> regards,
> Rémi



More information about the amber-dev mailing list