Program: 9316
Project: 9316
Buggy source:
/** 
 * Some generics notes: Andy 6-May-05 We were having trouble with parameterized types in a couple of places - due to TypeVariableBindings.  When we see a TypeVariableBinding now we default to either the firstBound if it is specified or java.lang.Object.  Not sure when/if this gets us unstuck?  It does mean we forget that it is a type variable when going back the other way from the TypeX and that would seem a bad thing - but I've yet to see the reason we need to remember the type variable.
 */
public static TypeX fromBinding(TypeBinding binding){
  if (binding instanceof HelperInterfaceBinding) {
    return ((HelperInterfaceBinding)binding).getTypeX();
  }
  if (binding == null || binding.qualifiedSourceName() == null) {
    return ResolvedTypeX.MISSING;
  }
  if (binding instanceof TypeVariableBinding) {
    TypeVariableBinding tvb=(TypeVariableBinding)binding;
    if (tvb.firstBound != null) {
      return TypeX.forName(getName(tvb.firstBound));
    }
 else {
      return TypeX.forName(getName(tvb.superclass));
    }
  }
  if (binding instanceof ParameterizedTypeBinding) {
    if (binding instanceof RawTypeBinding) {
      return TypeX.forRawTypeNames(getName(binding));
    }
    ParameterizedTypeBinding ptb=(ParameterizedTypeBinding)binding;
    String[] arguments=new String[ptb.arguments.length];
    for (int i=0; i < arguments.length; i++) {
      if (ptb.arguments[i] instanceof WildcardBinding) {
        WildcardBinding wcb=(WildcardBinding)ptb.arguments[i];
        arguments[i]=getName(((TypeVariableBinding)wcb.typeVariable()).firstBound);
      }
 else {
        arguments[i]=fromBinding(ptb.arguments[i]).getName();
      }
    }
    return TypeX.forParameterizedTypeNames(getName(binding),arguments);
  }
  return TypeX.forName(getName(binding));
}

Fixed version (ground truth):
/** 
 * Some generics notes: Andy 6-May-05 We were having trouble with parameterized types in a couple of places - due to TypeVariableBindings.  When we see a TypeVariableBinding now we default to either the firstBound if it is specified or java.lang.Object.  Not sure when/if this gets us unstuck?  It does mean we forget that it is a type variable when going back the other way from the TypeX and that would seem a bad thing - but I've yet to see the reason we need to remember the type variable.
 */
public static TypeX fromBinding(TypeBinding binding){
  if (binding instanceof HelperInterfaceBinding) {
    return ((HelperInterfaceBinding)binding).getTypeX();
  }
  if (binding == null || binding.qualifiedSourceName() == null) {
    return ResolvedTypeX.MISSING;
  }
  if (binding instanceof TypeVariableBinding) {
    TypeVariableBinding tvb=(TypeVariableBinding)binding;
    if (tvb.firstBound != null) {
      return TypeX.forName(getName(tvb.firstBound));
    }
 else {
      return TypeX.forName(getName(tvb.superclass));
    }
  }
  if (binding instanceof ParameterizedTypeBinding) {
    if (binding instanceof RawTypeBinding) {
      return TypeX.forRawTypeNames(getName(binding));
    }
    ParameterizedTypeBinding ptb=(ParameterizedTypeBinding)binding;
    String[] arguments=null;
    if (ptb.arguments != null) {
      arguments=new String[ptb.arguments.length];
      for (int i=0; i < arguments.length; i++) {
        if (ptb.arguments[i] instanceof WildcardBinding) {
          WildcardBinding wcb=(WildcardBinding)ptb.arguments[i];
          arguments[i]=getName(((TypeVariableBinding)wcb.typeVariable()).firstBound);
        }
 else {
          arguments[i]=fromBinding(ptb.arguments[i]).getName();
        }
      }
    }
    return TypeX.forParameterizedTypeNames(getName(binding),arguments);
  }
  return TypeX.forName(getName(binding));
}