# Global Metrics

path: .metrics.mi.mi_sei
old: 1.0886502517602636
new: 20.19884871914165
path: .metrics.mi.mi_visual_studio
old: 19.74641421836079
new: 29.32711972496271
path: .metrics.mi.mi_original
old: 33.76636831339695
new: 50.14937472968623
path: .metrics.nom.total
old: 27.0
new: 7.0
path: .metrics.nom.functions
old: 27.0
new: 7.0
path: .metrics.cyclomatic.sum
old: 35.0
new: 18.0
path: .metrics.cyclomatic.average
old: 1.0294117647058822
new: 1.8
path: .metrics.loc.sloc
old: 192.0
new: 107.0
path: .metrics.loc.ploc
old: 141.0
new: 82.0
path: .metrics.loc.blank
old: 30.0
new: 16.0
path: .metrics.loc.cloc
old: 21.0
new: 9.0
path: .metrics.loc.lloc
old: 29.0
new: 34.0
path: .metrics.nargs.sum
old: 24.0
new: 12.0
path: .metrics.nargs.average
old: 0.8888888888888888
new: 1.7142857142857142
path: .metrics.nexits.sum
old: 23.0
new: 6.0
path: .metrics.nexits.average
old: 0.8518518518518519
new: 0.8571428571428571
path: .metrics.halstead.difficulty
old: 56.48275862068966
new: 26.509090909090908
path: .metrics.halstead.length
old: 752.0
new: 430.0
path: .metrics.halstead.N2
old: 312.0
new: 162.0
path: .metrics.halstead.purity_ratio
old: 0.5744701643560547
new: 0.9140312424879486
path: .metrics.halstead.N1
old: 440.0
new: 268.0
path: .metrics.halstead.time
old: 14875.183591698467
new: 3919.8470797416544
path: .metrics.halstead.bugs
old: 1.3847412780973396
new: 0.5691671570921245
path: .metrics.halstead.level
old: 0.017704517704517704
new: 0.03772290809327847
path: .metrics.halstead.vocabulary
old: 79.0
new: 73.0
path: .metrics.halstead.n2
old: 58.0
new: 55.0
path: .metrics.halstead.effort
old: 267753.3046505724
new: 70557.24743534978
path: .metrics.halstead.volume
old: 4740.443122629182
new: 2661.6245603184075
path: .metrics.halstead.n1
old: 21.0
new: 18.0
path: .metrics.halstead.estimated_program_length
old: 432.0015635957531
new: 393.0334342698179
path: .metrics.cognitive.sum
old: 1.0
new: 14.0
path: .metrics.cognitive.average
old: 0.037037037037037035
new: 2.0

# Spaces Data

## Minimal test - lines (93, 95)

path: .spaces[0].spaces[0].spaces[5].metrics.halstead.N2
old: 10.0
new: 7.0
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.effort
old: 833.3333333333334
new: 287.09244813244635
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.difficulty
old: 8.333333333333334
new: 4.083333333333333
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.volume
old: 100.0
new: 70.30835464468075
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.length
old: 25.0
new: 19.0
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.level
old: 0.12
new: 0.2448979591836735
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.purity_ratio
old: 1.9491622381280225
new: 1.850592603091061
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.vocabulary
old: 16.0
new: 13.0
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.estimated_program_length
old: 48.72905595320056
new: 35.161259458730164
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.n1
old: 10.0
new: 7.0
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.N1
old: 15.0
new: 12.0
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.time
old: 46.2962962962963
new: 15.949580451802577
path: .spaces[0].spaces[0].spaces[5].metrics.halstead.bugs
old: 0.02951829358840586
new: 0.014506409214276324
path: .spaces[0].spaces[0].spaces[5].metrics.loc.sloc
old: 4.0
new: 3.0
path: .spaces[0].spaces[0].spaces[5].metrics.loc.ploc
old: 4.0
new: 3.0
path: .spaces[0].spaces[0].spaces[5].metrics.mi.mi_original
old: 124.3651463827197
new: 130.8574496241963
path: .spaces[0].spaces[0].spaces[5].metrics.mi.mi_visual_studio
old: 72.72815577936825
new: 76.52482434163527
path: .spaces[0].spaces[0].spaces[5].metrics.mi.mi_sei
old: 103.82194781317143
new: 113.18836150359706

