Added: Add annotations and modifiers

This commit is contained in:
agnostic-apollo
2022-01-22 04:46:24 +05:00
parent 1fb4fe2510
commit bf10c72661
8 changed files with 49 additions and 32 deletions

View File

@@ -4,6 +4,7 @@ import android.os.Build;
import android.system.Os;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.common.io.RecursiveDeleteOption;
import com.termux.shared.file.filesystem.FileType;
@@ -97,6 +98,7 @@ public class FileUtils {
* @param path The {@code path} to convert.
* @return Returns the {@code normalized path}.
*/
@Nullable
public static String normalizePath(String path) {
if (path == null) return null;
@@ -247,7 +249,7 @@ public class FileUtils {
}
/**
* Checks the type of file that exists at {@code filePath}.
* Get the type of file that exists at {@code filePath}.
*
* This function is a wrapper for
* {@link FileTypes#getFileType(String, boolean)}
@@ -260,6 +262,7 @@ public class FileUtils {
* returned.
* @return Returns the {@link FileType} of file.
*/
@NonNull
public static FileType getFileType(final String filePath, final boolean followLinks) {
return FileTypes.getFileType(filePath, followLinks);
}
@@ -1446,8 +1449,8 @@ public class FileUtils {
}
public static class ReadSerializableObjectResult {
public Error error;
public Serializable serializableObject;
public final Error error;
public final Serializable serializableObject;
ReadSerializableObjectResult(Error error, Serializable serializableObject) {
this.error = error;

View File

@@ -94,7 +94,7 @@ public class FileUtilsErrno extends Errno {
/** Defines the {@link Errno} mapping to get a shorter version of {@link FileUtilsErrno}. */
public static Map<Errno, Errno> ERRNO_SHORT_MAPPING = new HashMap<Errno, Errno>() {{
public static final Map<Errno, Errno> ERRNO_SHORT_MAPPING = new HashMap<Errno, Errno>() {{
put(ERRNO_FILE_NOT_FOUND_AT_PATH, ERRNO_FILE_NOT_FOUND_AT_PATH_SHORT);
put(ERRNO_NON_REGULAR_FILE_FOUND, ERRNO_NON_REGULAR_FILE_FOUND_SHORT);

View File

@@ -82,6 +82,7 @@ public class FileTypes {
* returned.
* @return Returns the {@link FileType} of file.
*/
@NonNull
public static FileType getFileType(final String filePath, final boolean followLinks) {
if (filePath == null || filePath.isEmpty()) return FileType.NO_EXIST;