Turns out there were already tests with mock ConsoleAnnotatorFactory. Generifying one reproduces the CCE.
@@ -81,16 +81,17 @@ public class ConsoleAnnotatorTest {
* Only annotates the first occurrence of "ooo".
*/
@TestExtension("completedStatelessLogAnnotation")
- public static final ConsoleAnnotatorFactory DEMO_ANNOTATOR = new ConsoleAnnotatorFactory() {
- public ConsoleAnnotator newInstance(Object context) {
+ public static final class DemoAnnotatorFactory extends ConsoleAnnotatorFactory<FreeStyleBuild> {
+ @Override
+ public ConsoleAnnotator<FreeStyleBuild> newInstance(FreeStyleBuild context) {
return new DemoAnnotator();
}
- };
+ }
- public static class DemoAnnotator extends ConsoleAnnotator<Object> {
+ public static class DemoAnnotator extends ConsoleAnnotator<FreeStyleBuild> {
private static final String ANNOTATE_TEXT = "ooo" + System.getProperty("line.separator");
@Override
- public ConsoleAnnotator annotate(Object build, MarkupText text) {
+ public ConsoleAnnotator<FreeStyleBuild> annotate(FreeStyleBuild build, MarkupText text) {
if (text.getText().equals(ANNOTATE_TEXT)) {
text.addMarkup(0,3,"<b class=demo>","</b>");
return null;