### Code

    ipc::LaunchError Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      return ipc::LaunchError{};
    }

## Minimal test - lines (13, 106)

path: .spaces[0].spaces[0].metrics.nargs.average
old: 0.84
new: 1.7142857142857142
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 21.0
new: 12.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 25.0
new: 7.0
path: .spaces[0].spaces[0].metrics.nom.functions
old: 25.0
new: 7.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: 0.84
new: 0.8571428571428571
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 21.0
new: 6.0
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 0.0
new: 14.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 30.0
new: 16.0
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 6.0860653693656666
new: 13.35925730997266
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 39.91392957714679
new: 52.83739756138793
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 23.341479284881164
new: 30.89906290139645
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 25.0
new: 34.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 23.0
new: 15.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 116.0
new: 77.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 12.0
new: 2.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 151.0
new: 94.0
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 340.52241187636986
new: 364.3523424665078
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.017557251908396947
new: 0.035864978902953586
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 3832.145871673259
new: 2596.1228941307218
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 372.0
new: 267.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 634.0
new: 425.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 56.95652173913044
new: 27.88235294117647
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 218265.69964747695
new: 72386.0148128213
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 262.0
new: 158.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 1.2083768779560096
new: 0.578959951871905
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 66.0
new: 69.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 12125.872202637607
new: 4021.4452673789615
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 46.0
new: 51.0
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 20.0
new: 18.0
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 0.5371015960195108
new: 0.8572996293329596

### Code

    namespace jni {

    template
    jfieldID GetValueFieldID(JNIEnv* aEnv, const char* aType) {
      const jfieldID id = aEnv->GetFieldID(
          typename T::Context(aEnv, nullptr).ClassRef(), "value", aType);
      aEnv->ExceptionClear();
      return id;
    }

    // Cached locations of the primitive types within their standard boxed objects
    // to skip doing that lookup on every get.
    static jfieldID gBooleanValueField;
    static jfieldID gIntValueField;
    static jfieldID gDoubleValueField;

    void InitConversionStatics() {
      MOZ_ASSERT(NS_IsMainThread());
      JNIEnv* const env = jni::GetGeckoThreadEnv();
      gBooleanValueField = GetValueFieldID(env, "Z");
      gIntValueField = GetValueFieldID(env, "I");
      gDoubleValueField = GetValueFieldID(env, "D");
    }

    template <>
    bool Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      MOZ_ASSERT(aData.IsInstanceOf());

      bool result = false;
      if (gBooleanValueField) {
        if (!aEnv) {
          aEnv = jni::GetEnvForThread();
        }
        result =
            aEnv->GetBooleanField(aData.Get(), gBooleanValueField) != JNI_FALSE;
        MOZ_CATCH_JNI_EXCEPTION(aEnv);
      } else {
        result = java::sdk::Boolean::Ref::From(aData)->BooleanValue();
      }

      return result;
    }

    template <>
    int Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      MOZ_ASSERT(aData.IsInstanceOf());

      int result = 0;
      if (gIntValueField) {
        if (!aEnv) {
          aEnv = jni::GetEnvForThread();
        }
        result = aEnv->GetIntField(aData.Get(), gIntValueField);
        MOZ_CATCH_JNI_EXCEPTION(aEnv);
      } else {
        result = java::sdk::Number::Ref::From(aData)->IntValue();
      }

      return result;
    }

    template <>
    double Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      MOZ_ASSERT(aData.IsInstanceOf());

      double result = 0;
      if (gDoubleValueField) {
        if (!aEnv) {
          aEnv = jni::GetEnvForThread();
        }
        result = aEnv->GetDoubleField(aData.Get(), gDoubleValueField);
        MOZ_CATCH_JNI_EXCEPTION(aEnv);
      } else {
        result = java::sdk::Number::Ref::From(aData)->DoubleValue();
      }

      return result;
    }

    template <>
    ipc::LaunchError Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      return ipc::LaunchError{};
    }

    template <>
    nsString Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      nsString result;
      if (aData != NULL && aData.IsInstanceOf()) {
        result = jni::String::Ref::From(aData)->ToString();
      }
      return result;
    }

    }  // namespace jni

