Skip to content

feat: deprecate usage of singleton pattern#704

Merged
mivek merged 1 commit into
mainfrom
feat/deprecate-singleton
Jul 19, 2025
Merged

feat: deprecate usage of singleton pattern#704
mivek merged 1 commit into
mainfrom
feat/deprecate-singleton

Conversation

@mivek

@mivek mivek commented Jul 14, 2025

Copy link
Copy Markdown
Owner

Removed the singleton Pattern in the parsers.

Copilot AI review requested due to automatic review settings July 14, 2025 13:27
@github-actions

Copy link
Copy Markdown

Please check on sonarcloud https://sonarcloud.io/project/pull_requests_list?id=io.github.mivek%3AmetarParser that the PR does not add any issue.

This comment was marked as outdated.

@mivek mivek requested a review from Copilot July 14, 2025 14:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the singleton pattern from various parser classes, making their constructors public for dependency injection and deprecating the old getInstance() methods. It also updates service constructors and factory mappings to use the new public constructors, and revises unit tests to instantiate parsers directly.

  • Swapped all Parser.getInstance() calls for new Parser() in services, factories, and tests
  • Made parser constructors public and annotated getInstance() as @deprecated (returning a new instance)
  • Adjusted unit tests to construct parsers directly and added deprecated-method smoke tests

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
metarParser-services/.../AbstractWeatherCodeServiceTest.java Removed unused Disabled import
metarParser-services/.../TAFService.java & MetarService.java Updated services to call new Parser() instead of singleton
metarParser-parsers/.../TrendValididyParser.java & other parser classes Made constructors public, deprecated singletons
metarParser-parsers/.../TafTrendParserFactory.java Updated factory to instantiate fresh parser objects
Various parser *Test.java Updated tests to use constructors and added testGetInstance methods
Comments suppressed due to low confidence (1)

metarParser-parsers/src/test/java/io/github/mivek/parser/TAFParserTest.java:796

  • The closing delimiter of the Java text block is on the same line as its content, which violates text block syntax. Move the closing """; to its own line immediately after the content.
  BECMG 2316/2317 34010G18KT 9999 NSW SCT170 QNH2969INS TX28/2323Z TN12/2314Z""";

Removed the singleton Pattern in the parsers.
@mivek mivek force-pushed the feat/deprecate-singleton branch from cd64422 to 86f8f51 Compare July 16, 2025 20:43
@sonarqubecloud

Copy link
Copy Markdown

@mivek mivek merged commit 2545293 into main Jul 19, 2025
12 checks passed
@mivek mivek deleted the feat/deprecate-singleton branch July 19, 2025 08:19
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.20.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants