Skip to content

feat: emit per-variable field initializers in field declarations#145

Merged
sinha108 merged 1 commit into
codellm-devkit:mainfrom
tylerstennett:feat/java-field-var-initializers
Jun 5, 2026
Merged

feat: emit per-variable field initializers in field declarations#145
sinha108 merged 1 commit into
codellm-devkit:mainfrom
tylerstennett:feat/java-field-var-initializers

Conversation

@tylerstennett

Copy link
Copy Markdown
Contributor

Added a variable_initializers field to the Field entity that records each declared variable's field expression as source text.

Motivation and Context

Field initializers were not included in the old model, so constant values were unrecoverable by consumers, even though JavaParser already exposes them. I added a new field which maps each variable name to its initializer expression, and left the expression text unprocessed so interpretation can be done maximally by downstream consumers.

How Has This Been Tested?

There's a new test case in the SymbolTableTest class which covers various types of field declarations.

Breaking Changes

There should be no breaking changes. The changes are purely additive.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the Codellm-Devkit Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

I bumped the version to 2.3.8. I also used a LinkedHashMap to preserve insertion order, so the initializers should serialize in declaration order deterministically.

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.

2 participants