From 4698c378b61044c6f279c04bce80b68357bb5063 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Thu, 25 Jan 2024 12:16:52 +0100 Subject: [PATCH] Eliminate SonarQube warnings --- .../components/impl/models/helpers/AbstractComponentImpl.java | 1 + .../impl/models/helpers/LanguageNavigationItemV1Impl.java | 2 ++ .../impl/models/helpers/LanguageNavigationItemV2Impl.java | 2 ++ .../components/impl/models/helpers/LinkListItemV1Impl.java | 4 ++-- .../components/impl/models/helpers/LinkListItemV2Impl.java | 2 +- .../components/impl/models/helpers/NavigationItemV1Impl.java | 4 +++- .../components/impl/models/helpers/NavigationItemV2Impl.java | 4 +++- .../components/impl/models/helpers/PageListItemV1Impl.java | 3 ++- .../components/impl/models/helpers/PageListItemV4Impl.java | 2 +- .../wcm/wcm/core/components/impl/models/v1/ButtonV1Impl.java | 4 ++-- .../core/components/impl/models/v1/LayoutContainerV1Impl.java | 2 +- .../wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java | 2 +- .../core/components/impl/models/v2/BreadcrumbV2ItemImpl.java | 1 + .../wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java | 2 +- .../wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java | 3 ++- .../wcm/wcm/core/components/impl/models/v2/TitleV2Impl.java | 2 +- .../core/components/impl/models/v3/BreadcrumbV3ItemImpl.java | 1 + .../wcm/wcm/core/components/impl/models/v3/TitleV3Impl.java | 2 +- .../core/components/impl/models/v1/NavigationV1ImplTest.java | 1 + .../core/components/impl/models/v2/NavigationV2ImplTest.java | 1 + 20 files changed, 30 insertions(+), 15 deletions(-) diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/AbstractComponentImpl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/AbstractComponentImpl.java index fee23ecd..74357bf9 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/AbstractComponentImpl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/AbstractComponentImpl.java @@ -29,6 +29,7 @@ /** * Abstract class that can be used as a base class for {@link Component} implementations. */ +@SuppressWarnings("java:S2176") // accept duplicate class name public abstract class AbstractComponentImpl extends com.adobe.cq.wcm.core.components.util.AbstractComponentImpl implements ComponentExporter { @Override diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV1Impl.java index 75133b03..d1d975ef 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV1Impl.java @@ -37,6 +37,7 @@ /** * {@link LanguageNavigationItem} implementation. */ +@SuppressWarnings("java:S110") // class hierarchy levels public class LanguageNavigationItemV1Impl extends NavigationItemV1Impl implements LanguageNavigationItem { private final Page page; @@ -56,6 +57,7 @@ public class LanguageNavigationItemV1Impl extends NavigationItemV1Impl implement * @param parentId Parent ID * @param parentComponent The component that contains this list item */ + @SuppressWarnings("java:S107") // number of parameters public LanguageNavigationItemV1Impl(@NotNull Page page, @NotNull Link link, int level, boolean active, boolean current, @NotNull List children, @Nullable String title, @Nullable String parentId, @Nullable Component parentComponent) { diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV2Impl.java index 05b2a8b5..729522f2 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV2Impl.java @@ -37,6 +37,7 @@ /** * {@link LanguageNavigationItem} implementation. */ +@SuppressWarnings("java:S110") // class hierarchy levels public class LanguageNavigationItemV2Impl extends NavigationItemV2Impl implements LanguageNavigationItem { private final Page page; @@ -56,6 +57,7 @@ public class LanguageNavigationItemV2Impl extends NavigationItemV2Impl implement * @param parentId Parent ID * @param parentComponent The component that contains this list item */ + @SuppressWarnings("java:S107") // number of parameters public LanguageNavigationItemV2Impl(@NotNull Page page, @NotNull Link link, int level, boolean active, boolean current, @NotNull List children, @Nullable String title, @Nullable String parentId, @Nullable Component parentComponent) { diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1Impl.java index 25c74afa..9d958e57 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1Impl.java @@ -58,7 +58,7 @@ public LinkListItemV1Impl(@NotNull String title, @NotNull LinkWrapper link, @Not /** * @deprecated Deprecated in API */ - @Deprecated + @Deprecated(forRemoval = true) @Override @JsonIgnore public com.adobe.cq.wcm.core.components.commons.link.Link getLink() { @@ -70,7 +70,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getLink() { * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore(false) public String getURL() { return super.getURL(); diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2Impl.java index 4c5ede18..1032df7a 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2Impl.java @@ -75,7 +75,7 @@ public LinkListItemV2Impl(@NotNull String title, @NotNull LinkWrapper link, @Not * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore public String getURL() { return link.getURL(); diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV1Impl.java index 46be7ac2..6940d4a2 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV1Impl.java @@ -34,6 +34,7 @@ /** * {@link NavigationItem} implementation. */ +@SuppressWarnings("java:S110") // class hierarchy levels public class NavigationItemV1Impl extends PageListItemV1Impl implements NavigationItem { private final Page page; @@ -52,6 +53,7 @@ public class NavigationItemV1Impl extends PageListItemV1Impl implements Navigati * @param parentId Parent ID * @param parentComponent The component that contains this list item */ + @SuppressWarnings("java:S107") // number of parameters public NavigationItemV1Impl(@NotNull Page page, @NotNull Link link, int level, boolean active, boolean current, @NotNull List children, @Nullable String parentId, @Nullable Component parentComponent) { @@ -67,7 +69,7 @@ public NavigationItemV1Impl(@NotNull Page page, @NotNull Link link, * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore public Page getPage() { return page; diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV2Impl.java index f4893bcb..fbb2c816 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV2Impl.java @@ -34,6 +34,7 @@ /** * {@link NavigationItem} implementation. */ +@SuppressWarnings("java:S110") // class hierarchy levels public class NavigationItemV2Impl extends PageListItemV2Impl implements NavigationItem { private final Page page; @@ -52,6 +53,7 @@ public class NavigationItemV2Impl extends PageListItemV2Impl implements Navigati * @param parentId Parent ID * @param parentComponent The component that contains this list item */ + @SuppressWarnings("java:S107") // number of parameters public NavigationItemV2Impl(@NotNull Page page, @NotNull Link link, int level, boolean active, boolean current, @NotNull List children, @Nullable String parentId, @Nullable Component parentComponent) { @@ -67,7 +69,7 @@ public NavigationItemV2Impl(@NotNull Page page, @NotNull Link link, * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore public Page getPage() { return page; diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV1Impl.java index 4d5a4427..71c937a3 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV1Impl.java @@ -33,6 +33,7 @@ /** * {@link ListItem} implementation for page links. */ +@SuppressWarnings("java:S110") // class hierarchy levels public class PageListItemV1Impl extends PageListItemV2Impl implements LinkMixin { /** @@ -63,7 +64,7 @@ public PageListItemV1Impl(@NotNull Page page, @NotNull Link link, * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore(false) public String getURL() { return super.getURL(); diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV4Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV4Impl.java index 5d0fd5b6..e0f59633 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV4Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV4Impl.java @@ -106,7 +106,7 @@ public PageListItemV4Impl(@NotNull Page page, @NotNull Link link, * @deprecated Deprecated in API */ @Override - @Deprecated(since = "1.9.0-2.17.2") + @Deprecated(forRemoval = true, since = "1.9.0-2.17.2") @JsonIgnore public String getURL() { return link.getURL(); diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/ButtonV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/ButtonV1Impl.java index c4e84c9d..627b1b15 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/ButtonV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/ButtonV1Impl.java @@ -58,7 +58,7 @@ public class ButtonV1Impl extends ButtonV2Impl implements LinkMixin { /** * @deprecated Deprecated in API */ - @Deprecated + @Deprecated(forRemoval = true) @Override @JsonIgnore public com.adobe.cq.wcm.core.components.commons.link.Link getButtonLink() { @@ -70,7 +70,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getButtonLink() { * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore(false) public String getLink() { return super.getLink(); diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/LayoutContainerV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/LayoutContainerV1Impl.java index b6a33bb8..a0cca294 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/LayoutContainerV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/LayoutContainerV1Impl.java @@ -74,7 +74,7 @@ public class LayoutContainerV1Impl extends AbstractContainerImpl implements Layo */ @Override @JsonIgnore - @Deprecated(since = "1.13.0-2.22.6") + @Deprecated(forRemoval = true, since = "1.13.0-2.22.6") public @NotNull List getItems() { return delegate.getItems(); } diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java index 7afbd93a..48cf5da5 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java @@ -70,7 +70,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getLink() { * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore(false) @JsonProperty("linkURL") public String getLinkURL() { diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/BreadcrumbV2ItemImpl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/BreadcrumbV2ItemImpl.java index 215d87b0..4b0a1ce8 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/BreadcrumbV2ItemImpl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/BreadcrumbV2ItemImpl.java @@ -40,6 +40,7 @@ @JsonIgnoreProperties({ "page", "children", "level", "description", "lastModified", PROPERTY_PATH }) +@SuppressWarnings("java:S110") // class hierarchy levels public class BreadcrumbV2ItemImpl extends NavigationItemV1Impl implements NavigationItem { /** diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java index 865a3e57..408335ae 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java @@ -93,7 +93,7 @@ public Link getButtonLink() { * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore public String getLink() { return link.getURL(); diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java index 8e967d68..e605f20c 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java @@ -104,6 +104,7 @@ public class TeaserV2Impl extends AbstractComponentImpl implements Teaser, Media private boolean titleLinkHidden; @PostConstruct + @SuppressWarnings({ "java:S3776", "java:S6541" }) // ignore complexity private void activate() { ValueMap properties = resource.getValueMap(); @@ -215,7 +216,7 @@ public Link getLink() { * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore public String getLinkURL() { return link.getURL(); diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TitleV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TitleV2Impl.java index c701d86c..2376b06c 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TitleV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TitleV2Impl.java @@ -67,7 +67,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getLink() { * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore(false) @JsonProperty("linkURL") public String getLinkURL() { diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/BreadcrumbV3ItemImpl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/BreadcrumbV3ItemImpl.java index eb4ff353..eaa99f9c 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/BreadcrumbV3ItemImpl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/BreadcrumbV3ItemImpl.java @@ -40,6 +40,7 @@ @JsonIgnoreProperties({ "page", "children", "level", "description", "lastModified", PROPERTY_PATH }) +@SuppressWarnings("java:S110") // class hierarchy levels public class BreadcrumbV3ItemImpl extends NavigationItemV2Impl implements NavigationItem { /** diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/TitleV3Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/TitleV3Impl.java index 527f6cc5..b4164a79 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/TitleV3Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/TitleV3Impl.java @@ -84,7 +84,7 @@ private void activate() { * @deprecated Deprecated in API */ @Override - @Deprecated + @Deprecated(forRemoval = true) @JsonIgnore public String getLinkURL() { return link.getURL(); diff --git a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/v1/NavigationV1ImplTest.java b/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/v1/NavigationV1ImplTest.java index bfe0b567..4ac49199 100644 --- a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/v1/NavigationV1ImplTest.java +++ b/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/v1/NavigationV1ImplTest.java @@ -54,6 +54,7 @@ import io.wcm.wcm.core.components.testcontext.AppAemContext; @ExtendWith(AemContextExtension.class) +@SuppressWarnings("java:S5976") // similar tests class NavigationV1ImplTest { private final AemContext context = AppAemContext.newAemContext(); diff --git a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/v2/NavigationV2ImplTest.java b/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/v2/NavigationV2ImplTest.java index 1a57a3ad..1a82b90b 100644 --- a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/v2/NavigationV2ImplTest.java +++ b/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/v2/NavigationV2ImplTest.java @@ -54,6 +54,7 @@ import io.wcm.wcm.core.components.testcontext.AppAemContext; @ExtendWith(AemContextExtension.class) +@SuppressWarnings("java:S5976") // similar tests class NavigationV2ImplTest { private final AemContext context = AppAemContext.newAemContext();