summaryrefslogtreecommitdiff
path: root/include/ScopedJavaUnicodeString.h
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2018-05-29 18:54:18 +0100
committerTobias Thierer <tobiast@google.com>2018-05-30 14:44:08 +0100
commitb1e0e39dcb5af8cab8878763af564d2acbc91f50 (patch)
tree4c19ed77f135cc0814d1aa920ef90f9b002680b8 /include/ScopedJavaUnicodeString.h
parentf91e053f9c13a074e3156ac9495515e4e616dcb0 (diff)
Matcher: Adopt behavior changes forgotten in update to OpenJDK 8.
This is step 5 of verifying Matcher.java vs. OpenJDK 8u121-b13. Matcher.java was never properly updated from OpenJDK 7u40 to OpenJDK 8 (u60, u121-b13). This CL adopts the following behavior changes that were thus forgotten, and adds unit tests enforcing them: replaceFirst() - Adopt the following behavior even when there is no match: - still throw NPE - don't reset() - Previously, the NPE was not thrown and the Matcher was reset(). start(int group), end(int group): - throw IOOBE rather than ArrayIndexOutOfBoundsException if group < 0 or group > groupCount appendReplacement(StringBuffer, String): - if replacement ends in \ or $ then the method now throws IAE; the old code only checked for training \ and threw an IOOBE instead of IAE. This behavior change required updating an old regression test from Harmony to expect the new behavior. - Note: The implementation of appendReplacement() appears to have previously been done independently from the upstream code. Its implementation could be changed to be based on / much more similar to upstream code, but this is not done as part of this CL. Test: Before but not after this CL, the exceptions encountered by the out-of-bounds tests added to OldMatcherTest were specifically instances of ArrayIndexOutOfBoundsExceptions. The tests as written don't care about the kind of IOOBE they encounter, so they pass both before and after this CL. Test: testReplaceFirst_null_match passes both before and after this CL. Test: All other added tests fail before this CL but pass after this CL. Test: CtsLibcoreTestCases Bug: 80416774 Change-Id: Ibdee4976f5033c7913fa98a65475f2c7a310ebc9
Diffstat (limited to 'include/ScopedJavaUnicodeString.h')
0 files changed, 0 insertions, 0 deletions