-
Notifications
You must be signed in to change notification settings - Fork 26
Refactoring: Fix NPE, Extract Catalog Service, and Simplify Hierarchy #1366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ice, and simplified class hierarchy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has nothing to do in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has nothing to do in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has nothing to do in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has nothing to do in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has nothing to do in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has nothing to do in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has nothing to do in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing license header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missign end of line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missign zend of line
apupier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provided initial comments. It applies to several other files.
Please provide different commit for each improvements so that the review is easier.
This PR addresses several code smells and architectural issues to improve the robustness and maintainability of the codebase. The changes include a bug fix for a potential crash and architectural simplifications.
Key Changes:
Bug Fix (Robustness): Fixed a NullPointerException in SettingsManager.java (Line 49). The code was chaining multiple getters (getCompletion().getCompletionItem()...) without null checks. Added defensive checks to prevent crashes when receiving minimal initialization params.
Architectural Cleanup:
Extracted Class: Moved catalog management logic (updating versions, runtime providers) from CamelTextDocumentService into a new dedicated class CamelCatalogService. This reduces the complexity of the main service class.
Collapsed Hierarchy: Removed AbstractLanguageServer (an unnecessary abstraction) and pushed its logic down to CamelLanguageServer. This simplifies the project structure as the abstract class had only one implementation.
Code Quality:
Magic Numbers: Replaced hardcoded numbers in ParserXMLFileHelper with explaining variables to improve readability.
Naming: Renamed overly long identifiers in CamelComponentIdsCompletionsFuture for better readability.
Verification:
Ran mvn clean install and mvn test locally.
Verified that the Language Server still initializes correctly with both full and minimal capabilities.
Tests
[x] Are there Unit tests? (Existing tests passed successfully)
[ ] Are there Integration tests?
[ ] Do we need a new UI test? (No)
PR workflow progress
[ ] Tagged with relevant PR labels
[ ] Green job for PR
[ ] PR was created more than 24 hours ago or All committers approved it
[ ] Green main branch build