Skip to content

Commit

Permalink
Fixes bugs that popped up after removing realizeCacheFor
Browse files Browse the repository at this point in the history
  • Loading branch information
jqno committed Nov 23, 2024
1 parent e9749eb commit 67aaaec
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package nl.jqno.equalsverifier.internal.reflection.vintage.prefabvalues.factories;

import java.lang.reflect.Array;
import nl.jqno.equalsverifier.internal.reflection.ClassProbe;
import nl.jqno.equalsverifier.internal.reflection.Tuple;
import nl.jqno.equalsverifier.internal.reflection.TypeTag;
import nl.jqno.equalsverifier.internal.reflection.instantiation.InstanceCreator;
import nl.jqno.equalsverifier.internal.reflection.instantiation.ValueProvider.Attributes;
import nl.jqno.equalsverifier.internal.reflection.instantiation.VintageValueProvider;
import nl.jqno.equalsverifier.internal.reflection.vintage.ClassAccessor;
Expand Down Expand Up @@ -83,7 +85,11 @@ private Tuple<T> giveInstances(
ClassAccessor<T> accessor = ClassAccessor.of(tag.getType(), valueProvider, objenesis);
T red = accessor.getRedObject(tag, attributes);
T blue = accessor.getBlueObject(tag, attributes);
T redCopy = accessor.getRedObject(tag, attributes);

@SuppressWarnings("unchecked")
Class<T> actualType = (Class<T>) red.getClass();
T redCopy = new InstanceCreator<>(new ClassProbe<T>(actualType), objenesis).copy(red);

return new Tuple<>(red, blue, redCopy);
}
}

0 comments on commit 67aaaec

Please sign in to comment.