src/share/classes/com/sun/tools/javac/comp/Lower.java

changeset 443
121e0ebf1658
parent 430
8fb9b4be3cb1
child 483
8e638442522a
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Nov 23 19:58:05 2009 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Dec 03 14:03:53 2009 -0800
     1.3 @@ -3117,7 +3117,6 @@
     1.4          tree.cases = translateCases(tree.cases);
     1.5          if (enumSwitch) {
     1.6              result = visitEnumSwitch(tree);
     1.7 -            patchTargets(result, tree, result);
     1.8          } else if (stringSwitch) {
     1.9              result = visitStringSwitch(tree);
    1.10          } else {
    1.11 @@ -3146,7 +3145,9 @@
    1.12                  cases.append(c);
    1.13              }
    1.14          }
    1.15 -        return make.Switch(selector, cases.toList());
    1.16 +        JCSwitch enumSwitch = make.Switch(selector, cases.toList());
    1.17 +        patchTargets(enumSwitch, tree, enumSwitch);
    1.18 +        return enumSwitch;
    1.19      }
    1.20  
    1.21      public JCTree visitStringSwitch(JCSwitch tree) {
    1.22 @@ -3187,7 +3188,14 @@
    1.23               * of String is the same in the compilation environment as
    1.24               * in the environment the code will run in.  The string
    1.25               * hashing algorithm in the SE JDK has been unchanged
    1.26 -             * since at least JDK 1.2.
    1.27 +             * since at least JDK 1.2.  Since the algorithm has been
    1.28 +             * specified since that release as well, it is very
    1.29 +             * unlikely to be changed in the future.
    1.30 +             *
    1.31 +             * Different hashing algorithms, such as the length of the
    1.32 +             * strings or a perfect hashing algorithm over the
    1.33 +             * particular set of case labels, could potentially be
    1.34 +             * used instead of String.hashCode.
    1.35               */
    1.36  
    1.37              ListBuffer<JCStatement> stmtList = new ListBuffer<JCStatement>();

mercurial