Package com.caucho.bytecode

Examples of com.caucho.bytecode.JavaMethod


    ArrayList<JavaMethod> methods = baseClass.getMethodList();

    // Move the __super methods
    ArrayList<JavaMethod> extMethods = extClass.getMethodList();
    for (int i = 0; i < extMethods.size(); i++) {
      JavaMethod extMethod = extMethods.get(i);

      fixupExtMethod(baseClass, extClass, extMethod);

      String baseName = extMethod.getName();

      if (baseName.endsWith("__super"))
        continue;

      String superName = baseName + "__super";

      int j;
      for (j = 0; j < methods.size(); j++) {
        JavaMethod method = methods.get(j);

        String type = method.getDescriptor();

        if (! method.getName().equals(baseName)
      || ! method.getDescriptor().equals(extMethod.getDescriptor()))
          continue;

        if (baseName.equals("<init>")) {
          baseClass.getConstantPool().addUTF8("__init__super");
          mergeInitMethods(baseClass, method, extClass, extMethod);
          break;
        }

        if (baseName.equals("<clinit>")) {
          concatenateMethods(baseClass, method, extClass, extMethod);
          break;
        }

        baseClass.getConstantPool().addUTF8(superName);
        method.setName(superName);
        baseClass.getConstantPool().addUTF8(type);
        method.setDescriptor(type);

        // set the super methods private
        int flags = method.getAccessFlags();
        flags = (flags & ~ACC_PUBLIC & ~ACC_PROTECTED) | ACC_PRIVATE;
        method.setAccessFlags(flags);
        break;
      }
    }
  }
View Full Code Here


  {
    ArrayList<JavaMethod> methods = baseClass.getMethodList();
    ArrayList<JavaMethod> extMethods = extClass.getMethodList();

    for (int i = 0; i < extMethods.size(); i++) {
      JavaMethod extMethod = extMethods.get(i);

      if (extMethod.getName().equals("<clinit>") &&
          findMethod(baseClass, "<clinit>",
                     extMethod.getDescriptor()) != null) {
        continue;
      }
      else if (extMethod.getName().equals("<init>"))
        continue;
      else if (extMethod.getName().endsWith("__super"))
        continue;

      log.finest("adding extension method: " + extClass.getThisClass() + ":" + extMethod.getName());

      JavaMethod method = extMethod.export(extClass, baseClass);

      methods.add(method);
    }
  }
View Full Code Here

  {
    ArrayList<JavaMethod> methods = cl.getMethodList();

    int j;
    for (j = 0; j < methods.size(); j++) {
      JavaMethod method = methods.get(j);

      if (method.getName().equals(name) &&
          method.getDescriptor().equals(descriptor))
        return method;
    }

    return null;
  }
View Full Code Here

      field.setDescriptor(replaceString(className, field.getDescriptor()));
    }

    ArrayList<JavaMethod> methods = extClass.getMethodList();
    for (int i = 0; i < methods.size(); i++) {
      JavaMethod method = methods.get(i);

      method.setName(replaceString(className, method.getName()));
      method.setDescriptor(replaceString(className, method.getDescriptor()));
    }
  }
View Full Code Here

        if (ann != null) {
          String name = method.getName();
          name = name.substring(0, name.length() - "__super".length());

          JavaMethod baseMethod;
          baseMethod = findMethod(baseClass, name, method.getDescriptor());

          if (baseMethod != null)
            baseMethod.addAttribute(ann);
        }
      }
    }
  }
View Full Code Here

          }

          // set private methods to protected
          ArrayList<JavaMethod> methods = cl.getMethodList();
          for (int i = 0; i < methods.size(); i++) {
            JavaMethod method = methods.get(i);

            int accessFlags = method.getAccessFlags();

            if ((accessFlags & ACC_PRIVATE) != 0) {
              accessFlags = (accessFlags & ~ ACC_PRIVATE) | ACC_PROTECTED;
              method.setAccessFlags(accessFlags);
            }
          }

          for (int i = 0; i < _enhancerList.size(); i++) {
            _enhancerList.get(i).preEnhance(cl);
View Full Code Here

    }

    // set private methods to protected
    ArrayList<JavaMethod> methods = jClass.getMethodList();
    for (int i = 0; i < methods.size(); i++) {
      JavaMethod method = methods.get(i);

      int accessFlags = method.getAccessFlags();

      if ((accessFlags & ACC_PRIVATE) != 0) {
        accessFlags = (accessFlags & ~ ACC_PRIVATE) | ACC_PROTECTED;
        method.setAccessFlags(accessFlags);
      }
    }

    return jClass;
  }
View Full Code Here

          }

          // set private methods to protected
          ArrayList<JavaMethod> methods = cl.getMethodList();
          for (int i = 0; i < methods.size(); i++) {
            JavaMethod method = methods.get(i);

            int accessFlags = method.getAccessFlags();

            if ((accessFlags & ACC_PRIVATE) != 0) {
              accessFlags = (accessFlags & ~ ACC_PRIVATE) | ACC_PROTECTED;
              method.setAccessFlags(accessFlags);
            }
          }

          for (int i = 0; i < _enhancerList.size(); i++) {
            _enhancerList.get(i).preEnhance(cl);
View Full Code Here

    }

    // set private methods to protected
    ArrayList<JavaMethod> methods = jClass.getMethodList();
    for (int i = 0; i < methods.size(); i++) {
      JavaMethod method = methods.get(i);

      int accessFlags = method.getAccessFlags();

      if ((accessFlags & ACC_PRIVATE) != 0) {
        accessFlags = (accessFlags & ~ ACC_PRIVATE) | ACC_PROTECTED;
        method.setAccessFlags(accessFlags);
      }
    }

    return jClass;
  }
View Full Code Here

        JavaField factoryField =
          jClass.createField("_factory",
                             "Lcom/caucho/config/inject/InjectManager$ReferenceFactory;");
        factoryField.setAccessFlags(Modifier.PRIVATE);

        JavaMethod ctor =
          jClass.createMethod("<init>",
                              "(Lcom/caucho/config/inject/InjectManager$ReferenceFactory;)V");
        ctor.setAccessFlags(Modifier.PUBLIC);

        CodeWriterAttribute code = ctor.createCodeWriter();
        code.setMaxLocals(3);
        code.setMaxStack(4);

        code.pushObjectVar(0);
        code.pushObjectVar(1);
View Full Code Here

TOP

Related Classes of com.caucho.bytecode.JavaMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.