Inline nullable and nonnull annotations

This commit is contained in:
Matt Worzala 2021-05-21 08:56:30 -04:00
parent 51409705e1
commit a749f07a3f
No known key found for this signature in database
GPG Key ID: 439DBBE092854841
3 changed files with 7 additions and 13 deletions

View File

@ -133,8 +133,7 @@ public final class DiscoveredExtension {
return originalJar;
}
@NotNull
public Path getDataDirectory() {
public @NotNull Path getDataDirectory() {
return dataDirectory;
}

View File

@ -85,8 +85,7 @@ public abstract class Extension {
return logger;
}
@NotNull
public Path getDataDirectory() {
public @NotNull Path getDataDirectory() {
return getOrigin().getDataDirectory();
}
@ -101,8 +100,7 @@ public abstract class Extension {
* @param fileName The file to read
* @return The file contents, or null if there was an issue reading the file.
*/
@Nullable
public InputStream getResource(@NotNull String fileName) {
public @Nullable InputStream getResource(@NotNull String fileName) {
return getResource(Paths.get(fileName));
}
@ -117,8 +115,7 @@ public abstract class Extension {
* @param target The file to read
* @return The file contents, or null if there was an issue reading the file.
*/
@Nullable
public InputStream getResource(@NotNull Path target) {
public @Nullable InputStream getResource(@NotNull Path target) {
final Path targetFile = getDataDirectory().resolve(target);
try {
// Copy from jar if the file does not exist in the extension data directory.
@ -141,7 +138,7 @@ public abstract class Extension {
* @param fileName The file to read
* @return The file contents, or null if there was an issue reading the file.
*/
public InputStream getPackagedResource(@NotNull String fileName) {
public @Nullable InputStream getPackagedResource(@NotNull String fileName) {
return getPackagedResource(Paths.get(fileName));
}
@ -153,8 +150,7 @@ public abstract class Extension {
* @param target The file to read
* @return The file contents, or null if there was an issue reading the file.
*/
@Nullable
public InputStream getPackagedResource(@NotNull Path target) {
public @Nullable InputStream getPackagedResource(@NotNull Path target) {
try {
final URL url = getOrigin().getMinestomExtensionClassLoader().getResource(target.toString());
if (url == null) {

View File

@ -574,8 +574,7 @@ public class ExtensionManager {
return extensionFolder;
}
@NotNull
public Path getExtensionDataRoot() {
public @NotNull Path getExtensionDataRoot() {
return extensionDataRoot;
}