Buggy code:
public class TypecheckResult { private final TestConfiguration configuration ; private final CompilationResult compilationResult ; private final List < String > expectedDiagnostics ; private final boolean testFailed ; private final List < String > missingDiagnostics ; private final List < String > unexpectedDiagnostics ; protected TypecheckResult ( TestConfiguration configuration , CompilationResult compilationResult , List < String > expectedDiagnostics , boolean testFailed , List < String > missingDiagnostics , List < String > unexpectedDiagnostics ) { } public TestConfiguration getConfiguration ( ) { } public CompilationResult getCompilationResult ( ) { } public List < Diagnostic < ? extends JavaFileObject > > getActualDiagnostics ( ) { } public List < String > getExpectedDiagnostics ( ) { } public boolean didTestFail ( ) { } public List < String > getMissingDiagnostics ( ) { } public List < String > getUnexpectedDiagnostics ( ) { } public List < String > getErrorHeaders ( ) { } public String summarize ( ) { if ( testFailed ) { StringBuilder summaryBuilder = new StringBuilder ( ) ; summaryBuilder . append ( PluginUtil . join ( "\n" , getErrorHeaders ( ) ) ) ; summaryBuilder . append ( "\n" ) ; if ( ! ( missingDiagnostics . isEmpty ( ) ) ) { summaryBuilder . append ( ( ( missingDiagnostics . size ( ) ) == 1 ? "1<seq2seq4repair_space>expected<seq2seq4repair_space>diagnostic<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>found:\n" : ( missingDiagnostics . size ( ) ) + "<seq2seq4repair_space>expected<seq2seq4repair_space>diagnostics<seq2seq4repair_space>were<seq2seq4repair_space>not<seq2seq4repair_space>found:\n" ) ) ; for ( String missing : missingDiagnostics ) { summaryBuilder . append ( missing ) ; summaryBuilder . append ( "\n" ) ; } } if ( ! ( unexpectedDiagnostics . isEmpty ( ) ) ) { <START_BUG> summaryBuilder . append ( ( ( unexpectedDiagnostics . size ( ) ) == 1 ? "1<seq2seq4repair_space>unexpected<seq2seq4repair_space>diagnostic<seq2seq4repair_space>was<seq2seq4repair_space>found:\n" : ( missingDiagnostics . size ( ) ) + "<seq2seq4repair_space>unexpected<seq2seq4repair_space>diagnostics<seq2seq4repair_space>were<seq2seq4repair_space>found:\n" ) ) ; <END_BUG> for ( String unexpected : unexpectedDiagnostics ) { summaryBuilder . append ( unexpected ) ; summaryBuilder . append ( "\n" ) ; } } summaryBuilder . append ( ( "While<seq2seq4repair_space>type-checking<seq2seq4repair_space>" + ( TestUtilities . summarizeSourceFiles ( configuration . getTestSourceFiles ( ) ) ) ) ) ; return summaryBuilder . toString ( ) ; } return "" ; } public static TypecheckResult fromCompilationResults ( TestConfiguration configuration , CompilationResult result , List < String > expectedDiagnostics ) { } public static TypecheckResult fromCompilationResultsExpectedDiagnostics ( TestConfiguration configuration , CompilationResult result , List < ExpectedDiagnostic > expectedDiagnostics ) { } }

Fix:
summaryBuilder . append ( ( ( unexpectedDiagnostics . size ( ) ) == 1 ? "1<seq2seq4repair_space>unexpected<seq2seq4repair_space>diagnostic<seq2seq4repair_space>was<seq2seq4repair_space>found:\n" : ( unexpectedDiagnostics . size ( ) ) + "<seq2seq4repair_space>unexpected<seq2seq4repair_space>diagnostics<seq2seq4repair_space>were<seq2seq4repair_space>found:\n" ) ) ;