bvahdat commented on a change in pull request #6757:
URL: https://github.com/apache/camel/pull/6757#discussion_r785407508
##########
File path:
components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsMessageBodySetNullTest.java
##########
@@ -83,7 +83,7 @@ public void testSetNullBodyUsingSetBody() throws Exception {
public void configure() throws Exception {
from("jms:queue:foo")
.to("mock:foo")
- .setBody(constant(null))
+ .setBody(constant(new Object[] { null }))
Review comment:
Without that change the compiler would complain as:
```
[WARNING]
/Users/bvahdat/dev/workspace/camel/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsMessageBodySetNullTest.java:[86,42]
non-varargs call of varargs method with inexact argument type for last
parameter;
```
The problem is that `BuilderSupport#constant` is overloaded (which doesn't
really fits for the `null` case):
```
public ValueBuilder constant(Object value)
public ValueBuilder constant(Object... value)
```
And the compiler thinks we intend to invoke the second one and gives that
warning above. To overcome that I did that change to make it clear and resolve
that warning.
Instead we could also do:
```
.setBody(simple("${null}"))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]