Mark actualCustomStringRepresentation() as @ForOverride.

The intention (from []is:
- actualAsString() is the method that people call.
- actualCustomStringRepresentation() is the method that people override.

Fortunately, no one actually calls actualCustomStringRepresentation(), aside from some tests that call it to test a subject's implementation. That's easy enough to work around by extracting a method.
(Arguably @ForOverride should permit calls from tests in some cases (now that Error Prone knows how to identify test code). But it's not entirely clear, since, e.g., people shouldn't be testing Converter.doForward(null) because the method can never be invoked that way. Some discussion here: []Tested:
global TAP
[]
RELNOTES=Marked `actualCustomStringRepresentation()` as `@ForOverride`. To retrieve the string representation, call `actualAsString()`.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185672328
This commit is contained in:
cpovirk 2018-02-14 05:10:31 -08:00 committed by jianglai
parent b0cbc0f60d
commit 220f7589f5
2 changed files with 2 additions and 2 deletions

View file

@ -53,7 +53,7 @@ abstract class AbstractEppResourceSubject
}
@Override
public String actualCustomStringRepresentation() {
protected String actualCustomStringRepresentation() {
return String.format(
"%s with foreign key '%s'",
actual().getClass().getSimpleName(),