You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could be wrong but I did not find documentation for a @EnumVal
The concept is not too far-fetched: one wants to enforce domain, co-domain, and range:
Example of use case:
import javax.lang.model.type.TypeKind;
static @EnumVal({TypeKind.BYTE,
TypeKind.BOOLEAN,
TypeKind.CHAR,
TypeKind.DOUBLE,
TypeKind.FLOAT,
TypeKind.INT,
TypeKind.LONG}) TypeKind toPrimitiveTypeKind(...)
...
static int fromPrimitiveTypeKind( @EnumVal({TypeKind.BYTE,
TypeKind.BOOLEAN,
TypeKind.CHAR,
TypeKind.DOUBLE,
TypeKind.FLOAT,
TypeKind.INT,
TypeKind.LONG}) TypeKind tk) {...)
The text was updated successfully, but these errors were encountered:
This is probably related to #2156. I agree that it would be useful for the Value Checker to support an @EnumVal annotation; see e.g. this comment in a third-party checker, which describes a desire to write annotations in a stub file on enum constants. The linked CF issue (#2147) was closed in favor of the more general #2156.
While the topic of #2156 is Enum, it is about something else.
My interest here is to clamp the domain of arguments to functions and clamp their return values.
I agree that this is a valuable enhancement, and that it's unrelated to #2156.
I don't think this would be very challenging to do: the logic should be very similar to the other *Val annotations.
I could be wrong but I did not find documentation for a
@EnumVal
The concept is not too far-fetched: one wants to enforce domain, co-domain, and range:
The text was updated successfully, but these errors were encountered: