类org.objectweb.asm.TypePath源码实例Demo

下面列出了怎么用org.objectweb.asm.TypePath的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: JReFrameworker   文件: MethodRemapper.java
@Override
public AnnotationVisitor visitLocalVariableAnnotation(
    final int typeRef,
    final TypePath typePath,
    final Label[] start,
    final Label[] end,
    final int[] index,
    final String descriptor,
    final boolean visible) {
  AnnotationVisitor annotationVisitor =
      super.visitLocalVariableAnnotation(
          typeRef, typePath, start, end, index, remapper.mapDesc(descriptor), visible);
  return annotationVisitor == null
      ? annotationVisitor
      : new AnnotationRemapper(api, annotationVisitor, remapper);
}
 
源代码2 项目: Concurnas   文件: LocalVariablesSorter.java
@Override
public AnnotationVisitor visitLocalVariableAnnotation(
    final int typeRef,
    final TypePath typePath,
    final Label[] start,
    final Label[] end,
    final int[] index,
    final String descriptor,
    final boolean visible) {
  Type type = Type.getType(descriptor);
  int[] remappedIndex = new int[index.length];
  for (int i = 0; i < remappedIndex.length; ++i) {
    remappedIndex[i] = remap(index[i], type);
  }
  return super.visitLocalVariableAnnotation(
      typeRef, typePath, start, end, remappedIndex, descriptor, visible);
}
 
源代码3 项目: Concurnas   文件: MethodRemapper.java
@Override
public AnnotationVisitor visitLocalVariableAnnotation(
    final int typeRef,
    final TypePath typePath,
    final Label[] start,
    final Label[] end,
    final int[] index,
    final String descriptor,
    final boolean visible) {
  AnnotationVisitor annotationVisitor =
      super.visitLocalVariableAnnotation(
          typeRef, typePath, start, end, index, remapper.mapDesc(descriptor), visible);
  return annotationVisitor == null
      ? annotationVisitor
      : new AnnotationRemapper(api, annotationVisitor, remapper);
}
 
源代码4 项目: JReFrameworker   文件: CheckMethodAdapter.java
@Override
public AnnotationVisitor visitInsnAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  checkVisitCodeCalled();
  checkVisitMaxsNotCalled();
  int sort = new TypeReference(typeRef).getSort();
  if (sort != TypeReference.INSTANCEOF
      && sort != TypeReference.NEW
      && sort != TypeReference.CONSTRUCTOR_REFERENCE
      && sort != TypeReference.METHOD_REFERENCE
      && sort != TypeReference.CAST
      && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
      && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT
      && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
      && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) {
    throw new IllegalArgumentException(INVALID_TYPE_REFERENCE + Integer.toHexString(sort));
  }
  CheckClassAdapter.checkTypeRef(typeRef);
  CheckMethodAdapter.checkDescriptor(version, descriptor, false);
  return new CheckAnnotationAdapter(
      super.visitInsnAnnotation(typeRef, typePath, descriptor, visible));
}
 
源代码5 项目: JReFrameworker   文件: MethodNode.java
@Override
public AnnotationVisitor visitTryCatchAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  TryCatchBlockNode tryCatchBlock = tryCatchBlocks.get((typeRef & 0x00FFFF00) >> 8);
  TypeAnnotationNode typeAnnotation = new TypeAnnotationNode(typeRef, typePath, descriptor);
  if (visible) {
    if (tryCatchBlock.visibleTypeAnnotations == null) {
      tryCatchBlock.visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1);
    }
    tryCatchBlock.visibleTypeAnnotations.add(typeAnnotation);
  } else {
    if (tryCatchBlock.invisibleTypeAnnotations == null) {
      tryCatchBlock.invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1);
    }
    tryCatchBlock.invisibleTypeAnnotations.add(typeAnnotation);
  }
  return typeAnnotation;
}
 
源代码6 项目: JReFrameworker   文件: RemappingMethodAdapter.java
@Override
public AnnotationVisitor visitLocalVariableAnnotation(
    final int typeRef,
    final TypePath typePath,
    final Label[] start,
    final Label[] end,
    final int[] index,
    final String descriptor,
    final boolean visible) {
  AnnotationVisitor annotationVisitor =
      super.visitLocalVariableAnnotation(
          typeRef, typePath, start, end, index, remapper.mapDesc(descriptor), visible);
  return annotationVisitor == null
      ? annotationVisitor
      : new RemappingAnnotationAdapter(annotationVisitor, remapper);
}
 
