public void check()

in asm-tree/src/main/java/org/objectweb/asm/tree/MethodNode.java [571:635]


  public void check(final int api) {
    if (api == Opcodes.ASM4) {
      if (parameters != null && !parameters.isEmpty()) {
        throw new UnsupportedClassVersionException();
      }
      if (visibleTypeAnnotations != null && !visibleTypeAnnotations.isEmpty()) {
        throw new UnsupportedClassVersionException();
      }
      if (invisibleTypeAnnotations != null && !invisibleTypeAnnotations.isEmpty()) {
        throw new UnsupportedClassVersionException();
      }
      if (tryCatchBlocks != null) {
        for (int i = tryCatchBlocks.size() - 1; i >= 0; --i) {
          TryCatchBlockNode tryCatchBlock = tryCatchBlocks.get(i);
          if (tryCatchBlock.visibleTypeAnnotations != null
              && !tryCatchBlock.visibleTypeAnnotations.isEmpty()) {
            throw new UnsupportedClassVersionException();
          }
          if (tryCatchBlock.invisibleTypeAnnotations != null
              && !tryCatchBlock.invisibleTypeAnnotations.isEmpty()) {
            throw new UnsupportedClassVersionException();
          }
        }
      }
      for (int i = instructions.size() - 1; i >= 0; --i) {
        AbstractInsnNode insn = instructions.get(i);
        if (insn.visibleTypeAnnotations != null && !insn.visibleTypeAnnotations.isEmpty()) {
          throw new UnsupportedClassVersionException();
        }
        if (insn.invisibleTypeAnnotations != null && !insn.invisibleTypeAnnotations.isEmpty()) {
          throw new UnsupportedClassVersionException();
        }
        if (insn instanceof MethodInsnNode) {
          boolean isInterface = ((MethodInsnNode) insn).itf;
          if (isInterface != (insn.opcode == Opcodes.INVOKEINTERFACE)) {
            throw new UnsupportedClassVersionException();
          }
        } else if (insn instanceof LdcInsnNode) {
          Object value = ((LdcInsnNode) insn).cst;
          if (value instanceof Handle
              || (value instanceof Type && ((Type) value).getSort() == Type.METHOD)) {
            throw new UnsupportedClassVersionException();
          }
        }
      }
      if (visibleLocalVariableAnnotations != null && !visibleLocalVariableAnnotations.isEmpty()) {
        throw new UnsupportedClassVersionException();
      }
      if (invisibleLocalVariableAnnotations != null
          && !invisibleLocalVariableAnnotations.isEmpty()) {
        throw new UnsupportedClassVersionException();
      }
    }
    if (api < Opcodes.ASM7) {
      for (int i = instructions.size() - 1; i >= 0; --i) {
        AbstractInsnNode insn = instructions.get(i);
        if (insn instanceof LdcInsnNode) {
          Object value = ((LdcInsnNode) insn).cst;
          if (value instanceof ConstantDynamic) {
            throw new UnsupportedClassVersionException();
          }
        }
      }
    }
  }