Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] SpotBugs exclude NM_SAME_SIMPLE_NAME_AS_SUPERCLASS #14590

Conversation

mk868
Copy link
Contributor

@mk868 mk868 commented Oct 11, 2024

User description

Description

As described in this comment, SpotBugs found some additional bugs in the code.
In this PR I fix part of the found problems.

SpotBugs errors:

H B Nm: The class name org.openqa.selenium.chrome.AddHasCasting shadows the simple name of the superclass org.openqa.selenium.chromium.AddHasCasting  At AddHasCasting.java:[lines 33-54]
H B Nm: The class name org.openqa.selenium.chrome.AddHasCdp shadows the simple name of the superclass org.openqa.selenium.chromium.AddHasCdp  At AddHasCdp.java:[lines 33-43]
H B Nm: The class name org.openqa.selenium.edge.AddHasCdp shadows the simple name of the superclass org.openqa.selenium.chromium.AddHasCdp  At AddHasCdp.java:[lines 33-45]
H B Nm: The class name org.openqa.selenium.edge.AddHasCasting shadows the simple name of the superclass org.openqa.selenium.chromium.AddHasCasting  At AddHasCasting.java:[lines 33-54]

documentation

Solution:
Exclude these classes from SpotBugs checks, as it is already done for org.openqa.selenium.remote.internal.WebElementToJsonConverter and org.openqa.selenium.remote.WebElementToJsonConverter classes.

Motivation and Context

Fixing the actual problems is necessary before enabling full SpotBugs analysis, in order to not break the build.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

bug_fix


Description

  • Added exclusions in spotbugs-excludes.xml for the NM_SAME_SIMPLE_NAME_AS_SUPERCLASS bug pattern.
  • Excluded the following classes from SpotBugs checks to prevent build issues:
    • org.openqa.selenium.chrome.AddHasCasting
    • org.openqa.selenium.chrome.AddHasCdp
    • org.openqa.selenium.edge.AddHasCdp
    • org.openqa.selenium.edge.AddHasCasting
  • These changes are necessary to fix issues identified by SpotBugs and ensure a successful build.

Changes walkthrough 📝

Relevant files
Bug fix
spotbugs-excludes.xml
Exclude specific classes from SpotBugs
NM_SAME_SIMPLE_NAME_AS_SUPERCLASS check

java/spotbugs-excludes.xml

  • Added exclusion for NM_SAME_SIMPLE_NAME_AS_SUPERCLASS bug pattern for
    several classes.
  • Excluded org.openqa.selenium.chrome.AddHasCasting from SpotBugs
    checks.
  • Excluded org.openqa.selenium.chrome.AddHasCdp from SpotBugs checks.
  • Excluded org.openqa.selenium.edge.AddHasCdp and
    org.openqa.selenium.edge.AddHasCasting from SpotBugs checks.
  • +20/-0   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No major issues detected

    Copy link
    Contributor

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @pujagani pujagani merged commit e9da405 into SeleniumHQ:trunk Oct 14, 2024
    9 of 11 checks passed
    @mk868 mk868 deleted the spotbugs_exclude_NM_SAME_SIMPLE_NAME_AS_SUPERCLASS branch October 14, 2024 15:38
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants