diff options
Diffstat (limited to 'src/proguard/util')
-rw-r--r-- | src/proguard/util/AndMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/ArrayUtil.java | 57 | ||||
-rw-r--r-- | src/proguard/util/ClassNameParser.java | 35 | ||||
-rw-r--r-- | src/proguard/util/ConstantMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/EmptyStringMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/ExtensionMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/FileNameParser.java | 2 | ||||
-rw-r--r-- | src/proguard/util/FixedStringMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/ListMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/ListParser.java | 2 | ||||
-rw-r--r-- | src/proguard/util/ListUtil.java | 2 | ||||
-rw-r--r-- | src/proguard/util/NameParser.java | 2 | ||||
-rw-r--r-- | src/proguard/util/NotMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/ObjectUtil.java | 2 | ||||
-rw-r--r-- | src/proguard/util/OrMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/SettableMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/StringMatcher.java | 2 | ||||
-rw-r--r-- | src/proguard/util/StringParser.java | 2 | ||||
-rw-r--r-- | src/proguard/util/VariableStringMatcher.java | 2 |
19 files changed, 90 insertions, 36 deletions
diff --git a/src/proguard/util/AndMatcher.java b/src/proguard/util/AndMatcher.java index 1aa3726..2322bd0 100644 --- a/src/proguard/util/AndMatcher.java +++ b/src/proguard/util/AndMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/ArrayUtil.java b/src/proguard/util/ArrayUtil.java index 8584700..f2bcfe1 100644 --- a/src/proguard/util/ArrayUtil.java +++ b/src/proguard/util/ArrayUtil.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -113,6 +113,36 @@ public class ArrayUtil /** + * Returns whether the elements of the two given arrays are the same, or + * both arrays are null. + * @param array1 the first array. + * @param array2 the second array. + * @return whether the elements are the same. + */ + public static boolean equalOrNull(Object[] array1, Object[] array2) + { + return array1 == null ? array2 == null : + equalOrNull(array1, array2, array1.length); + } + + + /** + * Returns whether the elements of the two given arrays are the same, or + * both arrays are null. + * @param array1 the first array. + * @param array2 the second array. + * @param size the size of the arrays to be checked. + * @return whether the elements are the same. + */ + public static boolean equalOrNull(Object[] array1, Object[] array2, int size) + { + return array1 == null ? array2 == null : + array2 != null && + equal(array1, array2, size); + } + + + /** * Returns a hash code for the elements of the given array. * @param array the array. * @param size the size of the array to be taken into account. @@ -189,6 +219,31 @@ public class ArrayUtil /** + * Returns a hash code for the elements of the given array, or 0 if it is + * null. + * @param array the array. + * @return a hash code. + */ + public static int hashCodeOrNull(Object[] array) + { + return array == null ? 0 : hashCode(array, array.length); + } + + + /** + * Returns a hash code for the elements of the given array, or 0 if it is + * null. + * @param array the array. + * @param size the size of the array to be taken into account. + * @return a hash code. + */ + public static int hashCodeOrNull(Object[] array, int size) + { + return array == null ? 0 : hashCode(array, size); + } + + + /** * Compares the elements of the two given arrays. * @param array1 the first array. * @param size1 the size of the first array. diff --git a/src/proguard/util/ClassNameParser.java b/src/proguard/util/ClassNameParser.java index 22a0703..a756eba 100644 --- a/src/proguard/util/ClassNameParser.java +++ b/src/proguard/util/ClassNameParser.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -43,15 +43,15 @@ public class ClassNameParser implements StringParser { private static final char[] INTERNAL_PRIMITIVE_TYPES = new char[] { - ClassConstants.INTERNAL_TYPE_VOID, - ClassConstants.INTERNAL_TYPE_BOOLEAN, - ClassConstants.INTERNAL_TYPE_BYTE, - ClassConstants.INTERNAL_TYPE_CHAR, - ClassConstants.INTERNAL_TYPE_SHORT, - ClassConstants.INTERNAL_TYPE_INT, - ClassConstants.INTERNAL_TYPE_LONG, - ClassConstants.INTERNAL_TYPE_FLOAT, - ClassConstants.INTERNAL_TYPE_DOUBLE, + ClassConstants.TYPE_VOID, + ClassConstants.TYPE_BOOLEAN, + ClassConstants.TYPE_BYTE, + ClassConstants.TYPE_CHAR, + ClassConstants.TYPE_SHORT, + ClassConstants.TYPE_INT, + ClassConstants.TYPE_LONG, + ClassConstants.TYPE_FLOAT, + ClassConstants.TYPE_DOUBLE, }; @@ -98,7 +98,7 @@ public class ClassNameParser implements StringParser // remainder of the string. nextMatcher = new VariableStringMatcher(null, - new char[] { ClassConstants.INTERNAL_TYPE_CLASS_END }, + new char[] { ClassConstants.TYPE_CLASS_END }, 0, Integer.MAX_VALUE, parse(regularExpression.substring(index + 2))); @@ -112,7 +112,7 @@ public class ClassNameParser implements StringParser // remainder of the string. nextMatcher = new VariableStringMatcher(null, - new char[] { ClassConstants.INTERNAL_TYPE_CLASS_END, ClassConstants.INTERNAL_PACKAGE_SEPARATOR }, + new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR }, 0, Integer.MAX_VALUE, parse(regularExpression.substring(index + 1))); @@ -126,7 +126,7 @@ public class ClassNameParser implements StringParser // remainder of the string. nextMatcher = new VariableStringMatcher(null, - new char[] { ClassConstants.INTERNAL_TYPE_CLASS_END, ClassConstants.INTERNAL_PACKAGE_SEPARATOR }, + new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR }, 1, 1, parse(regularExpression.substring(index + 1))); @@ -158,14 +158,13 @@ public class ClassNameParser implements StringParser // Small utility methods. - /** * Creates a StringMatcher that matches any type (class or primitive type, * array or non-array) and then the given matcher. */ private VariableStringMatcher createAnyTypeMatcher(StringMatcher nextMatcher) { - return new VariableStringMatcher(new char[] { ClassConstants.INTERNAL_TYPE_ARRAY }, + return new VariableStringMatcher(new char[] { ClassConstants.TYPE_ARRAY }, null, 0, 255, @@ -175,15 +174,15 @@ public class ClassNameParser implements StringParser 1, 1, nextMatcher), - new VariableStringMatcher(new char[] { ClassConstants.INTERNAL_TYPE_CLASS_START }, + new VariableStringMatcher(new char[] { ClassConstants.TYPE_CLASS_START }, null, 1, 1, new VariableStringMatcher(null, - new char[] { ClassConstants.INTERNAL_TYPE_CLASS_END }, + new char[] { ClassConstants.TYPE_CLASS_END }, 0, Integer.MAX_VALUE, - new VariableStringMatcher(new char[] { ClassConstants.INTERNAL_TYPE_CLASS_END }, + new VariableStringMatcher(new char[] { ClassConstants.TYPE_CLASS_END }, null, 1, 1, diff --git a/src/proguard/util/ConstantMatcher.java b/src/proguard/util/ConstantMatcher.java index 8c0f1e1..d8b9223 100644 --- a/src/proguard/util/ConstantMatcher.java +++ b/src/proguard/util/ConstantMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/EmptyStringMatcher.java b/src/proguard/util/EmptyStringMatcher.java index f07c666..65c518d 100644 --- a/src/proguard/util/EmptyStringMatcher.java +++ b/src/proguard/util/EmptyStringMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/ExtensionMatcher.java b/src/proguard/util/ExtensionMatcher.java index eeb627a..5ee9175 100644 --- a/src/proguard/util/ExtensionMatcher.java +++ b/src/proguard/util/ExtensionMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/FileNameParser.java b/src/proguard/util/FileNameParser.java index 9ec6d22..a988ff8 100644 --- a/src/proguard/util/FileNameParser.java +++ b/src/proguard/util/FileNameParser.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/FixedStringMatcher.java b/src/proguard/util/FixedStringMatcher.java index 2f02271..bc81343 100644 --- a/src/proguard/util/FixedStringMatcher.java +++ b/src/proguard/util/FixedStringMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/ListMatcher.java b/src/proguard/util/ListMatcher.java index e07bff0..cad117d 100644 --- a/src/proguard/util/ListMatcher.java +++ b/src/proguard/util/ListMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/ListParser.java b/src/proguard/util/ListParser.java index b3b4518..c8e3dc4 100644 --- a/src/proguard/util/ListParser.java +++ b/src/proguard/util/ListParser.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/ListUtil.java b/src/proguard/util/ListUtil.java index 18bdce2..9004e69 100644 --- a/src/proguard/util/ListUtil.java +++ b/src/proguard/util/ListUtil.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/NameParser.java b/src/proguard/util/NameParser.java index f25d52e..30d7c5f 100644 --- a/src/proguard/util/NameParser.java +++ b/src/proguard/util/NameParser.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/NotMatcher.java b/src/proguard/util/NotMatcher.java index af539d0..7820cc8 100644 --- a/src/proguard/util/NotMatcher.java +++ b/src/proguard/util/NotMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/ObjectUtil.java b/src/proguard/util/ObjectUtil.java index c5de36a..4d2c159 100644 --- a/src/proguard/util/ObjectUtil.java +++ b/src/proguard/util/ObjectUtil.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/OrMatcher.java b/src/proguard/util/OrMatcher.java index 7ad85c4..b51809c 100644 --- a/src/proguard/util/OrMatcher.java +++ b/src/proguard/util/OrMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/SettableMatcher.java b/src/proguard/util/SettableMatcher.java index 8650ccc..3674a3e 100644 --- a/src/proguard/util/SettableMatcher.java +++ b/src/proguard/util/SettableMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/StringMatcher.java b/src/proguard/util/StringMatcher.java index 146dbfc..91fae4c 100644 --- a/src/proguard/util/StringMatcher.java +++ b/src/proguard/util/StringMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/StringParser.java b/src/proguard/util/StringParser.java index 39d04d5..8e49293 100644 --- a/src/proguard/util/StringParser.java +++ b/src/proguard/util/StringParser.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/util/VariableStringMatcher.java b/src/proguard/util/VariableStringMatcher.java index 5a07c2a..e83ed05 100644 --- a/src/proguard/util/VariableStringMatcher.java +++ b/src/proguard/util/VariableStringMatcher.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free |