Hi all, iwas fianlly enable to have the time to read the spec, yay ! In section 8.10.3:: - what if the record implements an interface with a default method that provides an implementation for a getter. Currently this implementation is ignored but i don't know if it's surprising or not. Maybe we should ask explicitly for the user providing an implementation of the getter in that case ?
So this example should not compile ? interface I { default int x() { System.out.println("foo"); return -1; } } record Foo(int x) implements I { } In section 8.10.4: - why the constructor has to be public, if the record is used inside the class, i don't want someone to be able to instantiate it by reflection. public class PublicConstructorProblem { private record Foo(int x) { } public static Object foo() { return new Foo(42); } public static void main(String[] args) throws Exception { Object o = foo(); Object o2 = o.getClass().getConstructor(int.class).newInstance(43); System.out.println(o2); } } - a canonical constructor can not have throws clause (from the text of the section) but the grammar in 8.10.2 the CompactConstructor declaration can have a throw clause ? - the allowed modifier for a compact constructor should be explicitly listed By example, i believe strictfp or synchronized should be allowed public record StrictFP() { public strictfp StrictFP { } } but the current prototype rejects that code. regards, Rémi > De: "Gavin Bierman" <gavin.bier...@oracle.com> > À: "amber-spec-experts" <amber-spec-experts@openjdk.java.net> > Envoyé: Vendredi 23 Août 2019 23:25:05 > Objet: Draft JLS spec for records > A draft language spec for records is available at: > [ > http://cr.openjdk.java.net/~gbierman/8222777/8222777-20190823/specs/records-jls.html > | > http://cr.openjdk.java.net/~gbierman/8222777/8222777-20190823/specs/records-jls.html > ] > This spec doesn’t yet discuss varargs records - to appear in the next draft. > All comments welcomed! > Thanks, > Gavin