Brian Slesinsky has posted comments on this change.

Change subject: Issue 7834 - fix BigDecimal compareTo
......................................................................


Patch Set 2:

(3 comments)

Could you simplify this code? I don't see the bug either.

....................................................
File user/super/com/google/gwt/emul/java/math/BigDecimal.java
Line 658:     } catch (StringIndexOutOfBoundsException e) {
Can this exception happen anymore?


Line 2612:     // To skip a possible '+' symbol
update comment


Line 2613: if ((offset < last) && ((val[offset] == '+') || (val[offset] == '-'))) { This code seems overly complicated because after identifying special cases we're falling through, so the rest of the code still has to deal with them. It seems like it would be clearer to handle them separately and return early:

if (offset == last) {
  // empty string. What should this do?
  return ...
}

if (val[offset] == '+' || val[offset] == '-') {
  if (val[offset] == '-') {
    unscaledBuffer.append('-');
  }
  offset++;
  if (offset==last) {
    // ... just a + or -. Is this a number?
    return or throw something
  }
  if (val[offset] == '+' || val[offset] == '-') {
    // extra sign
    throw ...
  }
}
// skip leading zeros
while (offset < last && val[offset] == '0') {
  offset++;
}
if (offset == last) {
  // it's zero.
  return ...
}


--
To view, visit https://gwt-review.googlesource.com/1660
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I9874897f54a9eb6ce15f5b7b6295613800a25b72
Gerrit-PatchSet: 2
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: John A. Tamplin <[email protected]>
Gerrit-Reviewer: Brian Slesinsky <[email protected]>
Gerrit-Reviewer: John A. Tamplin <[email protected]>
Gerrit-Reviewer: Thomas Broyer <[email protected]>
Gerrit-HasComments: Yes

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to