From aee346a6d91945d30b9c4f44ecf233f274f15973 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Tue, 30 Jul 2019 09:39:24 -0700 Subject: [PATCH] Clean up generics --- .../timestamper/annotator/TimestampAnnotator.java | 6 ++---- .../annotator/TimestampAnnotatorFactory3.java | 11 +++-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotator.java b/src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotator.java index e7a08b80..1d75b0c4 100644 --- a/src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotator.java +++ b/src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotator.java @@ -46,7 +46,7 @@ * * @author Steven G. Brown */ -public final class TimestampAnnotator extends ConsoleAnnotator { +public final class TimestampAnnotator extends ConsoleAnnotator> { private static final long serialVersionUID = 1L; @@ -69,9 +69,7 @@ public final class TimestampAnnotator extends ConsoleAnnotator { /** {@inheritDoc} */ @Override - public ConsoleAnnotator annotate(Object context, MarkupText text) { - Run build = (Run) context; - + public ConsoleAnnotator> annotate(Run build, MarkupText text) { try { if (timestampsReader == null) { ConsoleLogParser.Result logPosition = logParser.seek(build); diff --git a/src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory3.java b/src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory3.java index 986129f9..be5cf4d3 100644 --- a/src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory3.java +++ b/src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory3.java @@ -41,17 +41,12 @@ * @author Steven G. Brown */ @Extension(dynamicLoadable = YesNoMaybe.YES) -public final class TimestampAnnotatorFactory3 extends ConsoleAnnotatorFactory { +public final class TimestampAnnotatorFactory3 extends ConsoleAnnotatorFactory> { /** {@inheritDoc} */ @Override - public ConsoleAnnotator newInstance(Object context) { - // Prior to Jenkins 2.145, context was the build class (see 7bc431f) - Class contextClass = context instanceof Class ? (Class) context : context.getClass(); - if (!Run.class.isAssignableFrom(contextClass)) { - return null; // something else - } - if (TimestampNote.useTimestampNotes(contextClass)) { + public ConsoleAnnotator> newInstance(Run build) { + if (TimestampNote.useTimestampNotes(build.getClass())) { return null; // not using this system } StaplerRequest request = Stapler.getCurrentRequest();