Program: 164696
Project: 164696
Buggy source:
/** 
 * Applies the   {@linkplain Mock mock methods} defined in the mock-up subclass to the type specified through the typeparameter, but only affecting the given instance. <p/> In most cases, the constructor with no parameters should be adequate. This variation can be used when mock data or behavior is desired only for a particular instance, with other instances remaining unaffected; or when multiple mock-up objects carrying different states are desired, with one mock-up instance per real instance. <p/> If  {@link #getMockInstance()} later gets called on this mock-up instance, it will return the instance that wasgiven here.
 * @param targetInstance a real instance of the type to be faked, meant to be the only one of that type that shouldbe affected by this mock-up instance; must not be  {@code null}
 * @see #MockUp()
 * @see #MockUp(Class)
 */
protected MockUp(@Nonnull T targetInstance){
  if (targetInstance == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  validateFakingAllowed();
  MockUp<?> previousMockUp=findPreviouslyFakedClassIfMockUpAlreadyApplied();
  if (previousMockUp != null) {
    targetType=previousMockUp.targetType;
    mockedClass=previousMockUp.mockedClass;
    return;
  }
  @SuppressWarnings("String_Node_Str") Class<T> classToMock=(Class<T>)targetInstance.getClass();
  validateThatClassToFakeIsExternal(classToMock);
  targetType=classToMock;
  mockedClass=classToMock;
  classesToRestore=redefineMethods(classToMock,classToMock,classToMock);
  setMockInstance(targetInstance);
}

Fixed version (ground truth):
/** 
 * Applies the   {@linkplain Mock mock methods} defined in the mock-up subclass to the type specified through the typeparameter, but only affecting the given instance. <p/> In most cases, the constructor with no parameters should be adequate. This variation can be used when mock data or behavior is desired only for a particular instance, with other instances remaining unaffected; or when multiple mock-up objects carrying different states are desired, with one mock-up instance per real instance. <p/> If  {@link #getMockInstance()} later gets called on this mock-up instance, it will return the instance that wasgiven here.
 * @param targetInstance a real instance of the type to be faked, meant to be the only one of that type that shouldbe affected by this mock-up instance; must not be  {@code null}
 * @see #MockUp()
 * @see #MockUp(Class)
 */
protected MockUp(@Nonnull T targetInstance){
  if (targetInstance == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  validateFakingAllowed();
  MockUp<?> previousMockUp=findPreviouslyFakedClassIfMockUpAlreadyApplied();
  if (previousMockUp != null) {
    targetType=previousMockUp.targetType;
    mockedClass=previousMockUp.mockedClass;
    setMockInstance(targetInstance);
    return;
  }
  @SuppressWarnings("String_Node_Str") Class<T> classToMock=(Class<T>)targetInstance.getClass();
  validateThatClassToFakeIsExternal(classToMock);
  targetType=classToMock;
  mockedClass=classToMock;
  classesToRestore=redefineMethods(classToMock,classToMock,classToMock);
  setMockInstance(targetInstance);
}