Skip to content

fix(jdk-codemodel): replace raw String operator fields with typed enums#12

Merged
deer merged 1 commit intomainfrom
operators
Apr 8, 2026
Merged

fix(jdk-codemodel): replace raw String operator fields with typed enums#12
deer merged 1 commit intomainfrom
operators

Conversation

@deer
Copy link
Copy Markdown
Collaborator

@deer deer commented Apr 8, 2026

BitwiseBinary, PrefixUnary, PostfixUnary, and CompoundAssignment stored their operator as t.getKind().toString() — an unconstrained string that consumers had to parse to do anything meaningful with. This is the same class of problem as the string type names fixed previously.

Introduces four enums (BitwiseOperator, PrefixOperator, PostfixOperator, AssignmentOperator) covering the exact set of operators each node can hold. The converter switch expressions now map Tree.Kind directly to enum constants, making the mapping explicit and exhaustive. Marshalling preserves the wire format as String (via name()/valueOf()). Tests cover one representative operator per node type.

@deer deer merged commit 4b2c500 into main Apr 8, 2026
1 check passed
@deer deer deleted the operators branch April 8, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant