test_class.file: objects/src/test/java/org/cthul/objects/reflection/JavaSignatureComparatorTest.java
test_class.identifier: JavaSignatureComparatorTest
test_case.body: @Test
      public void test_specificness_ambiguous() {
          Class[] args = {Integer.class, Integer.class};
          Class[] params1 = {Object.class, Number.class};
          Class[] params2 = {Number.class, Object.class};
          JavaSignatureComparator jsCmp = new JavaSignatureComparator(args);
          int spec = jsCmp.compareSpecificness(params1, false, params2, false);
          assertThat(spec, is(0));
      }
test_case.class_method_signature: JavaSignatureComparatorTest.test_specificness_ambiguous()
test_case.full_signature: @Test public void test_specificness_ambiguous()
test_case.identifier: test_specificness_ambiguous
test_case.invocations: compareSpecificness assertThat is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_specificness_ambiguous()
focal_class.declarator: MATCH =          400
focal_class.modifier: public static final
focal_class.original_string: public static final int MATCH =          400;
focal_class.type: int
focal_class.var_name: MATCH
focal_class.declarator: MATCH_WILDCARD = 300
focal_class.modifier: public static final
focal_class.original_string: public static final int MATCH_WILDCARD = 300;
focal_class.type: int
focal_class.var_name: MATCH_WILDCARD
focal_class.declarator: MATCH_BOXING =   200
focal_class.modifier: public static final
focal_class.original_string: public static final int MATCH_BOXING =   200;
focal_class.type: int
focal_class.var_name: MATCH_BOXING
focal_class.declarator: MATCH_VARARGS =  100
focal_class.modifier: public static final
focal_class.original_string: public static final int MATCH_VARARGS =  100;
focal_class.type: int
focal_class.var_name: MATCH_VARARGS
focal_class.declarator: NO_MATCH =       -99
focal_class.modifier: public static final
focal_class.original_string: public static final int NO_MATCH =       -99;
focal_class.type: int
focal_class.var_name: NO_MATCH
focal_class.declarator: argTypes
focal_class.modifier: private final
focal_class.original_string: private final Class<?>[] argTypes;
focal_class.type: Class<?>[]
focal_class.var_name: argTypes
focal_class.file: objects/src/main/java/org/cthul/objects/reflection/JavaSignatureComparator.java
focal_class.identifier: JavaSignatureComparator
focal_class.class_method_signature: JavaSignatureComparator.JavaSignatureComparator(Class<?>... argTypes)
focal_class.full_signature: public  JavaSignatureComparator(Class<?>... argTypes)
focal_class.identifier: JavaSignatureComparator
focal_class.modifiers: public
focal_class.parameters: (Class<?>... argTypes)
focal_class.signature:  JavaSignatureComparator(Class<?>... argTypes)
focal_class.class_method_signature: JavaSignatureComparator.getReferenceSignature()
focal_class.full_signature: public Class<?>[] getReferenceSignature()
focal_class.identifier: getReferenceSignature
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Class<?>[]
focal_class.signature: Class<?>[] getReferenceSignature()
focal_class.class_method_signature: JavaSignatureComparator.compareSpecificness(final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs)
focal_class.full_signature: public int compareSpecificness(final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs)
focal_class.identifier: compareSpecificness
focal_class.modifiers: public
focal_class.parameters: (final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs)
focal_class.return: int
focal_class.signature: int compareSpecificness(final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs)
focal_class.class_method_signature: JavaSignatureComparator.compareParameter(Class<?> a, Class<?> b)
focal_class.full_signature: private int compareParameter(Class<?> a, Class<?> b)
focal_class.identifier: compareParameter
focal_class.modifiers: private
focal_class.parameters: (Class<?> a, Class<?> b)
focal_class.return: int
focal_class.signature: int compareParameter(Class<?> a, Class<?> b)
focal_class.class_method_signature: JavaSignatureComparator.applicability(final Class<?>[] paramTypes, boolean varArgs)
focal_class.full_signature: public int applicability(final Class<?>[] paramTypes, boolean varArgs)
focal_class.identifier: applicability
focal_class.modifiers: public
focal_class.parameters: (final Class<?>[] paramTypes, boolean varArgs)
focal_class.return: int
focal_class.signature: int applicability(final Class<?>[] paramTypes, boolean varArgs)
focal_class.class_method_signature: JavaSignatureComparator.applicable(Class<?> arg, Class<?> param)
focal_class.full_signature: private int applicable(Class<?> arg, Class<?> param)
focal_class.identifier: applicable
focal_class.modifiers: private
focal_class.parameters: (Class<?> arg, Class<?> param)
focal_class.return: int
focal_class.signature: int applicable(Class<?> arg, Class<?> param)
focal_method.body: public int compareSpecificness(final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs) {
          final int a_fixLen = a.length - (a_varArgs ? 1 : 0);
          final int b_fixLen = b.length - (b_varArgs ? 1 : 0);
          final int fixLen = Math.min(a_fixLen, b_fixLen);
          int c = 0; // result of comparison
          
          // compare fix args
          for (int i = 0; i < fixLen; i++) {
              int newC = compareParameter(a[i], b[i]);
              if (newC != 0 && newC != c) {
                  if (c == 0) c = newC;
                  else return 0; // ambiguous
              }
          }
          
          // compare varargs of the shorter signature against fixargs of other
          Class<?> a_varType = a_varArgs ? a[a_fixLen] : null;
          Class<?> b_varType = b_varArgs ? b[b_fixLen] : null;
          if (a_varArgs && a_fixLen < b_fixLen) {
              // compare remaining fixArgs of b
              for (int i = fixLen; i < b_fixLen; i++) {
                  int newC = compareParameter(a_varType, b[i]);
                  if (newC != 0 && newC != c) {
                      if (c == 0) c = newC;
                      else return 0; // ambiguous
                  }
              }
          }
          if (b_varArgs && b_fixLen < a_fixLen) {
              // compare remaining fixArgs of a
              for (int i = fixLen; i < a_fixLen; i++) {
                  int newC = compareParameter(a[i], b_varType);
                  if (newC != 0 && newC != c) {
                      if (c == 0) c = newC;
                      else return 0; // ambiguous
                  }
              }
          }
          
          boolean a_varArgsUsed = a_varArgs && argTypes.length > a_fixLen;
          boolean b_varArgsUsed = b_varArgs && argTypes.length > b_fixLen;
          if (a_varArgsUsed && b_varArgsUsed) {
              // if var args are needed, compare them
              int newC = compareParameter(a_varType, b_varType);
              if (newC != 0 && newC != c) {
                  if (c == 0) c = newC;
                  else return 0; // ambiguous
              }
          }
          if (c == 0) {
              // if still equal, more fix args wins
              if (a_fixLen > b_fixLen) {
                  return -1;
              } else if (b_fixLen > a_fixLen) {
                  return  1;
              }
          }
          return c;
      }
focal_method.class_method_signature: JavaSignatureComparator.compareSpecificness(final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs)
focal_method.full_signature: public int compareSpecificness(final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs)
focal_method.identifier: compareSpecificness
focal_method.invocations: min compareParameter compareParameter compareParameter compareParameter
focal_method.modifiers: public
focal_method.parameters: (final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs)
focal_method.return: int
focal_method.signature: int compareSpecificness(final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs)