From 5535560e71b4104db6d43db3bd024c2f8c09a727 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Wed, 7 Apr 2021 15:01:57 -0400 Subject: [PATCH] CLICommandInvoker was being too script about how a CLICommand was registered --- src/main/java/hudson/cli/CLICommandInvoker.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/hudson/cli/CLICommandInvoker.java b/src/main/java/hudson/cli/CLICommandInvoker.java index 1249f05f5..7bce1eb75 100644 --- a/src/main/java/hudson/cli/CLICommandInvoker.java +++ b/src/main/java/hudson/cli/CLICommandInvoker.java @@ -24,7 +24,7 @@ package hudson.cli; -import hudson.Extension; +import hudson.ExtensionList; import hudson.model.User; import hudson.security.ACL; import hudson.security.AuthorizationStrategy; @@ -78,13 +78,7 @@ public class CLICommandInvoker { public CLICommandInvoker(final JenkinsRule rule, final CLICommand command) { - if (command.getClass().getAnnotation(Extension.class) == null) { - - throw new AssertionError(String.format( - "Command %s is missing @Extension annotation.", - command.getClass() - )); - } + ExtensionList.lookupSingleton(command.getClass()); // verify that it was registered e.g. with @Extension this.rule = rule; this.command = command;