diff options
author | Sven Selberg <svense@axis.com> | 2024-02-21 13:48:07 +0100 |
---|---|---|
committer | Sven Selberg <svense@axis.com> | 2024-04-10 19:16:10 +0000 |
commit | cd93e0b77245e9dbc99200375f6649ec8ec130e2 (patch) | |
tree | a60249a33c35e757b50ebb6077eb935fbe5c6bf6 | |
parent | 246bb76ab55b6077f47069e4ad41979f81b6d1af (diff) |
Suppress deprecation warning for LabelType.Builder#setFunction(...)
As long as we have Rest API and tests for label functions we will use
this method and the compiler warnings makes it difficult to check
if new changes introduces other compiler warnings.
Release-Notes: skip
Change-Id: I788ef20091b39d72712ecfaed287a15af5921001
8 files changed, 23 insertions, 0 deletions
diff --git a/java/com/google/gerrit/acceptance/AbstractDaemonTest.java b/java/com/google/gerrit/acceptance/AbstractDaemonTest.java index 01c4942bbe..92c3e92007 100644 --- a/java/com/google/gerrit/acceptance/AbstractDaemonTest.java +++ b/java/com/google/gerrit/acceptance/AbstractDaemonTest.java @@ -1543,6 +1543,7 @@ public abstract class AbstractDaemonTest { configLabel(project, label, func, ImmutableList.of(), value); } + @SuppressWarnings("deprecation") private void configLabel( Project.NameKey project, String label, diff --git a/java/com/google/gerrit/server/restapi/project/CreateLabel.java b/java/com/google/gerrit/server/restapi/project/CreateLabel.java index ad32f4f738..ad79a14fc0 100644 --- a/java/com/google/gerrit/server/restapi/project/CreateLabel.java +++ b/java/com/google/gerrit/server/restapi/project/CreateLabel.java @@ -123,6 +123,7 @@ public class CreateLabel * @throws BadRequestException if there was invalid data in the input * @throws ResourceConflictException if the label cannot be created due to a conflict */ + @SuppressWarnings("deprecation") public LabelType createLabel(ProjectConfig config, String label, LabelDefinitionInput input) throws BadRequestException, ResourceConflictException { if (config.getLabelSections().containsKey(label)) { diff --git a/java/com/google/gerrit/server/restapi/project/SetLabel.java b/java/com/google/gerrit/server/restapi/project/SetLabel.java index 10589cc9b3..6c4976d76f 100644 --- a/java/com/google/gerrit/server/restapi/project/SetLabel.java +++ b/java/com/google/gerrit/server/restapi/project/SetLabel.java @@ -115,6 +115,7 @@ public class SetLabel implements RestModifyView<LabelResource, LabelDefinitionIn * @throws BadRequestException if there was invalid data in the input * @throws ResourceConflictException if the update cannot be applied due to a conflict */ + @SuppressWarnings("deprecation") public boolean updateLabel(ProjectConfig config, LabelType labelType, LabelDefinitionInput input) throws BadRequestException, ResourceConflictException { boolean dirty = false; diff --git a/javatests/com/google/gerrit/acceptance/api/change/StickyApprovalsIT.java b/javatests/com/google/gerrit/acceptance/api/change/StickyApprovalsIT.java index 2668d1f6c8..6ba1498a68 100644 --- a/javatests/com/google/gerrit/acceptance/api/change/StickyApprovalsIT.java +++ b/javatests/com/google/gerrit/acceptance/api/change/StickyApprovalsIT.java @@ -1232,6 +1232,7 @@ public class StickyApprovalsIT extends AbstractDaemonTest { .contains("Code-Review+1 by User"); } + @SuppressWarnings("deprecation") @Test public void sticky_copiedToLatestPatchSetFromSubmitRecords() throws Exception { updateVerifiedLabel(b -> b.setFunction(LabelFunction.NO_BLOCK)); diff --git a/javatests/com/google/gerrit/acceptance/api/change/SubmitRequirementIT.java b/javatests/com/google/gerrit/acceptance/api/change/SubmitRequirementIT.java index 242c2784ef..c2235626d0 100644 --- a/javatests/com/google/gerrit/acceptance/api/change/SubmitRequirementIT.java +++ b/javatests/com/google/gerrit/acceptance/api/change/SubmitRequirementIT.java @@ -1576,6 +1576,7 @@ public class SubmitRequirementIT extends AbstractDaemonTest { // Clear SRs for the project and update code-review label to be non-blocking. clearSubmitRequirements(project); + @SuppressWarnings("deprecation") LabelType cr = TestLabels.codeReview().toBuilder().setFunction(LabelFunction.NO_BLOCK).build(); try (ProjectConfigUpdate u = updateProject(project)) { @@ -1622,6 +1623,7 @@ public class SubmitRequirementIT extends AbstractDaemonTest { // Clear SRs for the project and update code-review label to be non-blocking. clearSubmitRequirements(project); + @SuppressWarnings("deprecation") LabelType cr = TestLabels.codeReview().toBuilder().setFunction(LabelFunction.NO_BLOCK).build(); try (ProjectConfigUpdate u = updateProject(project)) { @@ -2836,6 +2838,7 @@ public class SubmitRequirementIT extends AbstractDaemonTest { .setAllowOverrideInChildProjects(true) .build()); + @SuppressWarnings("deprecation") LabelType cr = TestLabels.codeReview().toBuilder().setFunction(LabelFunction.NO_BLOCK).build(); try (ProjectConfigUpdate u = updateProject(project)) { u.getConfig().upsertLabelType(cr); diff --git a/javatests/com/google/gerrit/acceptance/api/change/SubmitRuleIT.java b/javatests/com/google/gerrit/acceptance/api/change/SubmitRuleIT.java index af95e7eaec..e7efb625cb 100644 --- a/javatests/com/google/gerrit/acceptance/api/change/SubmitRuleIT.java +++ b/javatests/com/google/gerrit/acceptance/api/change/SubmitRuleIT.java @@ -98,6 +98,7 @@ public class SubmitRuleIT extends AbstractDaemonTest { assertThat(recordLabels).contains(needCustomLabel); } + @SuppressWarnings("deprecation") private void setupCustomBlockingLabel() throws Exception { try (ProjectConfigUpdate u = updateProject(project)) { u.getConfig() diff --git a/javatests/com/google/gerrit/acceptance/server/project/CustomLabelIT.java b/javatests/com/google/gerrit/acceptance/server/project/CustomLabelIT.java index 576c7d08ce..7ffc0a4ee5 100644 --- a/javatests/com/google/gerrit/acceptance/server/project/CustomLabelIT.java +++ b/javatests/com/google/gerrit/acceptance/server/project/CustomLabelIT.java @@ -76,6 +76,7 @@ public class CustomLabelIT extends AbstractDaemonTest { .update(); } + @SuppressWarnings("deprecation") @Test public void customLabelNoOp_NegativeVoteNotBlock() throws Exception { saveLabelConfig(LABEL.toBuilder().setFunction(NO_OP)); @@ -91,6 +92,7 @@ public class CustomLabelIT extends AbstractDaemonTest { assertThat(q.blocking).isNull(); } + @SuppressWarnings("deprecation") @Test public void customLabelNoBlock_NegativeVoteNotBlock() throws Exception { saveLabelConfig(LABEL.toBuilder().setFunction(NO_BLOCK)); @@ -106,6 +108,7 @@ public class CustomLabelIT extends AbstractDaemonTest { assertThat(q.blocking).isNull(); } + @SuppressWarnings("deprecation") @Test public void customLabelMaxNoBlock_NegativeVoteNotBlock() throws Exception { saveLabelConfig(LABEL.toBuilder().setFunction(MAX_NO_BLOCK)); @@ -121,6 +124,7 @@ public class CustomLabelIT extends AbstractDaemonTest { assertThat(q.blocking).isNull(); } + @SuppressWarnings("deprecation") @Test public void customLabelMaxNoBlock_MaxVoteSubmittable() throws Exception { saveLabelConfig(LABEL.toBuilder().setFunction(MAX_NO_BLOCK), P.toBuilder().setFunction(NO_OP)); @@ -139,6 +143,7 @@ public class CustomLabelIT extends AbstractDaemonTest { assertThat(q.blocking).isNull(); } + @SuppressWarnings("deprecation") @Test public void customLabelAnyWithBlock_NegativeVoteBlock() throws Exception { saveLabelConfig(LABEL.toBuilder().setFunction(ANY_WITH_BLOCK)); @@ -163,6 +168,7 @@ public class CustomLabelIT extends AbstractDaemonTest { } } + @SuppressWarnings("deprecation") @Test public void customLabelAnyWithBlock_Addreviewer_ZeroVote() throws Exception { TestListener testListener = new TestListener(); @@ -190,6 +196,7 @@ public class CustomLabelIT extends AbstractDaemonTest { } } + @SuppressWarnings("deprecation") @Test public void customLabelMaxWithBlock_NegativeVoteBlock() throws Exception { saveLabelConfig(LABEL.toBuilder().setFunction(MAX_WITH_BLOCK)); @@ -205,6 +212,7 @@ public class CustomLabelIT extends AbstractDaemonTest { assertThat(q.blocking).isTrue(); } + @SuppressWarnings("deprecation") @Test public void customLabelMaxWithBlock_DeletedVoteDoesNotTriggerNegativeBlock() throws Exception { saveLabelConfig(P.toBuilder().setFunction(MAX_WITH_BLOCK)); @@ -227,6 +235,7 @@ public class CustomLabelIT extends AbstractDaemonTest { assertThat(labelInfo.blocking).isNull(); // label is not blocking the change submission } + @SuppressWarnings("deprecation") @Test public void customLabelMaxWithBlock_MaxVoteSubmittable() throws Exception { saveLabelConfig( @@ -246,6 +255,7 @@ public class CustomLabelIT extends AbstractDaemonTest { assertThat(q.blocking).isNull(); } + @SuppressWarnings("deprecation") @Test public void customLabelMaxWithBlock_MaxVoteNegativeVoteBlock() throws Exception { saveLabelConfig(LABEL.toBuilder().setFunction(MAX_WITH_BLOCK)); @@ -262,6 +272,7 @@ public class CustomLabelIT extends AbstractDaemonTest { assertThat(q.blocking).isTrue(); } + @SuppressWarnings("deprecation") @Test public void customLabel_DisallowPostSubmit() throws Exception { saveLabelConfig( diff --git a/javatests/com/google/gerrit/server/project/SubmitRequirementsAdapterTest.java b/javatests/com/google/gerrit/server/project/SubmitRequirementsAdapterTest.java index b05f3c7170..180dd9285c 100644 --- a/javatests/com/google/gerrit/server/project/SubmitRequirementsAdapterTest.java +++ b/javatests/com/google/gerrit/server/project/SubmitRequirementsAdapterTest.java @@ -40,6 +40,7 @@ public class SubmitRequirementsAdapterTest { @Before public void setup() { + @SuppressWarnings("deprecation") LabelType codeReview = LabelType.builder( "Code-Review", @@ -50,6 +51,7 @@ public class SubmitRequirementsAdapterTest { .setFunction(LabelFunction.MAX_WITH_BLOCK) .build(); + @SuppressWarnings("deprecation") LabelType verified = LabelType.builder( "Verified", @@ -60,6 +62,7 @@ public class SubmitRequirementsAdapterTest { .setFunction(LabelFunction.MAX_NO_BLOCK) .build(); + @SuppressWarnings("deprecation") LabelType codeStyle = LabelType.builder( "Code-Style", @@ -70,6 +73,7 @@ public class SubmitRequirementsAdapterTest { .setFunction(LabelFunction.ANY_WITH_BLOCK) .build(); + @SuppressWarnings("deprecation") LabelType ignoreSelfApprovalLabel = LabelType.builder( "ISA-Label", |