Skip to content

[CAMEL-22555] extra fixes for non-varargs call of varargs method with inexact argument type#22033

Merged
squakez merged 1 commit intoapache:mainfrom
JinyuChen97:camel-22555-extra
Mar 18, 2026
Merged

[CAMEL-22555] extra fixes for non-varargs call of varargs method with inexact argument type#22033
squakez merged 1 commit intoapache:mainfrom
JinyuChen97:camel-22555-extra

Conversation

@JinyuChen97
Copy link
Contributor

https://issues.apache.org/jira/browse/CAMEL-22555

try to fix more warning

impacted classes

  • TrustAllTrustManager.java – core/camel-api
  • CoAPEndpoint.java – camel-coap
  • GeoCoderGoogleProducer.java – camel-geocoder
  • BindySimpleKeyValuePairFixTest.java — camel-bindy
  • EhcacheConsumerTest.java – camel-ehcache
  • GeoCoderProxyManualIT.java – camel-geocoder
  • MinaInOutWithForcedNoResponseTest.java – camel-mina
  • EnrichWithoutRestResponseTest.java – camel-netty
  • NettyInOutWithForcedNoResponseTest.java – camel-netty
  • ZooKeeperManagedEndpointIT.java – camel-zookeeper
  • TraitHelperTest.java – camel-jbang-plugin-kubernetes

@apupier
Copy link
Contributor

apupier commented Mar 16, 2026

/component-test coap geocoder bindy ehcache mina netty zookeeper

@github-actions
Copy link
Contributor

/component-test coap geocoder bindy ehcache mina netty zookeeper tests passed successfully.

⚠️ Some integration tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • components/camel-netty: 1 test(s) disabled on GitHub Actions

@github-actions
Copy link
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
Contributor

@squakez squakez left a comment

Choose a reason for hiding this comment

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

This problem won't be simply solved by cast forcing the varargs. For example, in the LOGGER.debug case:

LOGGER.debug("There are configured cipher suites: {}", getConfiguredCipherSuites());

the getConfiguredCipherSuites() returns an array of String. What you need to do is to convert the array into a single string probably. Casting is hiding the information that we're writing to the log instead.

@JinyuChen97 JinyuChen97 force-pushed the camel-22555-extra branch 2 times, most recently from dd3e7b5 to 4478bcb Compare March 16, 2026 15:40
Copy link
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.

Good improvements after squakez's feedback — Arrays.toString() is the right approach for array logging.

One concern: the new expectedBodiesReceived(String[]) overload in MockEndpoint adds a new public API method that seems unnecessary. The varargs warning should be fixed at the call site (e.g., casting (Object[]) stringArray), not by adding a type-specific overload to the API. Otherwise, the same logic would apply for Integer[], byte[][], etc., leading to API bloat.

The rest of the changes look correct:

  • Arrays.toString() for array logging ✓
  • constant((Object) null) for null disambiguation ✓
  • Removing explicit null args for no-arg varargs calls ✓

squakez
squakez previously approved these changes Mar 17, 2026
@squakez
Copy link
Contributor

squakez commented Mar 17, 2026

@JinyuChen97 please, rebase with main in order to solve the check problems we had previously.

@squakez squakez dismissed their stale review March 18, 2026 10:34

Noticed some improvement that should be applied.

@squakez squakez merged commit a6cd06d into apache:main Mar 18, 2026
5 checks passed
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.

5 participants