Remove infinite recursion in HistoryEntrySubject

The HistoryEntrySubject.actualCustomStringRepresentation() was calling a superclass method which ultimately called HistoryEntrySubject.actualCustomStringRepresentation(). So any test which failed due to a HistoryEntry problem resulted in a stack overflow error instead of a more helpful error indicating the actual problem. The solution is not to call the superclass method.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143702856
This commit is contained in:
mountford 2017-01-05 13:37:17 -08:00 committed by Ben McIlwain
parent 8b297fa099
commit 527668c1b0

View file

@ -40,7 +40,10 @@ public class HistoryEntrySubject extends Subject<HistoryEntrySubject, HistoryEnt
@Override @Override
public String actualCustomStringRepresentation() { public String actualCustomStringRepresentation() {
return Optional.fromNullable(customDisplaySubject).or(super.actualAsString()); // This will unfortunately not use the customName field in the superclass, but we can't call
// super.actualAsString(), because as currently implemented, it would result in an infinite
// recursion.
return Optional.fromNullable(customDisplaySubject).or(String.valueOf(actual()));
} }
public HistoryEntrySubject withCustomDisplaySubject(String customDisplaySubject) { public HistoryEntrySubject withCustomDisplaySubject(String customDisplaySubject) {