## Minimal test - lines (29, 35)

path: .spaces[0].spaces[0].spaces[1].metrics.mi.mi_original
old: 124.25266994468964
new: 110.26661527424731
path: .spaces[0].spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 72.66238008461383
new: 64.48340074517387
path: .spaces[0].spaces[0].spaces[1].metrics.mi.mi_sei
old: 103.65967861380858
new: 83.48206689915958
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.bugs
old: 0.03191162517070485
new: 0.04798910301886632
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 2.142540912373488
new: 1.7360585883727435
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.vocabulary
old: 17.0
new: 26.0
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.length
old: 25.0
new: 56.0
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.effort
old: 936.7102344532028
new: 1727.4115964168514
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.n2
old: 6.0
new: 16.0
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.difficulty
old: 9.166666666666666
new: 6.5625
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 53.5635228093372
new: 97.21928094887365
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.time
old: 52.03945746962237
new: 95.9673109120473
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.volume
old: 102.18657103125848
new: 263.22462421590114
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.N2
old: 10.0
new: 21.0
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.level
old: 0.1090909090909091
new: 0.1523809523809524
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.N1
old: 15.0
new: 35.0
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.n1
old: 11.0
new: 10.0
path: .spaces[0].spaces[0].spaces[1].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].spaces[1].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].spaces[1].metrics.loc.lloc
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].spaces[1].metrics.loc.ploc
old: 4.0
new: 7.0
path: .spaces[0].spaces[0].spaces[1].metrics.loc.sloc
old: 4.0
new: 7.0
path: .spaces[0].spaces[0].spaces[1].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[0].spaces[0].spaces[1].metrics.nargs.sum
old: 2.0
new: 0.0

### Code

    void InitConversionStatics() {
      MOZ_ASSERT(NS_IsMainThread());
      JNIEnv* const env = jni::GetGeckoThreadEnv();
      gBooleanValueField = GetValueFieldID(env, "Z");
      gIntValueField = GetValueFieldID(env, "I");
      gDoubleValueField = GetValueFieldID(env, "D");
    }

## Minimal test - lines (38, 54)

path: .spaces[0].spaces[0].spaces[2].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[0].spaces[0].spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[0].spaces[0].spaces[2].metrics.mi.mi_sei
old: 103.65967861380858
new: 58.86034463804663
path: .spaces[0].spaces[0].spaces[2].metrics.mi.mi_visual_studio
old: 72.66238008461383
new: 54.42045942192072
path: .spaces[0].spaces[0].spaces[2].metrics.mi.mi_original
old: 124.25266994468964
new: 93.05898561148442
path: .spaces[0].spaces[0].spaces[2].metrics.loc.sloc
old: 4.0
new: 17.0
path: .spaces[0].spaces[0].spaces[2].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].spaces[2].metrics.loc.ploc
old: 4.0
new: 15.0
path: .spaces[0].spaces[0].spaces[2].metrics.loc.lloc
old: 1.0
new: 8.0
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.vocabulary
old: 17.0
new: 35.0
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.difficulty
old: 9.166666666666666
new: 13.694444444444445
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.N1
old: 15.0
new: 52.0
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.n1
old: 11.0
new: 17.0
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.level
old: 0.1090909090909091
new: 0.07302231237322515
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.purity_ratio
old: 2.142540912373488
new: 1.7845125719409556
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.volume
old: 102.18657103125848
new: 415.4719243725423
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.time
old: 52.03945746962237
new: 316.09206591923356
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.effort
old: 936.7102344532028
new: 5689.657186546204
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.length
old: 25.0
new: 81.0
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.estimated_program_length
old: 53.5635228093372
new: 144.5455183272174
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.bugs
old: 0.03191162517070485
new: 0.1062354541089685
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.N2
old: 10.0
new: 29.0
path: .spaces[0].spaces[0].spaces[2].metrics.halstead.n2
old: 6.0
new: 18.0
path: .spaces[0].spaces[0].spaces[2].metrics.cognitive.average
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].spaces[2].metrics.cognitive.sum
old: 0.0
new: 4.0

### Code

    bool Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      MOZ_ASSERT(aData.IsInstanceOf());

      bool result = false;
      if (gBooleanValueField) {
        if (!aEnv) {
          aEnv = jni::GetEnvForThread();
        }
        result =
            aEnv->GetBooleanField(aData.Get(), gBooleanValueField) != JNI_FALSE;
        MOZ_CATCH_JNI_EXCEPTION(aEnv);
      } else {
        result = java::sdk::Boolean::Ref::From(aData)->BooleanValue();
      }

      return result;
    }

## Minimal test - lines (57, 72)

path: .spaces[0].spaces[0].spaces[3].metrics.mi.mi_sei
old: 103.82194781317143
new: 60.58999891948817
path: .spaces[0].spaces[0].spaces[3].metrics.mi.mi_visual_studio
old: 72.72815577936825
new: 55.1215734502977
path: .spaces[0].spaces[0].spaces[3].metrics.mi.mi_original
old: 124.3651463827197
new: 94.25789060000908
path: .spaces[0].spaces[0].spaces[3].metrics.cognitive.sum
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].spaces[3].metrics.cognitive.average
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].spaces[3].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[0].spaces[0].spaces[3].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[0].spaces[0].spaces[3].metrics.loc.ploc
old: 4.0
new: 14.0
path: .spaces[0].spaces[0].spaces[3].metrics.loc.sloc
old: 4.0
new: 16.0
path: .spaces[0].spaces[0].spaces[3].metrics.loc.lloc
old: 1.0
new: 8.0
path: .spaces[0].spaces[0].spaces[3].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.purity_ratio
old: 1.9491622381280225
new: 1.6897071936867818
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.level
old: 0.12
new: 0.07589285714285715
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.n2
old: 6.0
new: 17.0
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.N1
old: 15.0
new: 51.0
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.vocabulary
old: 16.0
new: 33.0
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.time
old: 46.2962962962963
new: 291.7176416214614
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.estimated_program_length
old: 48.72905595320056
new: 133.48686830125575
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.volume
old: 100.0
new: 398.5071354293178
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.N2
old: 10.0
new: 28.0
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.difficulty
old: 8.333333333333334
new: 13.176470588235292
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.effort
old: 833.3333333333334
new: 5250.917549186305
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.n1
old: 10.0
new: 16.0
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.length
old: 25.0
new: 79.0
path: .spaces[0].spaces[0].spaces[3].metrics.halstead.bugs
old: 0.02951829358840586
new: 0.1007014084000215

### Code

    int Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      MOZ_ASSERT(aData.IsInstanceOf());

      int result = 0;
      if (gIntValueField) {
        if (!aEnv) {
          aEnv = jni::GetEnvForThread();
        }
        result = aEnv->GetIntField(aData.Get(), gIntValueField);
        MOZ_CATCH_JNI_EXCEPTION(aEnv);
      } else {
        result = java::sdk::Number::Ref::From(aData)->IntValue();
      }

      return result;
    }

## Minimal test - lines (75, 90)

