1.1 --- a/rt/emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/reflect/MethodImpl.java Sat Sep 28 12:03:59 2013 +0200
1.2 +++ b/rt/emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/reflect/MethodImpl.java Thu May 22 15:29:40 2014 +0200
1.3 @@ -21,6 +21,7 @@
1.4 import java.lang.reflect.Constructor;
1.5 import java.lang.reflect.Method;
1.6 import java.util.Enumeration;
1.7 +import org.apidesign.bck2brwsr.core.Exported;
1.8 import org.apidesign.bck2brwsr.core.JavaScriptBody;
1.9
1.10 /** Utilities to work on methods.
1.11 @@ -126,7 +127,7 @@
1.12 }
1.13 return null;
1.14 }
1.15 -
1.16 +
1.17 public static Method[] findMethods(Class<?> clazz, int mask) {
1.18 Object[] namesAndData = findMethodData(clazz, "", false);
1.19 int cnt = 0;
1.20 @@ -137,6 +138,11 @@
1.21 if (middle == -1) {
1.22 continue;
1.23 }
1.24 + if (sig.startsWith("$") && sig.endsWith("$")) {
1.25 + // produced by Closure compiler in debug mode
1.26 + // needs to be ignored
1.27 + continue;
1.28 + }
1.29 String name = sig.substring(0, middle);
1.30 sig = sig.substring(middle + 2);
1.31 Class<?> cls = (Class<?>) namesAndData[i + 2];
1.32 @@ -152,7 +158,8 @@
1.33 }
1.34 return arr;
1.35 }
1.36 - static String toSignature(Method m) {
1.37 +
1.38 + @Exported static String toSignature(Method m) {
1.39 StringBuilder sb = new StringBuilder();
1.40 sb.append(m.getName()).append("__");
1.41 appendType(sb, m.getReturnType());
1.42 @@ -222,9 +229,17 @@
1.43 public static Enumeration<Class> signatureParser(final String sig) {
1.44 class E implements Enumeration<Class> {
1.45 int pos;
1.46 + int len;
1.47 +
1.48 + E() {
1.49 + len = sig.length();
1.50 + while (sig.charAt(len - 1) == '$') {
1.51 + len--;
1.52 + }
1.53 + }
1.54
1.55 public boolean hasMoreElements() {
1.56 - return pos < sig.length();
1.57 + return pos < len;
1.58 }
1.59
1.60 public Class nextElement() {