You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/08/26 19:59:29 UTC
[commons-lang] branch master updated (005f035 -> e93e4f2)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git.
from 005f035 Remove useless parens; use final.
new bfbf729 Simplify.
new e93e4f2 Format nits.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/main/java/org/apache/commons/lang3/StringUtils.java | 5 +----
.../java/org/apache/commons/lang3/reflect/MemberUtils.java | 11 ++++++-----
2 files changed, 7 insertions(+), 9 deletions(-)
[commons-lang] 01/02: Simplify.
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit bfbf729ca79a43ef3abf09ac8ae7dfca70b3c74f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 26 15:57:16 2021 -0400
Simplify.
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 5f22048..8de2484 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -6865,10 +6865,7 @@ public class StringUtils {
* @since 2.4
*/
public static String replaceEachRepeatedly(final String text, final String[] searchList, final String[] replacementList) {
- // timeToLive should be 0 if not used or nothing to replace, else it's
- // the length of the replace array
- final int timeToLive = searchList == null ? 0 : searchList.length;
- return replaceEach(text, searchList, replacementList, true, timeToLive);
+ return replaceEach(text, searchList, replacementList, true, ArrayUtils.getLength(searchList));
}
/**
[commons-lang] 02/02: Format nits.
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit e93e4f2e87084724dab01e6907adee82d59d397e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 26 15:57:28 2021 -0400
Format nits.
---
.../java/org/apache/commons/lang3/reflect/MemberUtils.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
index 83b9ca5..3a8ffff 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
@@ -151,7 +151,7 @@ abstract class MemberUtils {
// "source" and "destination" are the actual and declared args respectively.
float totalCost = 0.0f;
- final long normalArgsLen = isVarArgs ? destArgs.length-1 : destArgs.length;
+ final long normalArgsLen = isVarArgs ? destArgs.length - 1 : destArgs.length;
if (srcArgs.length < normalArgsLen) {
return Float.MAX_VALUE;
}
@@ -162,19 +162,20 @@ abstract class MemberUtils {
// When isVarArgs is true, srcArgs and dstArgs may differ in length.
// There are two special cases to consider:
final boolean noVarArgsPassed = srcArgs.length < destArgs.length;
- final boolean explicitArrayForVarargs = srcArgs.length == destArgs.length && srcArgs[srcArgs.length-1] != null && srcArgs[srcArgs.length-1].isArray();
+ final boolean explicitArrayForVarargs = srcArgs.length == destArgs.length && srcArgs[srcArgs.length - 1] != null
+ && srcArgs[srcArgs.length - 1].isArray();
final float varArgsCost = 0.001f;
- final Class<?> destClass = destArgs[destArgs.length-1].getComponentType();
+ final Class<?> destClass = destArgs[destArgs.length - 1].getComponentType();
if (noVarArgsPassed) {
// When no varargs passed, the best match is the most generic matching type, not the most specific.
totalCost += getObjectTransformationCost(destClass, Object.class) + varArgsCost;
} else if (explicitArrayForVarargs) {
- final Class<?> sourceClass = srcArgs[srcArgs.length-1].getComponentType();
+ final Class<?> sourceClass = srcArgs[srcArgs.length - 1].getComponentType();
totalCost += getObjectTransformationCost(sourceClass, destClass) + varArgsCost;
} else {
// This is typical varargs case.
- for (int i = destArgs.length-1; i < srcArgs.length; i++) {
+ for (int i = destArgs.length - 1; i < srcArgs.length; i++) {
final Class<?> srcClass = srcArgs[i];
totalCost += getObjectTransformationCost(srcClass, destClass) + varArgsCost;
}