path: .spaces[0].spaces[0].spaces[4].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].spaces[4].metrics.loc.lloc
old: 1.0
new: 8.0
path: .spaces[0].spaces[0].spaces[4].metrics.loc.ploc
old: 4.0
new: 14.0
path: .spaces[0].spaces[0].spaces[4].metrics.loc.sloc
old: 4.0
new: 16.0
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.length
old: 25.0
new: 79.0
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.estimated_program_length
old: 53.5635228093372
new: 133.48686830125575
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.volume
old: 102.18657103125848
new: 398.5071354293178
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.vocabulary
old: 17.0
new: 33.0
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.N2
old: 10.0
new: 28.0
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.difficulty
old: 9.166666666666666
new: 13.176470588235292
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.effort
old: 936.7102344532028
new: 5250.917549186305
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.n1
old: 11.0
new: 16.0
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.time
old: 52.03945746962237
new: 291.7176416214614
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.purity_ratio
old: 2.142540912373488
new: 1.6897071936867818
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.N1
old: 15.0
new: 51.0
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.n2
old: 6.0
new: 17.0
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.level
old: 0.1090909090909091
new: 0.07589285714285715
path: .spaces[0].spaces[0].spaces[4].metrics.halstead.bugs
old: 0.03191162517070485
new: 0.1007014084000215
path: .spaces[0].spaces[0].spaces[4].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[0].spaces[0].spaces[4].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[0].spaces[0].spaces[4].metrics.mi.mi_visual_studio
old: 72.66238008461383
new: 55.1215734502977
path: .spaces[0].spaces[0].spaces[4].metrics.mi.mi_original
old: 124.25266994468964
new: 94.25789060000908
path: .spaces[0].spaces[0].spaces[4].metrics.mi.mi_sei
old: 103.65967861380858
new: 60.58999891948817
path: .spaces[0].spaces[0].spaces[4].metrics.cognitive.sum
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].spaces[4].metrics.cognitive.average
old: 0.0
new: 4.0

### Code

    double Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      MOZ_ASSERT(aData.IsInstanceOf());

      double result = 0;
      if (gDoubleValueField) {
        if (!aEnv) {
          aEnv = jni::GetEnvForThread();
        }
        result = aEnv->GetDoubleField(aData.Get(), gDoubleValueField);
        MOZ_CATCH_JNI_EXCEPTION(aEnv);
      } else {
        result = java::sdk::Number::Ref::From(aData)->DoubleValue();
      }

      return result;
    }

## Minimal test - lines (98, 104)

path: .spaces[0].spaces[0].spaces[6].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[0].spaces[0].spaces[6].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[0].spaces[0].spaces[6].metrics.mi.mi_sei
old: 103.65967861380858
new: 84.41138980866012
path: .spaces[0].spaces[0].spaces[6].metrics.mi.mi_visual_studio
old: 72.66238008461383
new: 64.77755586658185
path: .spaces[0].spaces[0].spaces[6].metrics.mi.mi_original
old: 124.25266994468964
new: 110.76962053185495
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.n2
old: 6.0
new: 12.0
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.N2
old: 10.0
new: 18.0
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.vocabulary
old: 17.0
new: 27.0
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.volume
old: 102.18657103125848
new: 218.7248250995195
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.estimated_program_length
old: 53.5635228093372
new: 101.62290894278166
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.level
old: 0.1090909090909091
new: 0.08888888888888889
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.difficulty
old: 9.166666666666666
new: 11.25
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.bugs
old: 0.03191162517070485
new: 0.06075459715368239
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.effort
old: 936.7102344532028
new: 2460.654282369595
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.length
old: 25.0
new: 46.0
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.purity_ratio
old: 2.142540912373488
new: 2.2091936726691666
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.N1
old: 15.0
new: 28.0
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.n1
old: 11.0
new: 15.0
path: .spaces[0].spaces[0].spaces[6].metrics.halstead.time
old: 52.03945746962237
new: 136.70301568719972
path: .spaces[0].spaces[0].spaces[6].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].spaces[6].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].spaces[6].metrics.loc.ploc
old: 4.0
new: 7.0
path: .spaces[0].spaces[0].spaces[6].metrics.loc.sloc
old: 4.0
new: 7.0
path: .spaces[0].spaces[0].spaces[6].metrics.loc.lloc
old: 1.0
new: 3.0

