Skip to content

fix SonarCloud S5993: abstract class constructors should be protected#22305

Open
orpiske wants to merge 38 commits intoapache:mainfrom
orpiske:ci-camel-4-sonarcloud-S5993
Open

fix SonarCloud S5993: abstract class constructors should be protected#22305
orpiske wants to merge 38 commits intoapache:mainfrom
orpiske:ci-camel-4-sonarcloud-S5993

Conversation

@orpiske
Copy link
Copy Markdown
Contributor

@orpiske orpiske commented Mar 28, 2026

Summary

  • Change public constructors of abstract classes to protected across 37 modules (179 issues)
  • SonarCloud rule S5993: constructors of abstract classes should not be declared public since abstract classes cannot be instantiated directly — protected is the correct visibility
  • This is a safe, behavior-preserving change: subclasses can still call super() with protected constructors

Affected modules

Core: camel-api, camel-base, camel-core-languages, camel-core-model, camel-core-processor, camel-core-reifier, camel-core-xml, camel-main, camel-support

Components: camel-djl, camel-as2-api, camel-aws2-timestream, camel-infinispan-common, camel-oauth, camel-salesforce-component, camel-servicenow-component, camel-sjms, camel-smpp, camel-splunk, camel-sql, camel-telegram, camel-twitter, camel-whatsapp, camel-wordpress, camel-workday, camel-xmlsecurity, camel-zeebe, camel-zookeeper

DSL: camel-endpointdsl, camel-jbang-core, camel-jbang-plugin-kubernetes, camel-yaml-dsl, camel-yaml-dsl-common

Test infra: camel-test-infra-artemis, camel-test-infra-aws-v2, camel-test-infra-azure-common, camel-test-infra-jetty

Changes since review

  • Reverted spurious model.properties additions that re-introduced deleted ServiceCall entries (stale local metadata)
  • Reverted regenerated camelYamlDsl.json schema to match main

Test plan

  • Each module built successfully with mvn -DskipTests install (formatting included)
  • Generated files restored to main state (no stale metadata)
  • CI passes full test suite

Claude Code on behalf of Otavio R. Piske

orpiske and others added 30 commits March 28, 2026 13:35
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
orpiske and others added 7 commits March 28, 2026 13:42
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change public constructors of abstract classes to protected.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@orpiske orpiske requested review from davsclaus and oscerd March 28, 2026 13:44
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

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

Claude Code on behalf of Guillaume Nodet

Overview

This PR changes public constructors of abstract classes to protected across 37 modules (~95 files), addressing SonarCloud rule S5993. The rationale is correct: abstract classes cannot be instantiated directly, so protected is the appropriate visibility. Since protected is accessible from subclasses in any package, all legitimate subclassing (including external user code extending DefaultComponent, DefaultProducer, RouteBuilder, ScheduledPollConsumer, etc.) remains fully source- and binary-compatible.

Verdict: Request Changes

Two blocking issues prevent merging.

Blocking Issues

1. Spurious model.properties additions re-introduce deleted ServiceCall entries

The file core/camel-core-model/src/generated/resources/META-INF/services/org/apache/camel/model.properties adds 20 entries for service call/discovery/filter models (serviceCall, kubernetesServiceDiscovery, blacklistServiceFilter, etc.) that were intentionally removed in commit c216fd9 (CAMEL-22290, CAMEL-22289: "Remove deprecated camel-cloud and ServiceCall"). The corresponding Java classes no longer exist in the codebase.

This likely happened because the build regenerated the file from a local Maven repository that still contained stale metadata from a previous build that included these models. These 20 entries must be reverted.

2. CI failing — uncommitted generated files

All three CI builds (JDK 17, 21, 25) fail at the "uncommitted changes" check. The build produces additional generated file diffs (YAML DSL schema changes, groovyJson dataformat entry, sslContextParameters/transformers/validators sections) that aren't committed. The PR needs a clean regeneration cycle — see the pre-push checklist in CLAUDE.md.

Notes

  • The RedeliveryErrorHandler constructor reformatting (8 additions / 6 deletions) is expected: changing publicprotected shifts the parameter alignment 3 chars right, pushing two lines from 127 to 130 chars (over the 128-char formatter limit), so the formatter correctly re-wraps them. No issue here.

  • The 37 separate commits (one per module) will be squashed on merge, so no concern there.

Restore model.properties and camelYamlDsl.json to main state.
The previous build regenerated these from stale local metadata,
re-introducing deleted ServiceCall entries and schema diffs.

Claude Code on behalf of Otavio R. Piske

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@orpiske orpiske requested a review from gnodet March 30, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants