mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-11 19:16:42 +00:00
[JENKINS-63828] It is legal to have a CloudProvisioningListener not implementing canProvision
I got confused in https://github.com/jenkinsci/jenkins/commit/3992a30efb1abf697cae8e02f9e81dd04b92b135 by Cloud#canProvision which was abstract vs. CloudProvisioningListener#canProvision which wasn't and was returning null.
This commit is contained in:
4 files changed
+18
-16
No files matched your search
@@ -1480,7 +1480,7 @@ public class Util {
|
||||
if (isOverridden(base, derived, methodName, types)) {
|
||||
return supplier.get();
|
||||
} else {
|
||||
throw new AbstractMethodError("You must override at least one of the "
|
||||
throw new AbstractMethodError("The class " + derived.getName() + " must override at least one of the "
|
||||
+ base.getSimpleName() + "." + methodName + " methods");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,13 +42,16 @@ public abstract class CloudProvisioningListener implements ExtensionPoint {
|
||||
*/
|
||||
@Deprecated
|
||||
public CauseOfBlockage canProvision(Cloud cloud, Label label, int numExecutors) {
|
||||
return Util.ifOverridden(() -> canProvision(cloud, new CloudState(label, 0), numExecutors),
|
||||
CloudProvisioningListener.class,
|
||||
if (Util.isOverridden(CloudProvisioningListener.class,
|
||||
getClass(),
|
||||
"canProvision",
|
||||
Cloud.class,
|
||||
CloudState.class,
|
||||
int.class);
|
||||
int.class)) {
|
||||
return canProvision(cloud, new CloudState(label, 0), numExecutors);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user