### Code

    nsString Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      nsString result;
      if (aData != NULL && aData.IsInstanceOf()) {
        result = jni::String::Ref::From(aData)->ToString();
      }
      return result;
    }

## Minimal test - lines (12, 107)

path: .spaces[0].metrics.cyclomatic.average
old: 1.0303030303030305
new: 1.8888888888888888
path: .spaces[0].metrics.cyclomatic.sum
old: 34.0
new: 17.0
path: .spaces[0].metrics.halstead.volume
old: 4673.449780055802
new: 2617.2038482355006
path: .spaces[0].metrics.halstead.bugs
old: 1.4089276195917184
new: 0.5770250121722259
path: .spaces[0].metrics.halstead.difficulty
old: 58.8
new: 27.51923076923077
path: .spaces[0].metrics.halstead.effort
old: 274798.84706728114
new: 72023.43666971156
path: .spaces[0].metrics.halstead.estimated_program_length
old: 410.21345012221025
new: 371.48151536929834
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.5484137033719388
new: 0.8699801296704879
path: .spaces[0].metrics.halstead.time
old: 15266.602614848953
new: 4001.302037206198
path: .spaces[0].metrics.halstead.level
old: 0.017006802721088437
new: 0.0363382250174703
path: .spaces[0].metrics.halstead.n2
old: 55.0
new: 52.0
path: .spaces[0].metrics.halstead.N1
old: 440.0
new: 268.0
path: .spaces[0].metrics.halstead.N2
old: 308.0
new: 159.0
path: .spaces[0].metrics.halstead.length
old: 748.0
new: 427.0
path: .spaces[0].metrics.halstead.n1
old: 21.0
new: 18.0
path: .spaces[0].metrics.halstead.vocabulary
old: 76.0
new: 70.0
path: .spaces[0].metrics.nom.total
old: 27.0
new: 7.0
path: .spaces[0].metrics.nom.functions
old: 27.0
new: 7.0
path: .spaces[0].metrics.loc.cloc
old: 13.0
new: 3.0
path: .spaces[0].metrics.loc.sloc
old: 173.0
new: 96.0
path: .spaces[0].metrics.loc.lloc
old: 29.0
new: 34.0
path: .spaces[0].metrics.loc.ploc
old: 134.0
new: 79.0
path: .spaces[0].metrics.loc.blank
old: 26.0
new: 14.0
path: .spaces[0].metrics.cognitive.sum
old: 1.0
new: 14.0
path: .spaces[0].metrics.cognitive.average
old: 0.037037037037037035
new: 2.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: 20.91139278768665
new: 30.54051343436208
path: .spaces[0].metrics.mi.mi_original
old: 35.75848166694418
new: 52.224277972759154
path: .spaces[0].metrics.mi.mi_sei
old: -0.04926812909207712
new: 14.896333818960647
path: .spaces[0].metrics.nexits.average
old: 0.8518518518518519
new: 0.8571428571428571
path: .spaces[0].metrics.nexits.sum
old: 23.0
new: 6.0
path: .spaces[0].metrics.nargs.average
old: 0.8888888888888888
new: 1.7142857142857142
path: .spaces[0].metrics.nargs.sum
old: 24.0
new: 12.0

