Inline Record

Remi Forax forax at univ-mlv.fr
Wed May 6 22:13:02 UTC 2020


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