Jbosh's code to enable assertions

jbosh/BOSHClient.java at master · igniterealtime/jbosh · GitHub

line 338 ----- please revisit the code

the code will not make the enabled to true

simply put

enabled = true;

and remove the “assert” keyword

As far as I can see, the code looks correct as it is.

The code is

assert enabled = true;

I assume assert usually used with a boolean statement

if you put 'assert something == something '… then it is a boolean statement…

if you put 'assert something == something : “Display Error” '… then it is a boolean statement with assertion error/exception…

but “enabled = true” is an assignment statement… will it affect?

I tried to put that code in a simple java program and used “java -ea MyProgram” … I am only getting false for ASSERTIONS

Am I interpreting the code wrongly … may be

ignore the above message, my bad, what you said is right

Hehe, glad you figured it out. It’s arguably not the most intuitive code and therefore should be commented.