### Code

    namespace mozilla {
    namespace jni {

    template
    jfieldID GetValueFieldID(JNIEnv* aEnv, const char* aType) {
      const jfieldID id = aEnv->GetFieldID(
          typename T::Context(aEnv, nullptr).ClassRef(), "value", aType);
      aEnv->ExceptionClear();
      return id;
    }

    // Cached locations of the primitive types within their standard boxed objects
    // to skip doing that lookup on every get.
    static jfieldID gBooleanValueField;
    static jfieldID gIntValueField;
    static jfieldID gDoubleValueField;

    void InitConversionStatics() {
      MOZ_ASSERT(NS_IsMainThread());
      JNIEnv* const env = jni::GetGeckoThreadEnv();
      gBooleanValueField = GetValueFieldID(env, "Z");
      gIntValueField = GetValueFieldID(env, "I");
      gDoubleValueField = GetValueFieldID(env, "D");
    }

    template <>
    bool Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      MOZ_ASSERT(aData.IsInstanceOf());

      bool result = false;
      if (gBooleanValueField) {
        if (!aEnv) {
          aEnv = jni::GetEnvForThread();
        }
        result =
            aEnv->GetBooleanField(aData.Get(), gBooleanValueField) != JNI_FALSE;
        MOZ_CATCH_JNI_EXCEPTION(aEnv);
      } else {
        result = java::sdk::Boolean::Ref::From(aData)->BooleanValue();
      }

      return result;
    }

    template <>
    int Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      MOZ_ASSERT(aData.IsInstanceOf());

      int result = 0;
      if (gIntValueField) {
        if (!aEnv) {
          aEnv = jni::GetEnvForThread();
        }
        result = aEnv->GetIntField(aData.Get(), gIntValueField);
        MOZ_CATCH_JNI_EXCEPTION(aEnv);
      } else {
        result = java::sdk::Number::Ref::From(aData)->IntValue();
      }

      return result;
    }

    template <>
    double Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      MOZ_ASSERT(aData.IsInstanceOf());

      double result = 0;
      if (gDoubleValueField) {
        if (!aEnv) {
          aEnv = jni::GetEnvForThread();
        }
        result = aEnv->GetDoubleField(aData.Get(), gDoubleValueField);
        MOZ_CATCH_JNI_EXCEPTION(aEnv);
      } else {
        result = java::sdk::Number::Ref::From(aData)->DoubleValue();
      }

      return result;
    }

    template <>
    ipc::LaunchError Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      return ipc::LaunchError{};
    }

    template <>
    nsString Java2Native(mozilla::jni::Object::Param aData, JNIEnv* aEnv) {
      nsString result;
      if (aData != NULL && aData.IsInstanceOf()) {
        result = jni::String::Ref::From(aData)->ToString();
      }
      return result;
    }

    }  // namespace jni
    }  // namespace mozilla

## Minimal test - lines (16, 21)

path: .spaces[0].spaces[0].spaces[0].metrics.nargs.average
old: 0.5714285714285714
new: 2.0
path: .spaces[0].spaces[0].spaces[0].metrics.nargs.sum
old: 4.0
new: 2.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.level
old: 0.02450980392156863
new: 0.12440191387559808
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.length
old: 250.0
new: 41.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n2
old: 20.0
new: 13.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N2
old: 102.0
new: 19.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.volume
old: 1292.481250360578
new: 187.9834625295674
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n1
old: 16.0
new: 11.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.effort
old: 52733.23501471158
new: 1511.0978334107533
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.difficulty
old: 40.8
new: 8.038461538461538
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.vocabulary
old: 36.0
new: 24.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.bugs
old: 0.4687432445072844
new: 0.043894199569285225
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N1
old: 148.0
new: 22.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 150.43856189774726
new: 86.15946414084446
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 0.601754247590989
new: 2.1014503448986455
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.time
old: 2929.6241674839766
new: 83.94987963393073
path: .spaces[0].spaces[0].spaces[0].metrics.nexits.sum
old: 5.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.nexits.average
old: 0.7142857142857143
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 36.62195880295323
new: 66.96751803000258
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_original
old: 62.623549553050026
new: 114.51445583130442
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_sei
old: 45.01674712703714
new: 89.61040540531283
path: .spaces[0].spaces[0].spaces[0].metrics.nom.total
old: 7.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.nom.functions
old: 7.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.cyclomatic.sum
old: 8.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.ploc
old: 52.0
new: 6.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.sloc
old: 72.0
new: 6.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.blank
old: 8.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.cloc
old: 12.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.lloc
old: 9.0
new: 2.0

### Code

    jfieldID GetValueFieldID(JNIEnv* aEnv, const char* aType) {
      const jfieldID id = aEnv->GetFieldID(
          typename T::Context(aEnv, nullptr).ClassRef(), "value", aType);
      aEnv->ExceptionClear();
      return id;
    }