You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2017/06/08 08:16:13 UTC

[39/48] [lang] Make the var a constant, and add comments

Make the var a constant, and add comments


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c68285bb
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c68285bb
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c68285bb

Branch: refs/heads/release
Commit: c68285bb3392665827595ac408a5fad828b0351f
Parents: 0344ca3
Author: Bruno P. Kinoshita <ki...@apache.org>
Authored: Wed Jun 7 19:24:52 2017 +1200
Committer: Bruno P. Kinoshita <ki...@apache.org>
Committed: Wed Jun 7 19:24:52 2017 +1200

----------------------------------------------------------------------
 .../org/apache/commons/lang3/builder/ToStringBuilderTest.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c68285bb/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
index c49426d..39dcd37 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
@@ -36,7 +36,8 @@ import org.junit.Test;
  */
 public class ToStringBuilderTest {
 
-    private final Integer arraylistInitialCapacity = Integer.valueOf(10);
+    // See LANG-1337 for more.
+    private static final int ARRAYLIST_INITIAL_CAPACITY = 10;
     private final Integer base = Integer.valueOf(5);
     private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
 
@@ -317,7 +318,8 @@ public class ToStringBuilderTest {
         // representation different for IBM JDK 1.6.0, LANG-727
         assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION));
         assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0);
-        final List<Object> list = new ArrayList<>(arraylistInitialCapacity);
+        // LANG-1337 without this, the generated string can differ depending on the JVM version/vendor
+        final List<Object> list = new ArrayList<>(ARRAYLIST_INITIAL_CAPACITY);
         final String baseString = this.toBaseString(list);
         final String expectedWithTransients = baseString + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]";
         final String toStringWithTransients = ToStringBuilder.reflectionToString(list, null, true);