Skip to content

Conversation

@titusfortner
Copy link
Member

@titusfortner titusfortner commented Jan 5, 2026

User description

We periodically ask people not to commit code with wildcard imports

💥 What does this PR do?

  • Fixes wildcard imports
  • Adds Lint Job to CI

🔧 Implementation Notes

Could have created a separate bazel job, but a lint profile seems like the easiest

💡 Additional Considerations

What other linting things do we want to enforce here?

🔄 Types of changes

  • Cleanup (formatting, renaming)

PR Type

Enhancement, Tests


Description

  • Replace wildcard imports with explicit imports across Java codebase

  • Add lint job to CI pipeline enforcing no wildcard imports

  • Update Bazel configuration with lint profile for ErrorProne checks

  • Fix missing dependency in javadoc BUILD configuration


Diagram Walkthrough

flowchart LR
  A["Wildcard Imports<br/>in Java Files"] -->|"Replace with<br/>Explicit Imports"| B["Clean Import<br/>Statements"]
  C["Bazel Config"] -->|"Add lint<br/>Profile"| D["ErrorProne<br/>WildcardImport Check"]
  E["CI Workflow"] -->|"Add lint<br/>Job"| F["Automated<br/>Linting"]
  D --> F
  B --> F
Loading

File Walkthrough

Relevant files
Cleanup
38 files
Script.java
Replace wildcard script imports with explicit imports       
+13/-1   
v141Network.java
Replace wildcard util and fetch model imports                       
+12/-2   
v142Network.java
Replace wildcard util and fetch model imports                       
+12/-2   
v143Network.java
Replace wildcard util and fetch model imports                       
+12/-2   
FirefoxOptions.java
Replace wildcard java.util imports with explicit ones       
+8/-1     
TomlConfig.java
Replace wildcard tomlj imports with explicit imports         
+5/-1     
Multimap.java
Replace wildcard java.util imports with explicit ones       
+5/-1     
CorrectEventFiringTest.java
Replace wildcard static imports with explicit ones             
+9/-3     
I18nTest.java
Replace wildcard Browser imports with explicit ones           
+4/-1     
PageLoadTimeOutTest.java
Replace wildcard Browser imports with explicit ones           
+3/-1     
SessionHandlingTest.java
Replace wildcard Assertions imports with explicit ones     
+3/-1     
WaitingConditionsTest.java
Replace wildcard WaitingConditions imports with explicit ones
+3/-1     
WebScriptTest.java
Replace wildcard Assertions and concurrent imports             
+6/-2     
CombinedInputActionsTest.java
Replace wildcard static imports with explicit ones             
+9/-3     
DefaultMouseTest.java
Replace wildcard ExpectedConditions and selenium imports 
+10/-2   
DefaultWheelTest.java
Replace wildcard Browser imports with explicit ones           
+3/-1     
DragAndDropTest.java
Replace wildcard WaitingConditions imports with explicit ones
+3/-1     
StorageCommandsTest.java
Replace wildcard Browser imports with explicit ones           
+2/-1     
DistributorDrainingTest.java
Replace wildcard grid data imports with explicit ones       
+5/-1     
SessionSchedulingTest.java
Replace wildcard grid data imports with explicit ones       
+5/-1     
DistributedTest.java
Replace wildcard remote http imports with explicit ones   
+7/-1     
EndToEndTest.java
Replace wildcard remote http imports with explicit ones   
+5/-1     
JmxTest.java
Replace wildcard javax.management imports with explicit ones
+7/-1     
RemoteWebDriverDownloadTest.java
Replace wildcard selenium imports with explicit ones         
+6/-1     
RouterTest.java
Replace wildcard grid data imports with explicit ones       
+6/-1     
SessionQueueGridTest.java
Replace wildcard concurrent imports with explicit ones     
+5/-1     
JdbcBackedSessionMapTest.java
Replace wildcard Assertions imports with explicit ones     
+2/-1     
RedisBackedSessionMapTest.java
Replace wildcard Assertions imports with explicit ones     
+2/-1     
InternetExplorerDriverTest.java
Replace wildcard java.awt imports with explicit ones         
+1/-1     
CombinedInputActionsTest.java
Replace wildcard static imports with explicit ones             
+6/-2     
DefaultMouseTest.java
Replace wildcard ExpectedConditions imports with explicit ones
+3/-1     
DragAndDropTest.java
Replace wildcard WaitingConditions and ExpectedConditions imports
+4/-2     
PenPointerTest.java
Replace wildcard ExpectedConditions imports with explicit ones
+3/-1     
SetsTest.java
Replace wildcard Sets imports with explicit ones                 
+6/-1     
SafariDriverTest.java
Replace wildcard Assertions imports with explicit ones     
+3/-1     
EventFiringDecoratorTest.java
Replace wildcard Assertions imports with explicit ones     
+3/-1     
ByAllTest.java
Replace wildcard Mockito imports with explicit ones           
+6/-1     
IgnoreComparatorUnitTest.java
Replace wildcard Browser imports with explicit ones           
+3/-1     
Configuration changes
2 files
.bazelrc
Add lint profile with WildcardImport error check                 
+2/-0     
ci-java.yml
Add lint job to CI pipeline workflow                                         
+7/-0     
Dependencies
1 files
BUILD.bazel
Add missing core-module dependency to javadoc                       
+1/-0     

@selenium-ci selenium-ci added B-grid Everything grid and server related C-java Java Bindings B-build Includes scripting, bazel and CI integrations B-devtools Includes everything BiDi or Chrome DevTools related B-support Issue or PR related to support classes labels Jan 5, 2026
@selenium-ci
Copy link
Member

Thank you, @titusfortner for this code suggestion.

The support packages contain example code that many users find helpful, but they do not necessarily represent
the best practices for using Selenium, and the Selenium team is not currently merging changes to them.

After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium
to work, we will likely close the PR.

We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks.
If you have any questions, please contact us

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Jan 5, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Jan 5, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Add lint as prerequisite

Add needs: lint to the browser-tests-windows job to make it dependent on the
successful completion of the lint job.

.github/workflows/ci-java.yml [18-21]

 jobs:
   browser-tests-windows:
+    needs: lint
     name: Browser Tests
     uses: ./.github/workflows/bazel.yml
     strategy: …

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: This is a good practice that improves CI efficiency by preventing expensive tests from running if the linting job fails, providing faster feedback.

Medium
  • Update

@titusfortner titusfortner merged commit 3a09410 into trunk Jan 5, 2026
21 checks passed
@titusfortner titusfortner deleted the java_lint branch January 5, 2026 19:36
@asolntsev asolntsev added this to the 4.40.0 milestone Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations B-devtools Includes everything BiDi or Chrome DevTools related B-grid Everything grid and server related B-support Issue or PR related to support classes C-java Java Bindings Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants