No need to collect own methods - they are treated the same way as others
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 11 Jul 2013 20:30:39 +0200
changeset 1895c78e49bd297
parent 188 5f3b1d7fafec
child 190 c53532068a03
No need to collect own methods - they are treated the same way as others
boot/src/main/java/org/apidesign/html/boot/impl/FnUtils.java
boot/src/main/java/org/apidesign/html/boot/impl/JsClassLoader.java
     1.1 --- a/boot/src/main/java/org/apidesign/html/boot/impl/FnUtils.java	Thu Jul 11 17:58:45 2013 +0200
     1.2 +++ b/boot/src/main/java/org/apidesign/html/boot/impl/FnUtils.java	Thu Jul 11 20:30:39 2013 +0200
     1.3 @@ -28,9 +28,7 @@
     1.4  import java.util.Collections;
     1.5  import java.util.Enumeration;
     1.6  import java.util.List;
     1.7 -import java.util.Map;
     1.8  import org.apidesign.html.boot.spi.Fn;
     1.9 -import org.objectweb.asm.Type;
    1.10  
    1.11  /**
    1.12   *
    1.13 @@ -76,7 +74,7 @@
    1.14          };
    1.15      }
    1.16  
    1.17 -    static String callback(final String body, final ClassLoader loader, final String ownName, final Map<String,String> ownMethods) {
    1.18 +    static String callback(final String body) {
    1.19          return new JsCallback() {
    1.20              @Override
    1.21              protected CharSequence callMethod(
     2.1 --- a/boot/src/main/java/org/apidesign/html/boot/impl/JsClassLoader.java	Thu Jul 11 17:58:45 2013 +0200
     2.2 +++ b/boot/src/main/java/org/apidesign/html/boot/impl/JsClassLoader.java	Thu Jul 11 20:30:39 2013 +0200
     2.3 @@ -27,9 +27,7 @@
     2.4  import java.net.URL;
     2.5  import java.util.ArrayList;
     2.6  import java.util.Enumeration;
     2.7 -import java.util.HashMap;
     2.8  import java.util.List;
     2.9 -import java.util.Map;
    2.10  import org.objectweb.asm.AnnotationVisitor;
    2.11  import org.objectweb.asm.ClassReader;
    2.12  import org.objectweb.asm.ClassVisitor;
    2.13 @@ -95,11 +93,11 @@
    2.14                  is.close();
    2.15                  is = null;
    2.16                  ClassReader cr = new ClassReader(arr);
    2.17 -                FindInClass tst = new FindInClass(null, new HashMap<String,String>());
    2.18 +                FindInClass tst = new FindInClass(null);
    2.19                  cr.accept(tst, 0);
    2.20                  if (tst.found > 0) {
    2.21                      ClassWriter w = new ClassWriterEx(cr, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
    2.22 -                    FindInClass fic = new FindInClass(w, tst.methods);
    2.23 +                    FindInClass fic = new FindInClass(w);
    2.24                      cr.accept(fic, 0);
    2.25                      arr = w.toByteArray();
    2.26                  }
    2.27 @@ -132,11 +130,9 @@
    2.28      private final class FindInClass extends ClassVisitor {
    2.29          private String name;
    2.30          private int found;
    2.31 -        private final Map<String,String> methods;
    2.32          
    2.33 -        public FindInClass(ClassVisitor cv, Map<String,String> methods) {
    2.34 +        public FindInClass(ClassVisitor cv) {
    2.35              super(Opcodes.ASM4, cv);
    2.36 -            this.methods = methods;
    2.37          }
    2.38  
    2.39          @Override
    2.40 @@ -157,7 +153,6 @@
    2.41          @Override
    2.42          public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    2.43              int end = desc.indexOf(')');
    2.44 -            methods.put(name + desc.substring(0, end + 1), desc);
    2.45              
    2.46              return new FindInMethod(access, name, desc,
    2.47                  super.visitMethod(access & (~Opcodes.ACC_NATIVE), name, desc, signature, exceptions)
    2.48 @@ -421,7 +416,7 @@
    2.49                  public void visitEnd() {
    2.50                      if (body != null) {
    2.51                          if (javacall) {
    2.52 -                            body = FnUtils.callback(body, JsClassLoader.this, FindInClass.this.name, FindInClass.this.methods);
    2.53 +                            body = FnUtils.callback(body);
    2.54                              args.add("vm");
    2.55                          }
    2.56                          generateJSBody(args, body);