Package javassist.bytecode

Examples of javassist.bytecode.CodeAttribute


  public static String getSignature(CtBehavior method)
      throws NotFoundException {

    CtClass parameterTypes[] = method.getParameterTypes();

    CodeAttribute codeAttribute = method.getMethodInfo().getCodeAttribute();

    LocalVariableAttribute locals = null;

    if (codeAttribute != null) {
      AttributeInfo attribute;
      attribute = codeAttribute.getAttribute("LocalVariableTable");
      locals = (LocalVariableAttribute) attribute;
    }

    String methodName = method.getName();
View Full Code Here


          || methodName.startsWith(EACH_WRITE_METHOD_PREFIX)
          || methodName.equals(GETFIELDHANDLER_METHOD_NAME)
          || methodName.equals(SETFIELDHANDLER_METHOD_NAME)) {
        continue;
      }
      CodeAttribute codeAttr = minfo.getCodeAttribute();
      if (codeAttr == null) {
        return;
      }
      CodeIterator iter = codeAttr.iterator();
      while (iter.hasNext()) {
        try {
          int pos = iter.next();
          pos = transformInvokevirtualsIntoGetfields(classfile, iter, pos);
          pos = transformInvokevirtualsIntoPutfields(classfile, iter, pos);
View Full Code Here

    code.addIndex( fieldIndex );
    // areturn // return the value of the field
    code.addOpcode( Opcode.ARETURN );
    getterMethodInfo.setCodeAttribute( code.toCodeAttribute() );
    getterMethodInfo.setAccessFlags( AccessFlag.PUBLIC );
    final CodeAttribute codeAttribute = getterMethodInfo.getCodeAttribute();
    if ( codeAttribute != null ) {
      final StackMapTable smt = MapMaker.make( classPool, getterMethodInfo );
      codeAttribute.setAttribute( smt );
    }
    classfile.addMethod( getterMethodInfo );
  }
View Full Code Here

    code.addIndex( fieldIndex );
    // return
    code.addOpcode( Opcode.RETURN );
    methodInfo.setCodeAttribute( code.toCodeAttribute() );
    methodInfo.setAccessFlags( AccessFlag.PUBLIC );
    final CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
    if ( codeAttribute != null ) {
      final StackMapTable smt = MapMaker.make( classPool, methodInfo );
      codeAttribute.setAttribute( smt );
    }
    classfile.addMethod( methodInfo );
  }
View Full Code Here

    // *return // each type
    addTypeDependDataReturn( code, finfo.getDescriptor() );

    readMethodInfo.setCodeAttribute( code.toCodeAttribute() );
    readMethodInfo.setAccessFlags( AccessFlag.PUBLIC );
    final CodeAttribute codeAttribute = readMethodInfo.getCodeAttribute();
    if ( codeAttribute != null ) {
      final StackMapTable smt = MapMaker.make( classPool, readMethodInfo );
      codeAttribute.setAttribute( smt );
    }
    classfile.addMethod( readMethodInfo );
  }
View Full Code Here

    // return
    code.addOpcode( Opcode.RETURN );

    writeMethodInfo.setCodeAttribute( code.toCodeAttribute() );
    writeMethodInfo.setAccessFlags( AccessFlag.PUBLIC );
    final CodeAttribute codeAttribute = writeMethodInfo.getCodeAttribute();
    if ( codeAttribute != null ) {
      final StackMapTable smt = MapMaker.make( classPool, writeMethodInfo );
      codeAttribute.setAttribute( smt );
    }
    classfile.addMethod( writeMethodInfo );
  }
View Full Code Here

          || methodName.equals( GETFIELDHANDLER_METHOD_NAME )
          || methodName.equals( SETFIELDHANDLER_METHOD_NAME ) ) {
        continue;
      }

      final CodeAttribute codeAttr = methodInfo.getCodeAttribute();
      if ( codeAttr == null ) {
        continue;
      }

      final CodeIterator iter = codeAttr.iterator();
      while ( iter.hasNext() ) {
        int pos = iter.next();
        pos = transformInvokevirtualsIntoGetfields( classfile, iter, pos );
        transformInvokevirtualsIntoPutfields( classfile, iter, pos );
      }
      final StackMapTable smt = MapMaker.make( classPool, methodInfo );
      codeAttr.setAttribute( smt );
    }
  }
View Full Code Here

    }
    else {
      // return
      code.addOpcode( Opcode.RETURN );
    }
    final CodeAttribute ca = code.toCodeAttribute();
    if ( stackmap != null ) {
      ca.setAttribute( stackmap );
    }
    setterMethodInfo.setCodeAttribute( ca );
    setterMethodInfo.setAccessFlags( AccessFlag.PUBLIC );
    classfile.addMethod( setterMethodInfo );
  }
View Full Code Here

          || methodName.startsWith(EACH_WRITE_METHOD_PREFIX)
          || methodName.equals(GETFIELDHANDLER_METHOD_NAME)
          || methodName.equals(SETFIELDHANDLER_METHOD_NAME)) {
        continue;
      }
      CodeAttribute codeAttr = minfo.getCodeAttribute();
      if (codeAttr == null) {
        return;
      }
      CodeIterator iter = codeAttr.iterator();
      while (iter.hasNext()) {
        try {
          int pos = iter.next();
          pos = transformInvokevirtualsIntoGetfields(classfile, iter, pos);
          pos = transformInvokevirtualsIntoPutfields(classfile, iter, pos);
View Full Code Here

          || methodName.startsWith(EACH_WRITE_METHOD_PREFIX)
          || methodName.equals(GETFIELDHANDLER_METHOD_NAME)
          || methodName.equals(SETFIELDHANDLER_METHOD_NAME)) {
        continue;
      }
      CodeAttribute codeAttr = minfo.getCodeAttribute();
      if (codeAttr == null) {
        continue;
      }
      CodeIterator iter = codeAttr.iterator();
      while (iter.hasNext()) {
        try {
          int pos = iter.next();
          pos = transformInvokevirtualsIntoGetfields(classfile, iter,
                                                     pos);
View Full Code Here

TOP

Related Classes of javassist.bytecode.CodeAttribute

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.