Clean up most of the projects problem warnings#1523
Merged
rocketstack-matt merged 8 commits intofinos:mainfrom Aug 12, 2025
Merged
Clean up most of the projects problem warnings#1523rocketstack-matt merged 8 commits intofinos:mainfrom
rocketstack-matt merged 8 commits intofinos:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request improves type safety and consistency in database document retrieval across MongoDB and Nitrite implementations. The changes replace unchecked casts with type-safe retrieval methods and fix schema map handling logic.
- Replaced unchecked casts
(List<Document>) result.get("...")with type-saferesult.getList("...", Document.class)in MongoDB stores - Introduced
TypeSafeNitriteDocumentutility for safe list/map extraction from Nitrite documents - Fixed schema map retrieval bug in
MongoCoreSchemaStorethat was causing empty maps
Reviewed Changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
TypeSafeNitriteDocument.java |
New utility class for type-safe document field extraction |
TestTypeSafeNitriteDocumentShould.java |
Test coverage for the new utility class |
| MongoDB store classes | Updated to use type-safe getList method instead of unchecked casts |
| Nitrite store classes | Updated to use TypeSafeNitriteDocument for safe field extraction |
MongoCoreSchemaStore.java |
Fixed schema map retrieval logic to properly handle key-value pairs |
NitriteDBConfig.java |
Removed unused variables for code cleanup |
| Test files | Import reorganization and interface introduction for type safety |
calm-hub/src/main/java/org/finos/calm/store/util/TypeSafeNitriteDocument.java
Show resolved
Hide resolved
calm-hub/src/main/java/org/finos/calm/store/util/TypeSafeNitriteDocument.java
Show resolved
Hide resolved
calm-hub/src/main/java/org/finos/calm/store/nitrite/NitriteCoreSchemaStore.java
Show resolved
Hide resolved
calm-hub/src/test/java/org/finos/calm/store/mongo/TestMongoUserAccessStoreShould.java
Show resolved
Hide resolved
markscott-ms
previously approved these changes
Aug 12, 2025
jpgough-ms
requested changes
Aug 12, 2025
calm-hub/src/test/java/org/finos/calm/store/mongo/TestMongoAdrStoreShould.java
Show resolved
Hide resolved
calm-hub/src/test/java/org/finos/calm/store/mongo/TestMongoAdrStoreShould.java
Show resolved
Hide resolved
calm-hub/src/test/java/org/finos/calm/store/mongo/TestMongoAdrStoreShould.java
Show resolved
Hide resolved
calm-hub/src/test/java/org/finos/calm/store/mongo/TestMongoAdrStoreShould.java
Show resolved
Hide resolved
calm-hub/src/test/java/org/finos/calm/store/mongo/TestMongoAdrStoreShould.java
Show resolved
Hide resolved
calm-hub/src/test/java/org/finos/calm/store/mongo/TestMongoUserAccessStoreShould.java
Show resolved
Hide resolved
…StoreShould.java Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
…StoreShould.java Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
…StoreShould.java Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
…StoreShould.java Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
…StoreShould.java Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
jpgough-ms
approved these changes
Aug 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request focuses on improving type safety and consistency when retrieving lists and maps from MongoDB and Nitrite database documents throughout the codebase. The main changes involve replacing unchecked casts with type-safe retrieval methods, primarily using
getListand a newTypeSafeNitriteDocumentutility. Additionally, there are corrections to map handling for schema retrieval.Type-safe retrieval improvements (MongoDB stores):
(List<Document>) result.get("...")withresult.getList("...", Document.class)in all relevant methods for architectures, patterns, flows, standards, and ADRs, ensuring safer and more reliable data extraction from MongoDB documents.Type-safe retrieval improvements (Nitrite stores):
TypeSafeNitriteDocumentfor extracting lists from Nitrite documents in ADR and Architecture stores, replacing direct usage ofget(..., List.class)and reducing the risk of class cast exceptions.Schema map retrieval correction:
MongoCoreSchemaStorefor retrieving theschemasmap, ensuring all keys are properly cast toStringand values are preserved, correcting a previous bug that resulted in empty maps.Code cleanup:
NitriteDBConfig.initializeDatabase()for clarity and maintainability.Dependency and import updates:
TypeSafeNitriteDocumentandHashMapin affected files.NO INTENDED FUNCTIONAL CHANGES