title: Return value type is not correct for JavaScript expression in Java due to XOR bitwise ^ operator
body: <p>I'm trying to evaluate this expression:</p>
  
  <pre><code>ScriptEngineManager sem = new ScriptEngineManager () 
  ScriptEngine scriptEngine = sem.getEngineByName("js") ;
  String expr = "true ^ true";
  Boolean obj = (Boolean) scriptEngine.eval(expr);
  </code></pre>
  
  <p>However the result returned is java Double.  I have tried various option for String expr such as:</p>
  
  <p><code>String expr = "0x1 ^ 0x0";</code> 
  <code>String expr = "1 ^ 0";</code></p>
  
  <p>Basically I want to be able to use JavaScript engine to evaluate various expressions which may look like this: </p>
  
  <pre><code>"ture &amp;&amp; false || false (true || false &amp;&amp; true || false XOR true)"
  </code></pre>
  
  <p>All the other operators like &amp;&amp; or || work just fine when I evaluate such expressions and return Boolean but when it comes XOR (which has JavaScript equivalent bitwise ^ operator) it returns Double.  I don't really want to convert the expression to replace XOR to some logical operators (e.g. ((true || false) &amp;&amp; !(true &amp;&amp; false)) ) because then I'd have to parse the whole expression string to convert XOR into above logical expression.  The whole point of my evaluating this expression is so that I am able to evaluate without having to parse its complexity.</p>
  
  <p>Any help will be much appreciated! Thanks in advance!</p>