Copilot commented on code in PR #3999:
URL: 
https://github.com/apache/incubator-kie-tools/pull/3999#discussion_r4005371669


##########
packages/drools-lsp/drools-completion/src/main/java/org/drools/completion/DeclaredType.java:
##########
@@ -51,4 +52,21 @@ public class DeclaredType {
         this.nameCol = nameCol;
         this.extendsName = extendsName;
     }
+
+    /**
+     * The constants of a declared enum — the fields carrying the enum's own
+     * name as their type — or an empty list for a non-enum declare.
+     */
+    List<Field> enumConstants() {
+        if (!isEnum) {
+            return List.of();
+        }
+        List<Field> constants = new ArrayList<>();
+        for (Field field : fields) {
+            if (name.equals(field.type)) {
+                constants.add(field);

Review Comment:
   Type equality does not uniquely identify enum constants. A valid declared 
enum may have an ordinary self-typed field such as `next : Color`; this helper 
then offers `Color.next` as a static constant and hover accepts that illegal 
access. Mark parsed enumeratives with `Field.Origin.ENUM_CONSTANT` and filter 
on that origin here instead.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to