from-java on an object with Boolean attribute = false returns "bad" Booleans

Description

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.

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.

Environment

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

clojure 1.9.0
org.clojure/java.data "0.1.1"

Activity

Show:
Andy Fingerhut
October 26, 2018, 7:22 AM

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

import
October 26, 2018, 3:19 PM

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.

import
October 26, 2018, 3:19 PM

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.

Sean Corfield
October 13, 2019, 7:04 AM

Will be in 0.1.3 release.

Sean Corfield
October 13, 2019, 7:52 PM

Release 0.1.3

Fixed

Assignee

Sean Corfield

Reporter

Anonymous

Labels

Approval

None

Patch

None

Priority

Major