源代码7 项目: JByteMod-Beta   文件: MethodNode.java
@Override
public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc,
    boolean visible) {
  LocalVariableAnnotationNode an = new LocalVariableAnnotationNode(typeRef, typePath, getLabelNodes(start), getLabelNodes(end), index, desc);
  if (visible) {
    if (visibleLocalVariableAnnotations == null) {
      visibleLocalVariableAnnotations = new ArrayList<LocalVariableAnnotationNode>(1);
    }
    visibleLocalVariableAnnotations.add(an);
  } else {
    if (invisibleLocalVariableAnnotations == null) {
      invisibleLocalVariableAnnotations = new ArrayList<LocalVariableAnnotationNode>(1);
    }
    invisibleLocalVariableAnnotations.add(an);
  }
  return an;
}
 
源代码8 项目: JReFrameworker   文件: MethodNode.java
@Override
public AnnotationVisitor visitInsnAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  // Find the last real instruction, i.e. the instruction targeted by this annotation.
  AbstractInsnNode currentInsn = instructions.getLast();
  while (currentInsn.getOpcode() == -1) {
    currentInsn = currentInsn.getPrevious();
  }
  // Add the annotation to this instruction.
  TypeAnnotationNode typeAnnotation = new TypeAnnotationNode(typeRef, typePath, descriptor);
  if (visible) {
    if (currentInsn.visibleTypeAnnotations == null) {
      currentInsn.visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1);
    }
    currentInsn.visibleTypeAnnotations.add(typeAnnotation);
  } else {
    if (currentInsn.invisibleTypeAnnotations == null) {
      currentInsn.invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1);
    }
    currentInsn.invisibleTypeAnnotations.add(typeAnnotation);
  }
  return typeAnnotation;
}
 
源代码9 项目: JReFrameworker   文件: ClassNode.java
@Override
public AnnotationVisitor visitTypeAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  TypeAnnotationNode typeAnnotation = new TypeAnnotationNode(typeRef, typePath, descriptor);
  if (visible) {
    if (visibleTypeAnnotations == null) {
      visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1);
    }
    visibleTypeAnnotations.add(typeAnnotation);
  } else {
    if (invisibleTypeAnnotations == null) {
      invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1);
    }
    invisibleTypeAnnotations.add(typeAnnotation);
  }
  return typeAnnotation;
}
 
源代码10 项目: JReFrameworker   文件: LocalVariablesSorter.java
@Override
public AnnotationVisitor visitLocalVariableAnnotation(
    final int typeRef,
    final TypePath typePath,
    final Label[] start,
    final Label[] end,
    final int[] index,
    final String descriptor,
    final boolean visible) {
  Type type = Type.getType(descriptor);
  int[] remappedIndex = new int[index.length];
  for (int i = 0; i < remappedIndex.length; ++i) {
    remappedIndex[i] = remap(index[i], type);
  }
  return super.visitLocalVariableAnnotation(
      typeRef, typePath, start, end, remappedIndex, descriptor, visible);
}
 
源代码11 项目: JReFrameworker   文件: CheckMethodAdapter.java
@Override
public AnnotationVisitor visitTypeAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  checkVisitEndNotCalled();
  int sort = new TypeReference(typeRef).getSort();
  if (sort != TypeReference.METHOD_TYPE_PARAMETER
      && sort != TypeReference.METHOD_TYPE_PARAMETER_BOUND
      && sort != TypeReference.METHOD_RETURN
      && sort != TypeReference.METHOD_RECEIVER
      && sort != TypeReference.METHOD_FORMAL_PARAMETER
      && sort != TypeReference.THROWS) {
    throw new IllegalArgumentException(INVALID_TYPE_REFERENCE + Integer.toHexString(sort));
  }
  CheckClassAdapter.checkTypeRef(typeRef);
  CheckMethodAdapter.checkDescriptor(version, descriptor, false);
  return new CheckAnnotationAdapter(
      super.visitTypeAnnotation(typeRef, typePath, descriptor, visible));
}
 
源代码12 项目: JByteMod-Beta   文件: Textifier.java
@Override
public Printer visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
  buf.setLength(0);
  buf.append(tab2).append("TRYCATCHBLOCK @");
  appendDescriptor(FIELD_DESCRIPTOR, desc);
  buf.append('(');
  text.add(buf.toString());
  Textifier t = createTextifier();
  text.add(t.getText());
  buf.setLength(0);
  buf.append(") : ");
  appendTypeReference(typeRef);
  buf.append(", ").append(typePath);
  buf.append(visible ? "\n" : " // invisible\n");
  text.add(buf.toString());
  return t;
}
 
