Welcome! Please see the About page for a little more info on how this works.

0 votes
in java.data by

Calling from-java on an object that as a Boolean attribute that is false can return boxed Booleans that are not Boolean/FALSE.
This results in a boolean that is equal to false, but results in the true path of if.

`
(def bool (:absolute (from-java (URI. ""))))

bool
=> false
(= bool false)
=> true
(if bool true false)
=> false
`

This leads to really confusing behavior.
As clojure won't change the behavior of if (https://dev.clojure.org/jira/browse/CLJ-1718) and we don't control the construction of the boolean, I think from-java should be aware of this problem and fix it.

This could be fixed by adding an extra method for Boolean that reconstructs the Boolean in the right way, though I'm not sure what the best way would look like.

7 Answers

0 votes
by

Comment made by: iamdrowsy

Is it possible to edit the description?
The last line of code shows the expected behavior not the observed.

(if bool true false) => true

is what it resolves to right now.

0 votes
by

Comment made by: iamdrowsy

Is it possible to edit the description?
The last line of code shows the expected behavior not the observed.

(if bool true false) => true

is what it resolves to right now.

0 votes
by

Comment made by: jafingerhut

Attached path jdata-9-v1.patch that changes from-data to convert Java Boolean values using clojure.core/boolean

0 votes
by

Comment made by: jafingerhut

Attached path jdata-9-v1.patch that changes from-data to convert Java Boolean values using clojure.core/boolean

0 votes
by

Comment made by: bowbahdoe

I'm running into this issue when converting some ugly generated WSDL objects. Some use Boolean as property values while others are just Object because their type isn't specified in the schema I am given.

0 votes
by

Comment made by: bowbahdoe

I'm running into this issue when converting some ugly generated WSDL objects. Some use Boolean as property values while others are just Object because their type isn't specified in the schema I am given.

0 votes
by
...