public MethodVisitor visitMethod()

in instrumentation/src/com/intellij/rt/coverage/instrumentation/filters/classFilter/KotlinValueClassFilter.java [53:120]


  public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
    final MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions);
    if (!KotlinUtils.isKotlinClass(myContext)) return mv;
    if ("constructor-impl".equals(name) && (access & Opcodes.ACC_STATIC) != 0) {
      myConstructorVisited = true;
      return new MethodVisitor(Opcodes.API_VERSION, mv) {
        @Override
        public void visitCode() {
          super.visitCode();
          if (myConstructorLine >= 0) {
            Label label = new Label();
            super.visitLabel(label);
            super.visitLineNumber(myConstructorLine, label);
          }
        }
      };
    }
    if ("toString-impl".equals(name) && (access & Opcodes.ACC_STATIC) != 0) {
      myToStringVisited = true;
      return mv;
    }
    if ("equals-impl".equals(name) && (access & Opcodes.ACC_STATIC) != 0) {
      myEqualsVisited = true;
      return mv;
    }
    if ("hashCode-impl".equals(name) && (access & Opcodes.ACC_STATIC) != 0) {
      myHashCodeVisited = true;
      return mv;
    }
    if ("box-impl".equals(name) && (access & Opcodes.ACC_STATIC) != 0 && (access & Opcodes.ACC_FINAL) != 0 && (access & Opcodes.ACC_SYNTHETIC) != 0) {
      myBoxingVisited = true;
      return mv;
    }
    if ("unbox-impl".equals(name) && (access & Opcodes.ACC_FINAL) != 0 && (access & Opcodes.ACC_SYNTHETIC) != 0) {
      myUnboxingVisited = true;
      return mv;
    }
    if (name.startsWith("get") && myFieldType != null && ("()" + myFieldType).equals(descriptor)
        && !name.endsWith("-impl")) {
      return new MethodVisitor(Opcodes.API_VERSION, mv) {
        @Override
        public void visitLineNumber(int line, Label start) {
          super.visitLineNumber(line, start);
          if (myGetterLine == line) return;
          if (myGetterLine == -1) {
            myGetterLine = line;
          } else {
            myGetterLine = -2;
          }
        }
      };
    } else if (InstrumentationUtils.CONSTRUCTOR.equals(name) && (access & Opcodes.ACC_SYNTHETIC) != 0
        && (access & Opcodes.ACC_PRIVATE) != 0) {
      return new MethodVisitor(Opcodes.API_VERSION, mv) {
        @Override
        public void visitLineNumber(int line, Label start) {
          super.visitLineNumber(line, start);
          if (myConstructorLine == line) return;
          if (myConstructorLine == -1) {
            myConstructorLine = line;
          } else {
            myConstructorLine = -2;
          }
        }
      };
    }
    return mv;
  }