源代码13 项目: Concurnas   文件: Textifier.java
/**
 * Prints a disassembled view of the given type annotation.
 *
 * @param typeRef a reference to the annotated type. See {@link TypeReference}.
 * @param typePath the path to the annotated type argument, wildcard bound, array element type, or
 *     static inner type within 'typeRef'. May be {@literal null} if the annotation targets
 *     'typeRef' as a whole.
 * @param descriptor the class descriptor of the annotation class.
 * @param visible {@literal true} if the annotation is visible at runtime.
 * @return a visitor to visit the annotation values.
 */
public Textifier visitTypeAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  stringBuilder.setLength(0);
  stringBuilder.append(tab).append('@');
  appendDescriptor(FIELD_DESCRIPTOR, descriptor);
  stringBuilder.append('(');
  text.add(stringBuilder.toString());

  stringBuilder.setLength(0);
  stringBuilder.append(") : ");
  appendTypeReference(typeRef);
  stringBuilder.append(", ").append(typePath);
  stringBuilder.append(visible ? "\n" : INVISIBLE);
  return addNewTextifier(stringBuilder.toString());
}
 
源代码14 项目: JByteMod-Beta   文件: Textifier.java
/**
 * Prints a disassembled view of the given type annotation.
 *
 * @param typeRef
 *          a reference to the annotated type. See {@link TypeReference}.
 * @param typePath
 *          the path to the annotated type argument, wildcard bound, array
 *          element type, or static inner type within 'typeRef'. May be
 *          <tt>null</tt> if the annotation targets 'typeRef' as a whole.
 * @param desc
 *          the class descriptor of the annotation class.
 * @param visible
 *          <tt>true</tt> if the annotation is visible at runtime.
 * @return a visitor to visit the annotation values.
 */
public Textifier visitTypeAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) {
  buf.setLength(0);
  buf.append(tab).append('@');
  appendDescriptor(FIELD_DESCRIPTOR, desc);
  buf.append('(');
  text.add(buf.toString());
  Textifier t = createTextifier();
  text.add(t.getText());
  buf.setLength(0);
  buf.append(") : ");
  appendTypeReference(typeRef);
  buf.append(", ").append(typePath);
  buf.append(visible ? "\n" : " // invisible\n");
  text.add(buf.toString());
  return t;
}
 
源代码15 项目: JReFrameworker   文件: TraceMethodVisitor.java
@Override
public AnnotationVisitor visitInsnAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  Printer annotationPrinter = p.visitInsnAnnotation(typeRef, typePath, descriptor, visible);
  return new TraceAnnotationVisitor(
      super.visitInsnAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter);
}
 
源代码16 项目: Bats   文件: CheckMethodVisitorFsm.java
@Override
public AnnotationVisitor visitInsnAnnotation(final int typeRef,
    final TypePath typePath, final String desc, final boolean visible) {
  fsmCursor.transition("visitInsnAnnotation");
  final AnnotationVisitor annotationVisitor = super.visitInsnAnnotation(
      typeRef, typePath, desc, visible);
  return annotationVisitor; // TODO: add CheckAnnotationVisitorFsm
}
 
源代码17 项目: JByteMod-Beta   文件: RemappingMethodAdapter.java
@Override
public AnnotationVisitor visitInsnAnnotation(
    int typeRef, TypePath typePath, String desc, boolean visible) {
  AnnotationVisitor av =
      super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(desc), visible);
  return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
}
 
源代码18 项目: JReFrameworker   文件: RemappingMethodAdapter.java
@Override
public AnnotationVisitor visitInsnAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  AnnotationVisitor annotationVisitor =
      super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
  return annotationVisitor == null
      ? annotationVisitor
      : new RemappingAnnotationAdapter(annotationVisitor, remapper);
}
 
源代码19 项目: JReFrameworker   文件: MethodRemapper.java
@Override
public AnnotationVisitor visitInsnAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  AnnotationVisitor annotationVisitor =
      super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
  return annotationVisitor == null
      ? annotationVisitor
      : new AnnotationRemapper(api, annotationVisitor, remapper);
}
 
源代码20 项目: JReFrameworker   文件: ASMifier.java
/**
 * Visits a class, field, method, instruction or try catch block type annotation.
 *
 * @param method the name of the visit method for this type of annotation.
 * @param typeRef a reference to the annotated type. The sort of this type reference must be
 *     {@link org.objectweb.asm.TypeReference#FIELD}. See {@link org.objectweb.asm.TypeReference}.
 * @param typePath the path to the annotated type argument, wildcard bound, array element type, or
 *     static inner type within 'typeRef'. May be {@literal null} if the annotation targets
 *     'typeRef' as a whole.
 * @param descriptor the class descriptor of the annotation class.
 * @param visible {@literal true} if the annotation is visible at runtime.
 * @return a new {@link ASMifier} to visit the annotation values.
 */
