gwtproject / gwt

GWT Open Source Project

Home Page:http://www.gwtproject.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Explore `@JsEnum` support in GWT

niloc132 opened this issue · comments

The jsinterop-annotations 2.0 supports the JsEnum annotation, which allows Java enums to be exposed to JS as non-long primitives or strings, and likewise allows a JS namespace with named constants of the same types to be used from within Java code.

The annotation is documented as only being supported in J2CL, but unlike @JsAsync, GWT wouldn't require supporting a new version of ecmascript to handle this feature.

I've put together a preliminary implementation of this, only supporting non-native enums, and skipping a few other design choices that J2CL has made, until I understand those decisions better.

This issue is to track the implementation and design decisions that we adopt for GWT. My aim is to at least match JsEnum's explicit documentation, and evaluate J2CL's specific decisions to decide when to be exactly compatible or not.

The work done so far on this could probably be backported to 2.11, but I'm targetting 2.12 for this feature.