[kaffe] Re: error:Switch label must be constant [JLS 14.10]

Ito Kazumitsu ito.kazumitsu@hitachi-cable.co.jp
Thu Nov 20 18:40:02 2003


Hi,

The following patch solved this problem although it
reduced performance.

--- kopi-2.1B/src/kjc/Main.java	2002-07-16 03:53:32.000000000 +0900
+++ test/Main.java	2003-11-21 11:33:46.000000000 +0900
@@ -179,6 +179,18 @@
 	return false;
       }
 
+      /* Check once again.
+       * If we could know whether this second round of checkInitializers is
+       * needed or not,  we would be able to skip it.
+       */
+      for (int count = 0; count < tree.length; count++) {
+	checkInitializers(tree[count]);
+      }
+
+      if (errorFound) {
+	return false;
+      }
+
       for (int count = 0; count < tree.length; count++) {
         checkBody(tree[count]);
         if (!options.java && !options.beautify && !(environment.getAssertExtension() == KjcEnvironment.AS_ALL)) {