You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a summary of compliance checks for this PR:
Security Compliance
⚪
Null return contract
Description: Returning null from a method annotated @nullable without clear documentation may still lead to NPEs if callers ignore the annotation; verify downstream usage and null checks. UselessFileDetector.java [26-27]
import java.io.File;
+import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
/** A file detector that never finds anything. */
+@NullMarked
public class UselessFileDetector implements FileDetector {
@Override
public @Nullable File getLocalFile(CharSequence... keys) {
return null;
}
}
Apply / Chat
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly identifies that the @NullMarked annotation is missing on the UselessFileDetector class, which is inconsistent with the implemented interface and another implementation in the PR, thus improving code consistency.
Low
Learned best practice
Guard against null inputs
Add defensive null checks for keys and its elements to avoid potential NPEs when appending to the StringBuilder.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
🔗 Related Issues
Related #14291
💥 What does this PR do?
JSpecify annotations added to the:
org.openqa.selenium.remote.FileDetectororg.openqa.selenium.remote.LocalFileDetectororg.openqa.selenium.remote.UselessFileDetector🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement, Documentation
Description
Add JSpecify null-safety annotations to FileDetector interface
Annotate LocalFileDetector and UselessFileDetector implementations
Mark getLocalFile() return type as @nullable
Apply @NullMarked to interface and implementations for consistency
Diagram Walkthrough
File Walkthrough
FileDetector.java
Add JSpecify annotations to FileDetector interfacejava/src/org/openqa/selenium/remote/FileDetector.java
@NullMarkedand@Nullable)@NullMarkedclass-level annotation to interfacegetLocalFile()return type with@NullableLocalFileDetector.java
Add JSpecify annotations to LocalFileDetectorjava/src/org/openqa/selenium/remote/LocalFileDetector.java
@NullMarkedand@Nullable)@NullMarkedclass-level annotationgetLocalFile()return type with@NullableUselessFileDetector.java
Add JSpecify null-safety annotation to UselessFileDetectorjava/src/org/openqa/selenium/remote/UselessFileDetector.java
@NullableannotationgetLocalFile()return type with@Nullable