lsp4jakarta icon indicating copy to clipboard operation
lsp4jakarta copied to clipboard

JEE11_Data: Diagnostics for Enum Literals in operators

Open archana-1924 opened this issue 1 month ago • 0 comments

Diagnostic Messages:

  • Enum literal expressions may only appear as the right operand of a set assignment or equality comparison.
  • The left operand must be a Java enum type, and the literal must be a fully qualified enumerated value.

Description: 

An enum literal expression may only occur as the right operand of:

  • A set assignment, or an equality comparison (= or <>).
  • The type of the expression is assigned from the left operand, which must be a Java enum type.
  • The identifier must be the fully qualified name of an enumerated value of that enum type.

Examples:

Invalid example

java.time.DayOfWeek.MONDAY = day 

Valid example

day <> java.time.DayOfWeek.MONDAY 

Specification: 

https://jakarta.ee/specifications/data/1.0/jakarta-data-1.0#:~:text=An%20enum%20literal%20expression%20is%20a%20Java%20identifier%2C%20with%20syntax%20specified%20by%20enum_literal%2C%20and%20may%20only%20occur%20as%20the%20right%20operand%20of%20a%20set%20assignment%20or%20%3D/%3C%3E%20equality%20comparison.%20It%20is%20assigned

Type of language feature proposed:

Select all that apply

  • [x] diagnostic
  • [ ] quick-fix
  • [ ] snippet
  • [ ] other, please specify:

archana-1924 avatar Nov 21 '25 04:11 archana-1924