Package com.caucho.bytecode

Examples of com.caucho.bytecode.MethodRefConstant


      if (fieldRef == null)
        return;

      _fieldRef = fieldRef.getIndex();

      MethodRefConstant methodRef;

      String getterName = "__caucho_get_" + fieldName;

      methodRef = pool.addMethodRef(baseClass.getThisClass(),
                                    getterName,
                                    "()" + fieldRef.getType());

      _getterRef = methodRef.getIndex();

      String setterName = "__caucho_set_" + fieldName;

      methodRef = pool.addMethodRef(baseClass.getThisClass(),
                                    setterName,
                                    "(" + fieldRef.getType() + ")V");

      _setterRef = methodRef.getIndex();
    }
View Full Code Here


      if (fieldRef == null)
        return;

      _fieldRef = fieldRef.getIndex();

      MethodRefConstant methodRef;

      String getterName = "__caucho_get_" + fieldName;

      methodRef = pool.addMethodRef(baseClass.getThisClass(),
                                    getterName,
                                    "()" + fieldRef.getType());

      _getterRef = methodRef.getIndex();

      String setterName = "__caucho_set_" + fieldName;

      methodRef = pool.addMethodRef(baseClass.getThisClass(),
                                    setterName,
                                    "(" + fieldRef.getType() + ")V");

      _setterRef = methodRef.getIndex();
    }
View Full Code Here

      switch (visitor.getOpcode()) {
      case CodeVisitor.INVOKESPECIAL:
        JavaClass javaClass = visitor.getJavaClass();
        ConstantPool cp = javaClass.getConstantPool();
        MethodRefConstant ref = cp.getMethodRef(visitor.getShortArg());

        // ejb/0l00
        // handler "super()" and "this()"
        if (ref.getName().equals("<init>")
      && (ref.getClassName().equals(javaClass.getThisClass())
    || ref.getClassName().equals(javaClass.getSuperClassName()))) {
          _offset = visitor.getOffset() + 3;
        }
        break;
      }
    }
View Full Code Here

      case CodeVisitor.INVOKESPECIAL:
        int index = visitor.getShortArg();

  JavaClass jClass = visitor.getJavaClass();
        ConstantPool cp = jClass.getConstantPool();
        MethodRefConstant ref;
        ref = cp.getMethodRef(index);

  if (ref.getName().endsWith("__super")) {
    return;
  }
  else if (ref.getName().equals("<init>")
     && (! ref.getClassName().equals(jClass.getSuperClassName())
         || ! _method.getName().equals("<init>"))) {
    return;
  }
  else if (! ref.getName().equals("<init>")) {
    // private methods are called with invokespecial, but shouldn't
    // be modified
    JMethod method = findMethod(jClass,
              ref.getName(),
              ref.getType());

    if (method != null && method.isPrivate())
      return;
  }

  String superName;
        if (ref.getName().equals("<init>"))
    superName = "__init__super";
  else
    superName = ref.getName() + "__super";

        MethodRefConstant newRef;
        newRef = cp.addMethodRef(ref.getClassName(),
                                 superName,
                                 ref.getType());

        visitor.setShortArg(1, newRef.getIndex());

        _isEnhanced = true;
        break;
      }
    }
View Full Code Here

    for (int i = 0; i < entries.size(); i++) {
      ConstantPoolEntry entry = entries.get(i);

      if (entry instanceof MethodRefConstant) {
        MethodRefConstant methodRef = (MethodRefConstant) entry;

        if (! methodRef.getClassName().equals(baseName))
          continue;

        String methodName = methodRef.getName();
        String type = methodRef.getType();

        if (findMethod(baseClass, methodName, type) == null)
          continue;

        if (findMethod(extClass, methodName, type) == null)
View Full Code Here

      case CodeVisitor.INVOKESPECIAL:
        int index = visitor.getShortArg();

        JavaClass jClass = visitor.getJavaClass();
        ConstantPool cp = jClass.getConstantPool();
        MethodRefConstant ref;
        ref = cp.getMethodRef(index);

        if (ref.getName().endsWith("__super")) {
          return;
        }
        else if (ref.getName().equals("<init>")
                 && (! ref.getClassName().equals(jClass.getSuperClassName())
                     || ! _method.getName().equals("<init>"))) {
          return;
        }
        else if (! ref.getName().equals("<init>")) {
          // private methods are called with invokespecial, but shouldn't
          // be modified
          JMethod method = findMethod(jClass,
                                      ref.getName(),
                                      ref.getType());

          if (method != null && method.isPrivate())
            return;
        }

        String superName;
        if (ref.getName().equals("<init>"))
          superName = "__init__super";
        else
          superName = ref.getName() + "__super";

        MethodRefConstant newRef;
        newRef = cp.addMethodRef(ref.getClassName(),
                                 superName,
                                 ref.getType());

        visitor.setShortArg(1, newRef.getIndex());

        _isEnhanced = true;
        break;
      }
    }
View Full Code Here

    for (int i = 0; i < entries.size(); i++) {
      ConstantPoolEntry entry = entries.get(i);

      if (entry instanceof MethodRefConstant) {
        MethodRefConstant methodRef = (MethodRefConstant) entry;

        if (! methodRef.getClassName().equals(baseName))
          continue;

        String methodName = methodRef.getName();
        String type = methodRef.getType();

        if (findMethod(baseClass, methodName, type) == null)
          continue;

        if (findMethod(extClass, methodName, type) == null)
View Full Code Here

      switch (visitor.getOpcode()) {
      case CodeVisitor.INVOKESPECIAL:
        JavaClass javaClass = visitor.getJavaClass();
        ConstantPool cp = javaClass.getConstantPool();
        MethodRefConstant ref = cp.getMethodRef(visitor.getShortArg());

        // ejb/0l00
        // handler "super()" and "this()"
        if (ref.getName().equals("<init>")
            && (ref.getClassName().equals(javaClass.getThisClass())
                || ref.getClassName().equals(javaClass.getSuperClassName()))) {
          _offset = visitor.getOffset() + 3;
        }
        break;
      }
    }
View Full Code Here

TOP

Related Classes of com.caucho.bytecode.MethodRefConstant

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.