public ASMifier visitTypeAnnotation(
    final String method,
    final int typeRef,
    final TypePath typePath,
    final String descriptor,
    final boolean visible) {
  stringBuilder.setLength(0);
  stringBuilder
      .append("{\n")
      .append(ANNOTATION_VISITOR0)
      .append(name)
      .append(".")
      .append(method)
      .append("(")
      .append(typeRef);
  if (typePath == null) {
    stringBuilder.append(", null, ");
  } else {
    stringBuilder.append(", TypePath.fromString(\"").append(typePath).append("\"), ");
  }
  appendConstant(descriptor);
  stringBuilder.append(", ").append(visible).append(");\n");
  text.add(stringBuilder.toString());
  ASMifier asmifier = createASMifier(ANNOTATION_VISITOR, 0);
  text.add(asmifier.getText());
  text.add("}\n");
  return asmifier;
}
 
源代码21 项目: JReFrameworker   文件: RemappingClassAdapter.java
@Override
public AnnotationVisitor visitTypeAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  AnnotationVisitor annotationVisitor =
      super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
  return annotationVisitor == null ? null : createRemappingAnnotationAdapter(annotationVisitor);
}
 
源代码22 项目: JByteMod-Beta   文件: MethodConstantsCollector.java
@Override
public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
  cp.newUTF8(desc);
  if (visible) {
    cp.newUTF8("RuntimeVisibleTypeAnnotations");
  } else {
    cp.newUTF8("RuntimeInvisibleTypeAnnotations");
  }
  return new AnnotationConstantsCollector(mv.visitAnnotation(desc, visible), cp);
}
 
源代码23 项目: buck   文件: DalvikStatsTool.java
@Override
public AnnotationVisitor visitLocalVariableAnnotation(
    int typeRef,
    TypePath typePath,
    Label[] start,
    Label[] end,
    int[] index,
    String desc,
    boolean visible) {
  return annotationVisitor;
}
 
源代码24 项目: Concurnas   文件: RemappingMethodAdapter.java
@Override
public AnnotationVisitor visitTryCatchAnnotation(int typeRef,
        TypePath typePath, String desc, boolean visible) {
    AnnotationVisitor av = super.visitTryCatchAnnotation(typeRef, typePath,
            remapper.mapDesc(desc), visible);
    return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
}
 
源代码25 项目: JReFrameworker   文件: TraceMethodVisitor.java
@Override
public AnnotationVisitor visitInsnAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  Printer annotationPrinter = p.visitInsnAnnotation(typeRef, typePath, descriptor, visible);
  return new TraceAnnotationVisitor(
      super.visitInsnAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter);
}
 
源代码26 项目: JByteMod-Beta   文件: ClassRemapper.java
@Override
public AnnotationVisitor visitTypeAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  AnnotationVisitor annotationVisitor =
      super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
  return annotationVisitor == null ? null : createAnnotationRemapper(annotationVisitor);
}
 
源代码27 项目: Concurnas   文件: MethodRemapper.java
@Override
public AnnotationVisitor visitInsnAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  AnnotationVisitor annotationVisitor =
      super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
  return annotationVisitor == null
      ? annotationVisitor
      : new AnnotationRemapper(api, annotationVisitor, remapper);
}
 
源代码28 项目: Concurnas   文件: MethodRemapper.java
@Override
public AnnotationVisitor visitTryCatchAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  AnnotationVisitor annotationVisitor =
      super.visitTryCatchAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
  return annotationVisitor == null
      ? annotationVisitor
      : new AnnotationRemapper(api, annotationVisitor, remapper);
}
 
源代码29 项目: JByteMod-Beta   文件: CheckMethodAdapter.java
@Override
public AnnotationVisitor visitTryCatchAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) {
  checkStartCode();
  checkEndCode();
  int sort = typeRef >>> 24;
  if (sort != TypeReference.EXCEPTION_PARAMETER) {
    throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort));
  }
  CheckClassAdapter.checkTypeRefAndPath(typeRef, typePath);
  CheckMethodAdapter.checkDesc(desc, false);
  return new CheckAnnotationAdapter(super.visitTryCatchAnnotation(typeRef, typePath, desc, visible));
}
 
源代码30 项目: JReFrameworker   文件: TraceClassVisitor.java
@Override
public AnnotationVisitor visitTypeAnnotation(
    final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
  Printer annotationPrinter = p.visitClassTypeAnnotation(typeRef, typePath, descriptor, visible);
  return new TraceAnnotationVisitor(
      super.visitTypeAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter);
}
 
 类所在包
 类方法
 同包方法