view patches/boot/ecj-stringswitch.patch @ 2454:71fb0f9294cb

Bump to b147. 2011-07-13 Andrew John Hughes <ahughes@redhat.com> Bump to b147. * Makefile.am: (OPENJDK_VERSION): Bumped to b147. (CORBA_CHANGESET): Updated. (HOTSPOT_CHANGESET): Likewise. (JAXP_CHANGESET): Likewise. (JAXWS_CHANGESET): Likewise. (JDK_CHANGESET): Likewise. (LANGTOOLS_CHANGESET): Likewise. (OPENJDK_CHANGESET): Likewise. (CORBA_SHA256SUM): Likewise. (HOTSPOT_SHA256SUM): Likewise. (JAXP_SHA256SUM): Likewise. (JAXWS_SHA256SUM): Likewise. (JDK_SHA256SUM): Likewise. (LANGTOOLS_SHA256SUM): Likewise. (OPENJDK_SHA256SUM): Likewise. (JAXWS_DROP_ZIP): Likewise. (JAXWS_DROP_SHA256SUM): Likewise. (JAXP_DROP_ZIP): Likewise. (JAXP_DROP_SHA256SUM): Likewise. (bootstrap-directory-stage1): Use our script for javah. * configure.ac: Generate script for javah. * javah.in: Filter -X commands from javah. * patches/boot/ecj-autoboxing.patch: Updated to apply against b147. * patches/boot/ecj-diamond.patch, * patches/boot/ecj-stringswitch.patch: Likewise and add new cases.
author Andrew John Hughes <ahughes@redhat.com>
date Wed, 13 Jul 2011 22:13:02 +0100
parents e53fc64228c1
children 05dda6fb5ced
line wrap: on
line source

diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java	2011-04-30 03:28:27.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java	2011-07-12 13:58:37.260113734 +0100
@@ -350,18 +350,15 @@
             if (attrCommands != null) {
                 Object lkey = Attribute.keyForLookup(ctype, name);
                 String cmd = (String) attrCommands.get(lkey);
-                if (cmd != null) {
-                    switch (cmd) {
-                        case "pass":
-                            String message1 = "passing attribute bitwise in " + h;
-                            throw new Attribute.FormatException(message1, ctype, name, cmd);
-                        case "error":
-                            String message2 = "attribute not allowed in " + h;
-                            throw new Attribute.FormatException(message2, ctype, name, cmd);
-                        case "strip":
-                            skip(length, name + " attribute in " + h);
-                            continue;
-                    }
+                if ("pass".equals(cmd)) {
+                    String message1 = "passing attribute bitwise in " + h;
+                    throw new Attribute.FormatException(message1, ctype, name, cmd);
+                } else if ("error".equals(cmd)) {
+                    String message2 = "attribute not allowed in " + h;
+                    throw new Attribute.FormatException(message2, ctype, name, cmd);
+                } else if ("strip".equals(cmd)) {
+                    skip(length, name + " attribute in " + h);
+                    continue;
                 }
             }
             // Find canonical instance of the requested attribute.
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java	2011-06-11 00:38:08.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java	2011-07-12 13:58:37.264113794 +0100
@@ -71,16 +71,14 @@
         {
             // Non-standard, undocumented "--unpack" switch enables unpack mode.
             String arg0 = av.isEmpty() ? "" : av.get(0);
-            switch (arg0) {
-                case "--pack":
+            if ("--pack".equals(arg0))
                 av.remove(0);
-                    break;
-                case "--unpack":
-                av.remove(0);
-                doPack = false;
-                doUnpack = true;
-                    break;
-            }
+            else if ("--unpack".equals(arg0))
+                {
+                    av.remove(0);
+                    doPack = false;
+                    doUnpack = true;
+                }
         }
 
         // Collect engine properties here:
@@ -180,21 +178,16 @@
         // Deal with remaining non-engine properties:
         for (String opt : avProps.keySet()) {
             String val = avProps.get(opt);
-            switch (opt) {
-                case "--repack":
-                    doRepack = true;
-                    break;
-                case "--no-gzip":
-                    doZip = (val == null);
-                    break;
-                case "--log-file=":
-                    logFile = val;
-                    break;
-                default:
-                    throw new InternalError(MessageFormat.format(
-                            RESOURCE.getString(DriverResource.BAD_OPTION),
-                            opt, avProps.get(opt)));
-            }
+            if ("--repack".equals(opt))
+                doRepack = true;
+            else if ("--no-gzip".equals(opt))
+                doZip = (val == null);
+            else if ("--log-file=".equals(opt))
+                logFile = val;
+            else
+                throw new InternalError(MessageFormat.format(
+                                                             RESOURCE.getString(DriverResource.BAD_OPTION),
+                                                             opt, avProps.get(opt)));
         }
 
         if (logFile != null && !logFile.equals("")) {
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java	2011-04-30 03:28:27.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java	2011-07-12 13:58:37.264113794 +0100
@@ -1116,30 +1116,25 @@
         // what is one of { Debug, Compile, Constant, Exceptions, InnerClasses }
         if (verbose > 0)
             Utils.log.info("Stripping "+what.toLowerCase()+" data and attributes...");
-        switch (what) {
-            case "Debug":
-                strip("SourceFile");
-                strip("LineNumberTable");
-                strip("LocalVariableTable");
-                strip("LocalVariableTypeTable");
-                break;
-            case "Compile":
-                // Keep the inner classes normally.
-                // Although they have no effect on execution,
-                // the Reflection API exposes them, and JCK checks them.
-                // NO: // strip("InnerClasses");
-                strip("Deprecated");
-                strip("Synthetic");
-                break;
-            case "Exceptions":
-                // Keep the exceptions normally.
-                // Although they have no effect on execution,
-                // the Reflection API exposes them, and JCK checks them.
-                strip("Exceptions");
-                break;
-            case "Constant":
-                stripConstantFields();
-                break;
+        if ("Debug".equals(what)) {
+            strip("SourceFile");
+            strip("LineNumberTable");
+            strip("LocalVariableTable");
+            strip("LocalVariableTypeTable");
+        } else if ("Compile".equals(what)) {
+            // Keep the inner classes normally.
+            // Although they have no effect on execution,
+            // the Reflection API exposes them, and JCK checks them.
+            // NO: // strip("InnerClasses");
+            strip("Deprecated");
+            strip("Synthetic");
+        } else if ("Exceptions".equals(what)) {
+            // Keep the exceptions normally.
+            // Although they have no effect on execution,
+            // the Reflection API exposes them, and JCK checks them.
+            strip("Exceptions");
+        } else if ("Constant".equals(what)) {
+            stripConstantFields();
         }
     }
 
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java openjdk-boot/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java	2011-04-30 03:28:32.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java	2011-07-12 13:58:37.264113794 +0100
@@ -64,17 +64,23 @@
 
     protected NTLM(String version) throws NTLMException {
         if (version == null) version = "LMv2/NTLMv2";
-        switch (version) {
-            case "LM": v = NTLM; writeLM = true; writeNTLM = false; break;
-            case "NTLM": v = NTLM; writeLM = false; writeNTLM = true; break;
-            case "LM/NTLM": v = NTLM; writeLM = writeNTLM = true; break;
-            case "NTLM2": v = NTLM2; writeLM = writeNTLM = true; break;
-            case "LMv2": v = NTLMv2; writeLM = true; writeNTLM = false; break;
-            case "NTLMv2": v = NTLMv2; writeLM = false; writeNTLM = true; break;
-            case "LMv2/NTLMv2": v = NTLMv2; writeLM = writeNTLM = true; break;
-            default: throw new NTLMException(NTLMException.BAD_VERSION,
-                    "Unknown version " + version);
-        }
+        if (version.equals("LM"))
+          { v = NTLM; writeLM = true; writeNTLM = false; }
+        else if (version.equals("NTLM"))
+          { v = NTLM; writeLM = false; writeNTLM = true; }
+        else if (version.equals("LM/NTLM"))
+          { v = NTLM; writeLM = writeNTLM = true; }
+        else if (version.equals("NTLM2"))
+          { v = NTLM2; writeLM = writeNTLM = true; }
+        else if (version.equals("LMv2"))
+          { v = NTLMv2; writeLM = true; writeNTLM = false; }
+        else if (version.equals("NTLMv2"))
+          { v = NTLMv2; writeLM = false; writeNTLM = true; }
+        else if (version.equals("LMv2/NTLMv2"))
+          { v = NTLMv2; writeLM = writeNTLM = true; }
+        else
+          throw new NTLMException(NTLMException.BAD_VERSION,
+                                  "Unknown version " + version);
         try {
             fac = SecretKeyFactory.getInstance ("DES");
             cipher = Cipher.getInstance ("DES/ECB/NoPadding");
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/launcher/LauncherHelper.java openjdk-boot/jdk/src/share/classes/sun/launcher/LauncherHelper.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/launcher/LauncherHelper.java	2011-06-11 00:38:09.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/launcher/LauncherHelper.java	2011-07-12 13:58:37.268113854 +0100
@@ -117,24 +117,20 @@
         String optStr = (opts.length > 1 && opts[1] != null)
                 ? opts[1].trim()
                 : "all";
-        switch (optStr) {
-            case "vm":
+        if ("vm".equals(optStr))
+            printVmSettings(ostream, initialHeapSize, maxHeapSize,
+                            stackSize, isServer);
+        else if ("properties".equals(optStr))
+            printProperties(ostream);
+        else if ("locale".equals(optStr))
+            printLocale(ostream);
+        else
+            {
                 printVmSettings(ostream, initialHeapSize, maxHeapSize,
-                        stackSize, isServer);
-                break;
-            case "properties":
+                                stackSize, isServer);
                 printProperties(ostream);
-                break;
-            case "locale":
                 printLocale(ostream);
-                break;
-            default:
-                printVmSettings(ostream, initialHeapSize, maxHeapSize,
-                        stackSize, isServer);
-                printProperties(ostream);
-                printLocale(ostream);
-                break;
-        }
+            }
     }
 
     /*
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java openjdk-boot/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	2011-04-30 03:28:32.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	2011-07-12 13:58:37.268113854 +0100
@@ -383,19 +383,23 @@
             GE;         // ">="
 
             static Operator of(String s) {
-                switch (s) {
-                    case "==":
-                        return EQ;
-                    case "!=":
-                        return NE;
-                    case "<":
-                        return LT;
-                    case "<=":
-                        return LE;
-                    case ">":
-                        return GT;
-                    case ">=":
-                        return GE;
+                if ("==".equals(s)) {
+                    return EQ;
+                }
+                if ("!=".equals(s)) {
+                    return NE;
+                }
+                if ("<".equals(s)) {
+                    return LT;
+                }
+                if ("<=".equals(s)) {
+                    return LE;
+                }
+                if (">".equals(s)) {
+                    return GT;
+                }
+                if (">=".equals(s)) {
+                    return GE;
                 }
 
                 throw new IllegalArgumentException(
diff -r 483d8dacfbd8 src/share/classes/java/lang/invoke/MethodHandleProxies.java
--- openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java	Mon Jul 11 22:06:00 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java	Tue Jul 12 19:06:31 2011 +0100
@@ -211,14 +211,16 @@
 
     private static
     boolean isObjectMethod(Method m) {
-        switch (m.getName()) {
-        case "toString":
+        String name = m.getName();
+        if ("toString".equals(name)) {
             return (m.getReturnType() == String.class
                     && m.getParameterTypes().length == 0);
-        case "hashCode":
+        }
+        if ("hashCode".equals(name)) {
             return (m.getReturnType() == int.class
                     && m.getParameterTypes().length == 0);
-        case "equals":
+        }
+        if ("equals".equals(name)) {
             return (m.getReturnType() == boolean.class
                     && m.getParameterTypes().length == 1
                     && m.getParameterTypes()[0] == Object.class);
@@ -229,12 +231,14 @@
     private static
     Object callObjectMethod(Object self, Method m, Object[] args) {
         assert(isObjectMethod(m)) : m;
-        switch (m.getName()) {
-        case "toString":
+        String name = m.getName();
+        if ("toString".equals(name)) {
             return self.getClass().getName() + "@" + Integer.toHexString(self.hashCode());
-        case "hashCode":
+        }
+        if ("hashCode".equals(name)) {
             return System.identityHashCode(self);
-        case "equals":
+        }
+        if ("equals".equals(name)) {
             return (self == args[0]);
         }
         return null;