Skip to content

Conversation

valfirst
Copy link
Collaborator

Change list

Fix the build: fix: add explicit dependency on JSR 305 annotations library.

Types of changes

What types of changes are you proposing/introducing to Java client?

  • No changes in production code.
  • Bugfix (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 not work as expected)

Details

The annotations javax.annotation.Nonnull and javax.annotation.Nullable used in the codebase came from library com.google.code.findbugs:jsr305. This library was a dependency of com.google.guava:guava, which in its turn is a depedendency of Selenium. But jsr305 dependency was removed in Guava 33.4.3 (google/guava#2960), and Guava was bumped from 33.4.0 to 33.4.5 in Selenium (SeleniumHQ/selenium@ced5b22). As the result com.google.code.findbugs:jsr305 is not present in classpath anymore and lead to build failures: https://github.com/appium/java-client/actions/runs/14034948997/job/39290753396?pr=2279

/Users/runner/work/java-client/java-client/src/main/java/io/appium/java_client/MobileCommand.java:27: error: package javax.annotation does not exist

import javax.annotation.Nullable;
> Task :compileJava
                       ^
/Users/runner/work/java-client/java-client/src/main/java/io/appium/java_client/ExecutesDriverScript.java:23: error: package javax.annotation does not exist
import javax.annotation.Nullable;
                       ^
/Users/runner/work/java-client/java-client/src/main/java/io/appium/java_client/AppiumClientConfig.java:26: error: package javax.annotation does not exist
import javax.annotation.Nullable;
...

Short-term solution is to add JSR 305 dependency explicitly.
Long-term solution can be migration to JSpecify.

@asolntsev
Copy link
Contributor

asolntsev commented Mar 26, 2025

Just for information, the recommended fix would be replacing annotations like javax.annotation.Nonnull by org.jspecify.annotations.NonNull.
Or even better: by marking the whole package with org.jspecify.annotations.NullMarked annotation.

See for example: https://github.com/selenide/selenide/pull/2889/files

@valfirst

@valfirst
Copy link
Collaborator Author

@asolntsev thank you for the hint, let's eat the elephant one bite at a time: I'll merge this PR, because builds are failed, the next PR will replace JSR 305 annotations with JSpecify annotations

@valfirst valfirst merged commit febcffb into appium:master Mar 27, 2025
7 checks passed
@valfirst valfirst deleted the fix-add-explicit-dependency-on-jsr-305-annotations-library branch March 27, 2025 08:16
@KazuCocoa KazuCocoa added the size:XS contribution size: XS label Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS contribution size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants