fix SonarCloud S5993: abstract class constructors should be protected#22305
fix SonarCloud S5993: abstract class constructors should be protected#22305orpiske wants to merge 37 commits intoapache:mainfrom
Conversation
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>
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>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet
left a comment
There was a problem hiding this comment.
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
RedeliveryErrorHandlerconstructor reformatting (8 additions / 6 deletions) is expected: changingpublic→protectedshifts 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.
| serviceChooserConfiguration | ||
| serviceDiscoveryConfiguration | ||
| serviceExpression | ||
| serviceFilterConfiguration | ||
| setBody | ||
| setExchangePattern |
There was a problem hiding this comment.
Blocking: These 6 entries (plus 14 others spread across this file: blacklistServiceFilter, cachingServiceDiscovery, combinedServiceDiscovery, combinedServiceFilter, consulServiceDiscovery, customServiceFilter, defaultLoadBalancer, dnsServiceDiscovery, healthyServiceFilter, kubernetesServiceDiscovery, loadBalancerConfiguration, passThroughServiceFilter, staticServiceDiscovery, zookeeperServiceDiscovery) were intentionally removed in c216fd9 (CAMEL-22290, CAMEL-22289: "Remove deprecated camel-cloud and ServiceCall").
The corresponding Java model classes no longer exist in the codebase — they were part of org.apache.camel.model.cloud.* which was deleted in that commit. Re-adding these entries to model.properties is a regression.
This likely happened because mvn install -pl core/camel-core-model regenerated this file from a local Maven repository that still contained stale metadata. To fix: revert all 20 additions to this file (the diff should show 0 additions / 0 deletions for this file).
Summary
publicconstructors ofabstractclasses toprotectedacross 37 modules (179 issues)publicsince abstract classes cannot be instantiated directly —protectedis the correct visibilitysuper()withprotectedconstructorsAffected 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
Test plan
mvn -DskipTests install(formatting included)Claude Code on behalf of Otavio R. Piske