[
https://issues.jboss.org/browse/ARQGRA-496?page=com.atlassian.jira.plugin...
]
Vsevolod Golovanov updated ARQGRA-496:
--------------------------------------
Description:
{code}
@JavaScript(value = "MyObject")
public interface MyJsInterface {
Boolean getSomeValue();
}
{code}
If in js MyObject.someValue === false, then attempting to get the value via Graphene's
MyJsInterface will result in null getting returned, instead of false.
If you declare a primitive boolean return type, then null will get silently
'casted' to false, but that's not something I want either. I want to
distinguish the three states with Boolean. I want an exception for null with boolean.
{code:title=call.js/invokeInterface}
if (property && target[property]) {
return target[property];
}
{code}
There are 2 problems here.
# Instead of {{target\[property\]}} there should be an explicit
{{typeof(target\[property\]}) !== 'undefined')}} check (or {{property in target}},
if you want to distinguish the "property is defined, but its value is undefined"
case).
# When invokeInterface doesn't find neither getter, nor setter, nor method it quits
without returning or throwing anything. There should be some kind of explicit handling if
it can't find property/method at all.
The problem probably affects not only Booleans, but other types with falsey values too.
was:
{code}
@JavaScript(value = "MyObject")
public interface MyJsInterface {
Boolean getSomeValue();
}
{code}
If in js MyObject.someValue === false, then attempting to get the value via Graphene's
MyJsInterface will result in null getting returned, instead of false.
If you declare a primitive boolean return type, then null will get silently
'casted' to false, but that's not something I want either. I want to
distinguish the three states with Boolean. I want an exception for null with boolean.
{code:title=call.js/invokeInterface}
if (property && target[property]) {
return target[property];
}
{code}
There are 2 problems here.
# Instead of {{target\[property\]}} there should be an explicit
{{typeof(target\[property\]}) !== 'undefined')}} check (or {{property in target}},
if you want to distinguish the "property is defined, but its value is undefined"
case).
# When invokeInterface doesn't find neither getter, nor setter, nor method it quits
without returning or throwing anything. There should be some kind of explicit handling if
it can't find property/method at all.
The problem probably affects not only Booleans, but other types with falsey values.
JavaScript interface returns null instead of false for Booleans
---------------------------------------------------------------
Key: ARQGRA-496
URL:
https://issues.jboss.org/browse/ARQGRA-496
Project: Arquillian Graphene
Issue Type: Bug
Affects Versions: 2.1.0.Final
Reporter: Vsevolod Golovanov
{code}
@JavaScript(value = "MyObject")
public interface MyJsInterface {
Boolean getSomeValue();
}
{code}
If in js MyObject.someValue === false, then attempting to get the value via
Graphene's MyJsInterface will result in null getting returned, instead of false.
If you declare a primitive boolean return type, then null will get silently
'casted' to false, but that's not something I want either. I want to
distinguish the three states with Boolean. I want an exception for null with boolean.
{code:title=call.js/invokeInterface}
if (property && target[property]) {
return target[property];
}
{code}
There are 2 problems here.
# Instead of {{target\[property\]}} there should be an explicit
{{typeof(target\[property\]}) !== 'undefined')}} check (or {{property in target}},
if you want to distinguish the "property is defined, but its value is undefined"
case).
# When invokeInterface doesn't find neither getter, nor setter, nor method it quits
without returning or throwing anything. There should be some kind of explicit handling if
it can't find property/method at all.
The problem probably affects not only Booleans, but other types with falsey values too.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)