Skip to content

Add new import schema with path, is_static, and is_wildcard fields#144

Merged
sinha108 merged 2 commits into
codellm-devkit:mainfrom
tylerstennett:feat/java-import-model
Mar 5, 2026
Merged

Add new import schema with path, is_static, and is_wildcard fields#144
sinha108 merged 2 commits into
codellm-devkit:mainfrom
tylerstennett:feat/java-import-model

Conversation

@tylerstennett

Copy link
Copy Markdown
Contributor

These changes replace the flat, lossy string-based import representation (List<String>) with a structured Import object containing path, is_static, and is_wildcard fields. They also add a legacy schema detection guard that rejects old analysis.json files with a clear error message.

Additionally, after running into some problems with existing integration tests, there are fixes to integration test assertions to be structure-aware rather than relying on fragile string matching.

Motivation and Context

The previous import model only stored the import path as a plain string, losing information about whether imports were static or wildcard. This change enriches the schema so that each import carries its full semantics.

How Has This Been Tested?

New SymbolTableTest.testExtractSingleImportMetadata validates parsing of regular, wildcard, static, and static-wildcard imports, including JSON serialization shape. Also, new CodeAnalyzerTest tests legacy schema rejection (testReadSymbolTableFromFileRejectsLegacyImportSchema) and correct parsing of the new schema (testReadSymbolTableFromFileParsesExplicitImportSchema).

Breaking Changes

Yes. Consumers that read the imports array as strings will need to update. By design, loading a pre-2.3.7 analysis.json via --input will now fail with an error asking the user to regenerate.

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

  • Version bumped from 2.3.6 to 2.3.7 in gradle.properties.
  • The hasLegacyImportSchema guard in CodeAnalyzer.java detects old files by checking if any import element is a JSON primitive string, and throws IllegalStateException with an actionable message.

@tylerstennett tylerstennett changed the title Improve import schema with path, is_static, and is_wildcard fields. Add new import schema with path, is_static, and is_wildcard fields. Mar 5, 2026
@tylerstennett tylerstennett changed the title Add new import schema with path, is_static, and is_wildcard fields. Add new import schema with path, is_static, and is_wildcard fields Mar 5, 2026
@sinha108 sinha108 merged commit 7d09491 into codellm-devkit:main Mar 5, 2026
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