public MethodVisitor visitMethod()

in test-discovery/src/com/intellij/rt/coverage/testDiscovery/instrumentation/InstrumentedMethodsCollector.java [51:83]


  public MethodVisitor visitMethod(int access, String name, final String desc,
                                   String signature, String[] exceptions) {
    InstrumentedMethodsFilter.Decision decision = methodsFilter.shouldVisitMethod(
        access, name, desc, signature, exceptions, instrumenter.myInstrumentConstructors
    );
    if (decision == InstrumentedMethodsFilter.Decision.YES) {
      instrumentedMethods.add(TestDiscoveryInstrumentationUtils.getMethodId(name, desc));
      if (INIT_METHOD_NAME.equals(name) && !instrumenter.myInstrumentConstructors) {
        instrumentAllConstructors();
      }
      return super.visitMethod(access, name, desc, signature, exceptions);
    }
    else if (decision == InstrumentedMethodsFilter.Decision.NO) {
      // no further visiting
      return null;
    }
    else {
      assert decision == InstrumentedMethodsFilter.Decision.CHECK_IS_CONSTRUCTOR_DEFAULT;
      assert INIT_METHOD_NAME.equals(name);
      return new DefaultConstructorDetectionVisitor(api, super.visitMethod(access, name, desc, signature, exceptions)) {
        @Override
        void onDecisionDone(boolean isDefault) {
          if (!isDefault) {
            instrumentAllConstructors();
            instrumentedMethods.add(TestDiscoveryInstrumentationUtils.getMethodId(INIT_METHOD_NAME, desc));
          }
          else {
            defaultConstructorIndex = instrumentedMethods.size();
          }
        }
      };
    }
  }