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-bcel.git
commit 2b0ef172ffe03891250707b22579e5c476a9f797 Author: Gary Gregory <ggreg...@rocketsoftware.com> AuthorDate: Mon Jun 3 07:37:16 2019 -0400 Sort members. --- .../org/apache/bcel/classfile/ConstantUtf8.java | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java b/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java index 0628f7e..1035935 100644 --- a/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java +++ b/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java @@ -34,20 +34,6 @@ import org.apache.bcel.Const; */ public final class ConstantUtf8 extends Constant { - private final String bytes; - - // TODO these should perhaps be AtomicInt? - private static volatile int considered = 0; - private static volatile int hits = 0; - private static volatile int skipped = 0; - private static volatile int created = 0; - - // Set the size to 0 or below to skip caching entirely - private static final int MAX_CACHED_SIZE = - Integer.getInteger("bcel.maxcached.size", 200).intValue();// CHECKSTYLE IGNORE MagicNumber - private static final boolean BCEL_STATISTICS = Boolean.getBoolean("bcel.statistics"); - - private static class CACHE_HOLDER { private static final int MAX_CACHE_ENTRIES = 20000; @@ -65,16 +51,17 @@ public final class ConstantUtf8 extends Constant { } - // for accesss by test code - static void printStats() { - System.err.println("Cache hit " + hits + "/" + considered +", " + skipped + " skipped"); - System.err.println("Total of " + created + " ConstantUtf8 objects created"); - } + // TODO these should perhaps be AtomicInt? + private static volatile int considered = 0; + private static volatile int hits = 0; + private static volatile int skipped = 0; + private static volatile int created = 0; + + // Set the size to 0 or below to skip caching entirely + private static final int MAX_CACHED_SIZE = + Integer.getInteger("bcel.maxcached.size", 200).intValue();// CHECKSTYLE IGNORE MagicNumber + private static final boolean BCEL_STATISTICS = Boolean.getBoolean("bcel.statistics"); - // for accesss by test code - static void clearStats() { - hits = considered = skipped = created = 0; - } static { if (BCEL_STATISTICS) { @@ -87,6 +74,11 @@ public final class ConstantUtf8 extends Constant { } } + // for accesss by test code + static void clearStats() { + hits = considered = skipped = created = 0; + } + /** * @since 6.0 */ @@ -111,17 +103,25 @@ public final class ConstantUtf8 extends Constant { /** * @since 6.0 */ - public static ConstantUtf8 getInstance(final String s) { - return new ConstantUtf8(s); + public static ConstantUtf8 getInstance (final DataInput input) throws IOException { + return getInstance(input.readUTF()); } /** * @since 6.0 */ - public static ConstantUtf8 getInstance (final DataInput input) throws IOException { - return getInstance(input.readUTF()); + public static ConstantUtf8 getInstance(final String s) { + return new ConstantUtf8(s); } + // for accesss by test code + static void printStats() { + System.err.println("Cache hit " + hits + "/" + considered +", " + skipped + " skipped"); + System.err.println("Total of " + created + " ConstantUtf8 objects created"); + } + + private final String bytes; + /** * Initialize from another object. */