Ejemplo n.º 1
0
  private static void generateGetValue(
      Class owner,
      Type ownerType,
      Method method,
      boolean isStatic,
      Type resolvableType,
      Type[] arguments,
      MxGeneratorAdapter getValue,
      TransformGenerator[] tg,
      Type[] stored) {
    getValue.visitCode();

    if (!isStatic) {
      getValue.loadThis();
      getValue.getField(resolvableType, OWNER_FIELD_NAME, ownerType);
    }
    int index = 0;
    for (int i = 0; i < arguments.length; i++) {
      getValue.loadThis();
      getValue.getField(resolvableType, "arg" + i, stored[i]);
      if (tg != null) {
        tg[i].generateBackward(resolvableType, index, getValue);
        index += tg[i].getFieldCount();
      }
    }

    getValue.visitMethodInsn(
        isStatic ? INVOKESTATIC : owner.isInterface() ? INVOKEINTERFACE : INVOKEVIRTUAL,
        ownerType.getInternalName(),
        method.getName(),
        method.getDescriptor());
    getValue.returnValue();
    getValue.endMethod();
  }
Ejemplo n.º 2
0
  private static TransformGenerator[] getKeyTransformers(Class ownerClass, Method method) {
    TransformGeneratorFactory tgf = TransformGeneratorFactoryImpl.getInstance();

    Class[] params =
        CodegenHelper.getClasses(ownerClass.getClassLoader(), method.getArgumentTypes());
    Annotation[][] annotations;
    try {
      annotations =
          ownerClass.getDeclaredMethod(method.getName(), params).getParameterAnnotations();
    } catch (NoSuchMethodException e) {
      throw new IllegalStateException(e);
    }

    TransformGenerator[] tg = new TransformGenerator[params.length];
    for (int i = 0; i < params.length; i++) {
      tg[i] = tgf.forArgument(annotations[i], params[i]);
    }
    return tg;
  }
Ejemplo n.º 3
0
 public static String getNonProxiedMethodName(Method m) {
   return NON_PROXIED_POSTFIX + m.getName();
 }