Throw an exception when an implicit narrowing conversion in a compound

assignment would result in information loss or a numeric error such as
an overflows.
This commit is contained in:
Gary Gregory 2022-01-30 15:19:28 -05:00
parent 0ffdcf31e7
commit 1eba02e2a2
2 changed files with 3 additions and 1 deletions

View File

@ -67,6 +67,8 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="kinow" due-to="Roland Kreuzer">Javadoc for StringUtils.substringBefore(String str, int separator) doesn't mention that the separator is an int.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix NullPointerException in ThreadUtils.getSystemThreadGroup() when the current thread is stopped.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">ArrayUtils.toPrimitive(Boolean...) null array elements map to false, like Boolean.parseBoolean(null) and its callers return false.</action>
<action type="fix" dev="ggregory" due-to="CodeQL, Gary Gregory">Throw an exception when an implicit narrowing conversion in a compound assignment would result in information loss or a numeric error such as an overflows.</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add EnumUtils.getEnumSystemProperty(...).</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add TriConsumer.</action>

View File

@ -2985,7 +2985,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
if (n < 0) {
return 0;
}
pos += n;
pos = Math.addExact(pos, Math.toIntExact(n));
return n;
}