[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:
Vincent Latombe committed 2020-10-07 14:44:15 +02:00
1 parent 2791c4f222
commit 4ff3f04436
4 files changed
+18 -16

No files matched your search

+1 -1
View File
@@ -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;
}
}
/**