Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
<version>2.4.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
<version>1.0.0</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
Expand All @@ -90,12 +95,6 @@
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/apache/maven/shared/utils/PathTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/
package org.apache.maven.shared.utils;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import java.io.File;
import java.util.StringTokenizer;

import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

/**
* <p>Path tool contains static methods to assist in determining path-related
* information such as relative paths.</p>
Expand Down Expand Up @@ -198,8 +198,8 @@ public static String getRelativeFilePath(final String oldPath, final String newP
* terminated with a forward slash. A zero-length string is
* returned if: the filename is zero-length.
*/
@Nonnull
private static String determineRelativePath(@Nonnull String filename, @Nonnull String separator) {
@NonNull
private static String determineRelativePath(@NonNull String filename, @NonNull String separator) {
if (filename.length() == 0) {
return "";
}
Expand Down Expand Up @@ -264,9 +264,9 @@ static String uppercaseDrive(@Nullable String path) {
return path;
}

@Nonnull
@NonNull
private static String buildRelativePath(
@Nonnull String toPath, @Nonnull String fromPath, final char separatorChar) {
@NonNull String toPath, @NonNull String fromPath, final char separatorChar) {
// use tokeniser to traverse paths and for lazy checking
StringTokenizer toTokeniser = new StringTokenizer(toPath, String.valueOf(separatorChar));
StringTokenizer fromTokeniser = new StringTokenizer(fromPath, String.valueOf(separatorChar));
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/apache/maven/shared/utils/PropertyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
*/
package org.apache.maven.shared.utils;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Properties;

import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

/**
* Static utility methods for loading properties.
*/
Expand All @@ -49,7 +49,7 @@ public PropertyUtils() {}
* instead of an empty {@code Properties} instance when the given {@code URL} is {@code null}.
*/
@Deprecated
public static java.util.Properties loadProperties(@Nonnull URL url) {
public static java.util.Properties loadProperties(@NonNull URL url) {
try (InputStream in = url.openStream()) {
return loadProperties(in);
} catch (Exception e) {
Expand All @@ -66,7 +66,7 @@ public static java.util.Properties loadProperties(@Nonnull URL url) {
* instead of an empty {@code Properties} instance when the given {@code File} is {@code null}.
*/
@Deprecated
public static Properties loadProperties(@Nonnull File file) {
public static Properties loadProperties(@NonNull File file) {
try (InputStream in = new FileInputStream(file)) {
return loadProperties(in);
} catch (Exception e) {
Expand Down Expand Up @@ -113,7 +113,7 @@ public static Properties loadProperties(@Nullable InputStream is) {
* @return the loaded properties or an empty {@code Properties} instance if properties fail to load
* @since 3.1.0
*/
@Nonnull
@NonNull
public static Properties loadOptionalProperties(final @Nullable URL url) {

Properties properties = new Properties();
Expand All @@ -138,7 +138,7 @@ public static Properties loadOptionalProperties(final @Nullable URL url) {
* @return the loaded properties or an empty {@code Properties} instance if properties fail to load
* @since 3.1.0
*/
@Nonnull
@NonNull
public static Properties loadOptionalProperties(final @Nullable File file) {
Properties properties = new Properties();
if (file != null) {
Expand All @@ -162,7 +162,7 @@ public static Properties loadOptionalProperties(final @Nullable File file) {
* @return the loaded properties or an empty {@code Properties} instance if properties fail to load
* @since 3.1.0
*/
@Nonnull
@NonNull
public static Properties loadOptionalProperties(final @Nullable InputStream inputStream) {

Properties properties = new Properties();
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/org/apache/maven/shared/utils/ReaderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package org.apache.maven.shared.utils;

import javax.annotation.Nonnull;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand All @@ -33,6 +31,7 @@
import java.nio.charset.Charset;

import org.apache.commons.io.input.XmlStreamReader;
import org.jspecify.annotations.NonNull;

/**
* Utility to create Readers from streams, with explicit encoding choice: platform default,
Expand Down Expand Up @@ -115,7 +114,7 @@ public class ReaderFactory {
* @deprecated use {@code org.apache.commons.io.input.XmlStreamReader} instead
*/
@Deprecated
public static Reader newXmlReader(@Nonnull InputStream in) throws IOException {
public static Reader newXmlReader(@NonNull InputStream in) throws IOException {
return new XmlStreamReader(in);
}

Expand All @@ -128,7 +127,7 @@ public static Reader newXmlReader(@Nonnull InputStream in) throws IOException {
* @deprecated use {}@code org.apache.commons.io.input.XmlStreamReader} instead
*/
@Deprecated
public static Reader newXmlReader(@Nonnull File file) throws IOException {
public static Reader newXmlReader(@NonNull File file) throws IOException {
return new XmlStreamReader(file);
}

Expand All @@ -141,7 +140,7 @@ public static Reader newXmlReader(@Nonnull File file) throws IOException {
* @deprecated use {@code org.apache.commons.io.input.XmlStreamReader} instead
*/
@Deprecated
public static Reader newXmlReader(@Nonnull URL url) throws IOException {
public static Reader newXmlReader(@NonNull URL url) throws IOException {
return new XmlStreamReader(url);
}

Expand All @@ -155,7 +154,7 @@ public static Reader newXmlReader(@Nonnull URL url) throws IOException {
* @deprecated always specify an encoding. Do not depend on the default platform character set.
*/
@Deprecated
public static Reader newPlatformReader(@Nonnull File file) throws FileNotFoundException {
public static Reader newPlatformReader(@NonNull File file) throws FileNotFoundException {
return new FileReader(file);
}

Expand All @@ -172,7 +171,7 @@ public static Reader newPlatformReader(@Nonnull File file) throws FileNotFoundEx
* @deprecated use {@code new InputStreamReader(in, encoding)} instead
*/
@Deprecated
public static Reader newReader(@Nonnull InputStream in, @Nonnull String encoding)
public static Reader newReader(@NonNull InputStream in, @NonNull String encoding)
throws UnsupportedEncodingException {
return new InputStreamReader(in, encoding);
}
Expand All @@ -192,7 +191,7 @@ public static Reader newReader(@Nonnull InputStream in, @Nonnull String encoding
* or {@code new Files.newBufferedReader} instead
*/
@Deprecated
public static Reader newReader(@Nonnull File file, @Nonnull String encoding)
public static Reader newReader(@NonNull File file, @NonNull String encoding)
throws FileNotFoundException, UnsupportedEncodingException {
return new InputStreamReader(new FileInputStream(file), encoding);
}
Expand All @@ -211,7 +210,7 @@ public static Reader newReader(@Nonnull File file, @Nonnull String encoding)
* @deprecated This method does not use HTTP headers to detect the resource's encoding.
*/
@Deprecated
public static Reader newReader(@Nonnull URL url, @Nonnull String encoding) throws IOException {
public static Reader newReader(@NonNull URL url, @NonNull String encoding) throws IOException {
return new InputStreamReader(url.openStream(), encoding);
}
}
Loading