Open niloc132 opened 7 months ago
I've rewritten this PR to only modify JsProperty, so that they make sense on record accessors.
record Point(@JsProperty int x, @JsProperty int y) {}
In the above example, without this change, the @JsProperty
annotation applies both to the private final int x
and public int x() {return this.x;}
that Java generates for you, which would be wrong for two reasons - the method doesn't follow JavaBean naming conventions (and must not), and both field and method have the same name (which would collide in JS).
Any thoughts on this downscoped set of changes to resolve the contradiction presented by annotations on record components?
For the essence of proposed change: yes we wouldn't let such conflict happen. Being said that talking about record types without supporting them would b e misleading at the moment. I think we should evaluate this all pieces together and update the annotations/documentation etc with the right wording when we actually start working on supporting record types.
Does not attempt to address native support - like enums, if this is to be supported, it will likely require its own annotation and semantics.
Fixes #6