Skip to content

Make UnifiedGCLogParser public#464

Open
obourgain wants to merge 3 commits intomicrosoft:mainfrom
obourgain:make_UnifiedGCLogParser_public
Open

Make UnifiedGCLogParser public#464
obourgain wants to merge 3 commits intomicrosoft:mainfrom
obourgain:make_UnifiedGCLogParser_public

Conversation

@obourgain
Copy link

Make it possible to extend it in third party packages.

We have an implementation of this, and it currently extends from UnifiedGenerationalParser for no other reason that it is public.

For more information, there is nothing very exciting about our custom implementation, it just collects all the info printed on start:

[2025-11-10T02:00:05.581+0100][0.005s] Parallel Workers: 2
[2025-11-10T02:00:05.581+0100][0.005s] Compressed Oops: Enabled (32-bit)
[2025-11-10T02:00:05.581+0100][0.005s] Version: 21.0.8+9-LTS (release)
[2025-11-10T02:00:05.581+0100][0.005s] Memory: 2048M
[2025-11-10T02:00:05.589+0100][0.012s] Compressed class space mapped at: 0x00007fb2a6000000-0x00007fb2ba000000, reserved size: 335544320
[2025-11-10T02:00:05.581+0100][0.005s] CPUs: 8 total, 1 available
[2025-11-10T02:00:05.580+0100][0.003s] CardTable entry size: 512
...

Make it possible to extend it in third party packages.
karianna
karianna previously approved these changes Jan 21, 2026
Copy link

Copilot AI left a comment

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 makes the UnifiedGCLogParser class public to enable third-party packages to extend it, addressing a use case where custom parsers need to extend this base class to parse additional JVM startup information. The PR author currently works around this limitation by extending UnifiedGenerationalParser instead.

Changes:

  • Changed UnifiedGCLogParser class visibility from package-private to public
  • Changed advanceClock(String record) method visibility from package-private to protected to support overriding in third-party extensions
Comments suppressed due to low confidence (2)

parser/src/main/java/com/microsoft/gctoolkit/parser/UnifiedGCLogParser.java:18

  • The advanceClock method is now protected, enabling third-party extensions. However, two other package-private methods in this class (notYetImplemented and noop) are also used by existing subclasses like UnifiedG1GCParser and UnifiedGenerationalParser. For complete extensibility, these methods should also be changed to protected visibility so third-party implementations can use them.
    protected void advanceClock(String record) {

parser/src/main/java/com/microsoft/gctoolkit/parser/UnifiedGCLogParser.java:18

  • The advanceClock method is now protected and part of the public API surface for third-party extensions. However, it lacks JavaDoc documentation. Consider adding JavaDoc that describes its purpose, parameter, and the exception handling behavior (catches all Throwables and logs them at FINE level).
    protected void advanceClock(String record) {

…ogParser.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot makes good points

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@karianna
Copy link
Member

@kcpeppe - CCing you in in case you still wanted to comment on this but I think enabling 3P extensibility is an OK goal for this.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

3 participants