#1 Fix for 1520494 - bitwise operators

open-fixed
nobody
None
5
2006-07-12
2006-07-12
Anonymous
No

REASON: Please see defect description for details.
FIX: As suggested by Josson when using bitwise
operators & or | generated JS should be in the form:
var a = new Boolean(expression).valueOf();
rather then as it is now:
var a = new Boolean(expression);

In the class
net.sf.j2s.core\src\net\sf\j2s\core\astvisitors\ASTKeywordParser.java
new line:

buffer.append(".valueOf ()");

needs to be introduced.

buffer.append(" = new Boolean (");
left.accept(this);
buffer.append(' ');
buffer.append(op.charAt(0));
if (right instanceof InfixExpression) {
buffer.append(" (");
right.accept(this);
buffer.append("))");
} else {
buffer.append(' ');
right.accept(this);
buffer.append(')');
}
buffer.append(".valueOf ()"); // NEW LINE 566
return false;

Please check in the following fix into net.sf.j2s.core_3.2

Thanks,
Krzysztof

email: krzysztof_bozko@wp.pl

Discussion

  • Josson Smith
    Josson Smith
    2006-07-12

    Logged In: YES
    user_id=1408135

    Now branches net.sf.j2s.core_3.2 is updated.

     
  • Josson Smith
    Josson Smith
    2006-07-12

    • status: open --> open-fixed