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; return originalJar;
} }
@NotNull public @NotNull Path getDataDirectory() {
public Path getDataDirectory() {
return dataDirectory; return dataDirectory;
} }

View File

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

View File

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