Package org.objectweb.asm

Examples of org.objectweb.asm.Type


      Field f = class_.getDeclaredField(fieldName);
      if ((f.getModifiers() & Modifier.STATIC) == 0) {
        // not a static field
        return false;
      }
      Type fieldType = Type.getType(f.getType());
      Type argType = Type.getType(fieldDescriptor);

      return argType.equals(fieldType);
    } catch (NoSuchFieldException nsfe) {
      return false;
    }
  }
View Full Code Here


    abstract void insertValue(String name, Object value);

    public void visit(String name, Object value) {
      Object v;
      if (value instanceof Type) {
        Type t = (Type) value;
        v = getClass(t.getClassName());
      } else {
        v = value;
      }

      insertValue(name, v);
View Full Code Here

    for (int i = 0; i < argTypes.length; ++i) {
      argTypes[i] = getMirrorType(argTypes[i]);
    }

    final Type returnType = getMirrorType(Type.getReturnType(descriptor));

    return Type.getMethodDescriptor(returnType, argTypes);
  }
View Full Code Here

   * Translates a simple type descriptor, specifically. Only translates names in the
   * descriptor, if they are represented by class mirrors.
   *
   */
  protected String translateDescriptor(final String descriptor) {
    Type type = Type.getType(descriptor);

    type = getMirrorType(type);

    return type.getDescriptor();
  }
View Full Code Here

    return type.getDescriptor();
  }

  private Type getMirrorType(final Type type) {
    int numDimensions = 0;
    final Type basicType;

    if (type.getSort() == Type.ARRAY) {
      numDimensions = type.getDimensions();
      basicType = type.getElementType();
    } else {
      basicType = type;
    }

    if (basicType.getSort() != Type.OBJECT) {
      return type;
    }

    final Mirror mirror = getMirror(basicType.getInternalName());

    if (mirror.isClassMirror()) {
      final StringBuilder name = new StringBuilder();

      for (int i = 0; i < numDimensions; ++i) {
View Full Code Here

          if (opcode == RETURN) {
              // add call to setEnumValues(Object[] values, Class c)

              String owner = className.replaceAll("\\.", "/");
              String fullName = 'L' + owner + ';';
              Type t = Type.getType(fullName);

              mv.visitMethodInsn(INVOKESTATIC, owner, "values", "()[" + fullName);
              mv.visitLdcInsn(t);
              mv.visitMethodInsn(INVOKESTATIC, "com/rc/retroweaver/runtime/Enum_",
                  "setEnumValues", "([Ljava/lang/Object;Ljava/lang/Class;)V");        
View Full Code Here

         * it was generated in 1.4.
         */

        // LDC or LDC_W with a class as argument

        Type t = (Type) cst;
        String fieldName = getClassLiteralFieldName(t);

        classLiteralCalls.add(fieldName);

        mv.visitFieldInsn(GETSTATIC, className, fieldName, CLASS_FIELD_DESC);
        Label nonNullLabel = new Label();
        mv.visitJumpInsn(IFNONNULL, nonNullLabel);
        String s;
        if (t.getSort() == Type.OBJECT)
          s = t.getInternalName();
        else
          s = t.getDescriptor();
       
        /* convert retroweaver runtime classes:
         *     Enum into com.rc.retroweaver.runtime.Enum_
         *    concurrent classes into their backport equivalent
         *    ...
 
View Full Code Here

    vr.verifySingleClass(classfile);
    vr.displaySummary();
  }
 
  private void checkClassName(String className) {
    Type t = Type.getType(className);

    switch (t.getSort()) {
    case Type.ARRAY:
      t = t.getElementType();
      if (t.getSort() != Type.OBJECT)
        return;

      // fall through to object processing
    case Type.OBJECT:
      className = t.getClassName();
      break;
    default:
      return;
    }
   
View Full Code Here

          if (opcode == RETURN) {
              // add call to setEnumValues(Object[] values, Class c)

              String owner = className.replace('.', '/');
              String fullName = 'L' + owner + ';';
              Type t = Type.getType(fullName);

              mv.visitMethodInsn(INVOKESTATIC, owner, "values", "()[" + fullName);
              mv.visitLdcInsn(t);
              mv.visitMethodInsn( INVOKESTATIC, RETROWEAVER_ENUM,
                  "setEnumValues", "([Ljava/lang/Object;Ljava/lang/Class;)V" );
View Full Code Here

         * it was generated in 1.4.
         */

        // LDC or LDC_W with a class as argument

        Type t = (Type) cst;
        String fieldName = getClassLiteralFieldName(t);

        classLiteralCalls.add(fieldName);

        mv.visitFieldInsn(GETSTATIC, className, fieldName, CLASS_FIELD_DESC);
        Label nonNullLabel = new Label();
        mv.visitJumpInsn(IFNONNULL, nonNullLabel);
        String s;
        if (t.getSort() == Type.OBJECT) {
          s = t.getInternalName();
        } else {
          s = t.getDescriptor();
        }
       
        /* convert retroweaver runtime classes:
         *     Enum into net.sourceforge.retroweaver.runtime.Enum_
         *    concurrent classes into their backport equivalent
View Full Code Here

TOP

Related Classes of org.objectweb.asm.Type

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.