Revision: 10275
Author:   [email protected]
Date:     Fri Jun  3 12:47:44 2011
Log: fixes a bug in TypeOracle that marked vararg methods with the transient modifier, which is illegal for methods

Review at http://gwt-code-reviews.appspot.com/1447817

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=10275

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/javac/Shared.java
 /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/JConstructor.java
 /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/JField.java
 /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/JMethod.java
 /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/TypeOracle.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/javac/Shared.java Tue Nov 10 20:42:30 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/Shared.java Fri Jun 3 12:47:44 2011
@@ -33,8 +33,6 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;

 /**
  * A grab bag of utility functions useful for dealing with java files.
@@ -164,48 +162,4 @@
     path = path.substring(0, path.lastIndexOf('.'));
     return path.replace('/', '.');
   }
-
-  static String[] modifierBitsToNames(int bits) {
-    List<String> strings = new ArrayList<String>();
-
-    // The order is based on the order in which we want them to appear.
-    //
-    if (0 != (bits & MOD_PUBLIC)) {
-      strings.add("public");
-    }
-
-    if (0 != (bits & MOD_PRIVATE)) {
-      strings.add("private");
-    }
-
-    if (0 != (bits & MOD_PROTECTED)) {
-      strings.add("protected");
-    }
-
-    if (0 != (bits & MOD_STATIC)) {
-      strings.add("static");
-    }
-
-    if (0 != (bits & MOD_ABSTRACT)) {
-      strings.add("abstract");
-    }
-
-    if (0 != (bits & MOD_FINAL)) {
-      strings.add("final");
-    }
-
-    if (0 != (bits & MOD_NATIVE)) {
-      strings.add("native");
-    }
-
-    if (0 != (bits & MOD_TRANSIENT)) {
-      strings.add("transient");
-    }
-
-    if (0 != (bits & MOD_VOLATILE)) {
-      strings.add("volatile");
-    }
-
-    return strings.toArray(NO_STRINGS);
-  }
-}
+}
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/JConstructor.java Thu Dec 9 10:54:59 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/JConstructor.java Fri Jun 3 12:47:44 2011
@@ -62,7 +62,7 @@

   @Override
   public String getReadableDeclaration() {
-    String[] names = TypeOracle.modifierBitsToNames(getModifierBits());
+ String[] names = TypeOracle.modifierBitsToNamesForMethod(getModifierBits());
     StringBuilder sb = new StringBuilder();
     for (String name : names) {
       sb.append(name);
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/JField.java Wed Feb 9 13:08:24 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/JField.java Fri Jun 3 12:47:44 2011
@@ -135,7 +135,7 @@

   @Override
   public String toString() {
-    String[] names = TypeOracle.modifierBitsToNames(modifierBits);
+    String[] names = TypeOracle.modifierBitsToNamesForField(modifierBits);
     StringBuffer sb = new StringBuffer();
     for (int i = 0; i < names.length; i++) {
       if (i > 0) {
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/JMethod.java Thu Dec 9 10:54:59 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/JMethod.java Fri Jun 3 12:47:44 2011
@@ -129,7 +129,7 @@
   }

   String getReadableDeclaration(int modifierBits) {
-    String[] names = TypeOracle.modifierBitsToNames(modifierBits);
+    String[] names = TypeOracle.modifierBitsToNamesForMethod(modifierBits);
     StringBuilder sb = new StringBuilder();
     for (String name : names) {
       sb.append(name);
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/TypeOracle.java Mon Mar 21 12:22:19 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/typemodel/TypeOracle.java Fri Jun 3 12:47:44 2011
@@ -204,7 +204,48 @@
     });
   }

-  static String[] modifierBitsToNames(int bits) {
+  static String[] modifierBitsToNamesForField(int bits) {
+    List<String> strings = modifierBitsToNamesForMethodsAndFields(bits);
+
+    if (0 != (bits & MOD_VOLATILE)) {
+      strings.add("volatile");
+    }
+
+    if (0 != (bits & MOD_TRANSIENT)) {
+      strings.add("transient");
+    }
+
+    return strings.toArray(NO_STRINGS);
+  }
+
+  static String[] modifierBitsToNamesForMethod(int bits) {
+    List<String> strings = modifierBitsToNamesForMethodsAndFields(bits);
+
+    if (0 != (bits & MOD_ABSTRACT)) {
+      strings.add("abstract");
+    }
+
+    if (0 != (bits & MOD_NATIVE)) {
+      strings.add("native");
+    }
+
+    return strings.toArray(NO_STRINGS);
+  }
+
+ private static JClassType[] cast(com.google.gwt.core.ext.typeinfo.JClassType[] extTypeArgs) {
+    JClassType[] result = new JClassType[extTypeArgs.length];
+    System.arraycopy(extTypeArgs, 0, result, 0, extTypeArgs.length);
+    return result;
+  }
+
+  /**
+   * Converts modifier bits, which are common to fields and methods, to
+   * readable names.
+   *
+ * @see TypeOracle#modifierBitsToNamesForField(int) modifierBitsToNamesForField + * @see TypeOracle#modifierBitsToNamesForMethod(int) modifierBitsToNamesForMethod
+   */
+ private static List<String> modifierBitsToNamesForMethodsAndFields(int bits) {
     List<String> strings = new ArrayList<String>();

     // The order is based on the order in which we want them to appear.
@@ -224,34 +265,12 @@
     if (0 != (bits & MOD_STATIC)) {
       strings.add("static");
     }
-
-    if (0 != (bits & MOD_ABSTRACT)) {
-      strings.add("abstract");
-    }

     if (0 != (bits & MOD_FINAL)) {
       strings.add("final");
     }

-    if (0 != (bits & MOD_NATIVE)) {
-      strings.add("native");
-    }
-
-    if (0 != (bits & MOD_TRANSIENT)) {
-      strings.add("transient");
-    }
-
-    if (0 != (bits & MOD_VOLATILE)) {
-      strings.add("volatile");
-    }
-
-    return strings.toArray(NO_STRINGS);
-  }
-
- private static JClassType[] cast(com.google.gwt.core.ext.typeinfo.JClassType[] extTypeArgs) {
-    JClassType[] result = new JClassType[extTypeArgs.length];
-    System.arraycopy(extTypeArgs, 0, result, 0, extTypeArgs.length);
-    return result;
+    return strings;
   }

   /**

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to