Skip to content

Commit 6911765

Browse files
committed
[java] JSpecify annotations for FileDetector
1 parent b3b23f5 commit 6911765

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

java/src/org/openqa/selenium/remote/FileDetector.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
package org.openqa.selenium.remote;
1919

2020
import java.io.File;
21+
import org.jspecify.annotations.NullMarked;
22+
import org.jspecify.annotations.Nullable;
2123

2224
/** Used for identifying whether a sequence of chars represents the path to a file. */
25+
@NullMarked
2326
public interface FileDetector {
24-
File getLocalFile(CharSequence... keys);
27+
@Nullable File getLocalFile(CharSequence... keys);
2528
}

java/src/org/openqa/selenium/remote/LocalFileDetector.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@
1919

2020
import java.io.File;
2121
import java.util.logging.Logger;
22+
import org.jspecify.annotations.NullMarked;
23+
import org.jspecify.annotations.Nullable;
2224

2325
/** Detects files on the local disk. */
26+
@NullMarked
2427
public class LocalFileDetector implements FileDetector {
2528

2629
private static final Logger LOG = Logger.getLogger(LocalFileDetector.class.getName());
2730

2831
@Override
29-
public File getLocalFile(CharSequence... keys) {
32+
public @Nullable File getLocalFile(CharSequence... keys) {
3033
StringBuilder builder = new StringBuilder();
3134
for (CharSequence chars : keys) {
3235
builder.append(chars);

java/src/org/openqa/selenium/remote/UselessFileDetector.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
package org.openqa.selenium.remote;
1919

2020
import java.io.File;
21+
import org.jspecify.annotations.NullMarked;
22+
import org.jspecify.annotations.Nullable;
2123

2224
/** A file detector that never finds anything. */
25+
@NullMarked
2326
public class UselessFileDetector implements FileDetector {
2427
@Override
25-
public File getLocalFile(CharSequence... keys) {
28+
public @Nullable File getLocalFile(CharSequence... keys) {
2629
return null;
2730
}
2831
}

0 commit comments

Comments
 (0)