harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r766398 - in /harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex: AbstractSet.java IntArrHash.java Lexer.java Matcher.java Pattern.java SequenceSet.java
Date Sat, 18 Apr 2009 21:45:09 GMT
Author: ndbeyer
Date: Sat Apr 18 21:45:08 2009
New Revision: 766398

URL: http://svn.apache.org/viewvc?rev=766398&view=rev
Log:
remove unused code and optimize a few bits based on FindBugs analysis

Modified:
    harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractSet.java
    harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/IntArrHash.java
    harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Lexer.java
    harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java
    harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java
    harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/SequenceSet.java

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractSet.java?rev=766398&r1=766397&r2=766398&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractSet.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractSet.java
Sat Apr 18 21:45:08 2009
@@ -120,7 +120,6 @@
      */
     public int findBack(int stringIndex, int startSearch,
             CharSequence testString, MatchResultImpl matchResult) {
-        int shift;
         while (startSearch >= stringIndex) {
             if (matches(startSearch, testString, matchResult) >= 0) {
                 return startSearch;

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/IntArrHash.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/IntArrHash.java?rev=766398&r1=766397&r2=766398&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/IntArrHash.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/IntArrHash.java
Sat Apr 18 21:45:08 2009
@@ -21,22 +21,20 @@
  * Hashtable implementation for int arrays.
  */
 class IntArrHash {
-        int[] table;
+        final int[] table;
         
-        Object [] values;
+        final Object[] values;
                 
-        int mask;
-
-        int size; // maximum shift
+        final int mask;
 
         public IntArrHash(int size) {
-            while (size >= mask) {
-                mask = (mask << 1) | 1;
+            int tmpMask = 0;
+            while (size >= tmpMask) {
+                tmpMask = (tmpMask << 1) | 1;
             }
-            mask = (mask << 1) | 1;
+            mask = (tmpMask << 1) | 1;
             table = new int[mask + 1];
             values = new Object [mask + 1];
-            this.size = size;
         }
 
         public void put(int key, int [] value) {

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Lexer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Lexer.java?rev=766398&r1=766397&r2=766398&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Lexer.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Lexer.java
Sat Apr 18 21:45:08 2009
@@ -1028,14 +1028,13 @@
      * Process octal integer.
      */
     private int readOctals() {
-        char ch;
         int max = 3;
         int i = 1;
         int first;
         int res;
         int length = pattern.length - 2;
 
-        switch (first = Character.digit((ch = pattern[index]), 8)) {
+        switch (first = Character.digit(pattern[index], 8)) {
         case -1:
             throw new PatternSyntaxException(Messages.getString("regex.19") //$NON-NLS-1$
                     , this.toString(), index);
@@ -1048,7 +1047,7 @@
         }
 
         while (i < max && index < length
-                && (first = Character.digit((ch = pattern[index]), 8)) >= 0) {
+                && (first = Character.digit(pattern[index], 8)) >= 0) {
             res = res * 8 + first;
             nextIndex();
             i++;

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java?rev=766398&r1=766397&r2=766398&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Matcher.java
Sat Apr 18 21:45:08 2009
@@ -350,9 +350,10 @@
      */
     public boolean find(int start) {
         int stringLength = string.length();
-        if (start < 0 || start > stringLength)
+        if (start < 0 || start > stringLength) {
             throw new IndexOutOfBoundsException(Messages.getString("regex.03", //$NON-NLS-1$

-                    new Integer(start)));
+                    Integer.valueOf(start)));
+        }
 
         start = findAt(start);
         if (start >= 0 && matchResult.isValid()) {

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java?rev=766398&r1=766397&r2=766398&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java
Sat Apr 18 21:45:08 2009
@@ -153,8 +153,6 @@
      */
     transient private boolean needsBackRefReplacement = false;
 
-    transient private int groupIndex = -1;
-
     transient private int globalGroupIndex = -1;
 
     transient private int compCount = -1;
@@ -1441,7 +1439,6 @@
             throws java.io.IOException, ClassNotFoundException {
         s.defaultReadObject();
         AbstractSet.counter = 1;
-        groupIndex = -1;
         globalGroupIndex = -1;
         compCount = -1;
         consCount = -1;

Modified: harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/SequenceSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/SequenceSet.java?rev=766398&r1=766397&r2=766398&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/SequenceSet.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/SequenceSet.java
Sat Apr 18 21:45:08 2009
@@ -82,8 +82,7 @@
 
     public int findBack(int strIndex, int lastIndex, CharSequence testString,
             MatchResultImpl matchResult) {
-        String testStr = testString.toString();
-
+        
         while (lastIndex >= strIndex) {
             lastIndex = lastIndexOf(testString, strIndex, lastIndex);
 
@@ -162,7 +161,7 @@
         return true;
     }
 
-    class IntHash {
+    static class IntHash {
         int[] table, values;
 
         int mask;



Mime
View raw message