Deprecate the StableAPI annotations, switch to JB annotations

This commit is contained in:
FalsePattern committed 2025-05-26 09:45:57 +02:00
1 parent 8645d20a16
commit df1f294776
96 files changed
+1079 -762

No files matched your search

@@ -21,18 +21,15 @@
*/
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
import lombok.NonNull;
import lombok.val;
import java.util.Arrays;
import java.util.stream.Collectors;
@StableAPI(since = "0.6.0")
public class ComplexVersion extends Version {
final Version[] versions;
@StableAPI.Expose
public ComplexVersion(@NonNull Version mainVersion, Version... subVersions) {
this.versions = new Version[subVersions.length + 1];
this.versions[0] = mainVersion;
@@ -21,7 +21,6 @@
*/
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.internal.impl.dependencies.DependencyLoaderImpl;
import java.util.concurrent.CompletableFuture;
@@ -31,19 +30,21 @@ import java.util.concurrent.CompletableFuture;
* For regular external dependencies, see the DEPENDENCIES.MD files in the root of the resources for more information.
* If you need more power than the one provided by the json format, you may use this class for granular loading instead.
*/
@StableAPI(since = "0.6.0")
public class DependencyLoader {
@StableAPI.Expose
public static void addMavenRepo(String url) {
DependencyLoaderImpl.addMavenRepo(url);
}
@StableAPI.Expose(since = "0.10.0")
/**
* @since 0.10.0
*/
public static CompletableFuture<Void> loadLibrariesAsync(Library... libraries) {
return DependencyLoaderImpl.loadLibrariesAsync(libraries);
}
@StableAPI.Expose(since = "0.10.0")
/**
* @since 0.10.0
*/
public static void loadLibraries(Library... libraries) {
DependencyLoaderImpl.loadLibraries(libraries);
}
@@ -22,34 +22,31 @@
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
import lombok.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
@StableAPI(since = "0.10.0")
/**
* @since 0.10.0
*/
public class Library {
@StableAPI.Expose
@NonNull
public final String loadingModId;
@StableAPI.Expose
@NonNull
public final String groupId;
@StableAPI.Expose
@NonNull
public final String artifactId;
@StableAPI.Expose
@NonNull
public final Version minVersion;
@StableAPI.Expose
@Nullable
public final Version maxVersion;
@StableAPI.Expose
@NonNull
public final Version preferredVersion;
@StableAPI.Expose
@Nullable
public final String regularSuffix;
@StableAPI.Expose
@Nullable
public final String devSuffix;
@StableAPI.Expose
public Library(@NonNull String loadingModId, @NonNull String groupId, @NonNull String artifactId, @NonNull Version minVersion, Version maxVersion, @NonNull Version preferredVersion, String regularSuffix, String devSuffix) {
this.loadingModId = loadingModId;
this.groupId = groupId;
@@ -61,12 +58,13 @@ public class Library {
this.devSuffix = devSuffix;
}
@StableAPI.Expose
public static LibraryBuilder builder() {
return new LibraryBuilder();
}
@StableAPI(since = "0.10.0")
/**
* @since 0.10.0
*/
public static class LibraryBuilder {
private String loadingModId;
private String groupId;
@@ -77,59 +75,50 @@ public class Library {
private String regularSuffix;
private String devSuffix;
@StableAPI.Internal
@ApiStatus.Internal
LibraryBuilder() {
}
@StableAPI.Expose
public LibraryBuilder loadingModId(@NonNull String loadingModId) {
this.loadingModId = loadingModId;
return this;
}
@StableAPI.Expose
public LibraryBuilder groupId(@NonNull String groupId) {
this.groupId = groupId;
return this;
}
@StableAPI.Expose
public LibraryBuilder artifactId(@NonNull String artifactId) {
this.artifactId = artifactId;
return this;
}
@StableAPI.Expose
public LibraryBuilder minVersion(@NonNull Version minVersion) {
this.minVersion = minVersion;
return this;
}
@StableAPI.Expose
public LibraryBuilder maxVersion(Version maxVersion) {
this.maxVersion = maxVersion;
return this;
}
@StableAPI.Expose
public LibraryBuilder preferredVersion(@NonNull Version preferredVersion) {
this.preferredVersion = preferredVersion;
return this;
}
@StableAPI.Expose
public LibraryBuilder regularSuffix(String regularSuffix) {
this.regularSuffix = regularSuffix;
return this;
}
@StableAPI.Expose
public LibraryBuilder devSuffix(String devSuffix) {
this.devSuffix = devSuffix;
return this;
}
@StableAPI.Expose
public Library build() {
return new Library(loadingModId,
groupId,
@@ -21,27 +21,25 @@
*/
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
import lombok.Getter;
import lombok.NonNull;
import lombok.val;
import org.jetbrains.annotations.ApiStatus;
import java.util.Objects;
@StableAPI(since = "0.6.0")
public class SemanticVersion extends Version {
@Getter(onMethod_ = @StableAPI.Expose)
@Getter
private final int majorVersion;
@Getter(onMethod_ = @StableAPI.Expose)
@Getter
private final int minorVersion;
@Getter(onMethod_ = @StableAPI.Expose)
@Getter
private final int patchVersion;
@Getter(onMethod_ = @StableAPI.Expose)
@Getter
private final String preRelease;
@Getter(onMethod_ = @StableAPI.Expose)
@Getter
private final String build;
@StableAPI.Expose
public SemanticVersion(int majorVersion, int minorVersion, int patchVersion, String preRelease, String build) {
this.majorVersion = majorVersion;
this.minorVersion = minorVersion;
@@ -52,27 +50,29 @@ public class SemanticVersion extends Version {
this.build = "".equals(build) ? null : build;
}
@StableAPI.Expose
public SemanticVersion(int majorVersion, int minorVersion, int patchVersion, String preRelease) {
this(majorVersion, minorVersion, patchVersion, preRelease, null);
}
@StableAPI.Expose
public SemanticVersion(int majorVersion, int minorVersion, int patchVersion) {
this(majorVersion, minorVersion, patchVersion, null, null);
}
@StableAPI.Expose(since = "0.10.0")
/**
* @since 0.10.0
*/
public SemanticVersion(int majorVersion, int minorVersion) {
this(majorVersion, minorVersion, -1, null, null);
}
@StableAPI.Expose(since = "0.10.0")
/**
* @since 0.10.0
*/
public SemanticVersion(int majorVersion) {
this(majorVersion, -1, -1, null, null);
}
@StableAPI.Expose
public static SemanticVersionBuilder builder() {
return new SemanticVersionBuilder();
}
@@ -119,7 +119,9 @@ public class SemanticVersion extends Version {
// @formatter:on
}
@StableAPI(since = "0.10.0")
/**
* @since 0.10.0
*/
public static class SemanticVersionBuilder {
private int majorVersion;
private int minorVersion = -1;
@@ -127,41 +129,35 @@ public class SemanticVersion extends Version {
private String preRelease;
private String build;
@StableAPI.Internal
@ApiStatus.Internal
SemanticVersionBuilder() {
}
@StableAPI.Expose
public SemanticVersionBuilder majorVersion(int majorVersion) {
this.majorVersion = majorVersion;
return this;
}
@StableAPI.Expose
public SemanticVersionBuilder minorVersion(int minorVersion) {
this.minorVersion = minorVersion;
return this;
}
@StableAPI.Expose
public SemanticVersionBuilder patchVersion(int patchVersion) {
this.patchVersion = patchVersion;
return this;
}
@StableAPI.Expose
public SemanticVersionBuilder preRelease(String preRelease) {
this.preRelease = preRelease;
return this;
}
@StableAPI.Expose
public SemanticVersionBuilder build(String build) {
this.build = build;
return this;
}
@StableAPI.Expose
public SemanticVersion build() {
return new SemanticVersion(majorVersion, minorVersion, patchVersion, preRelease, build);
}
@@ -21,9 +21,6 @@
*/
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
@StableAPI(since = "0.6.0")
public abstract class Version implements Comparable<Version> {
protected Version() {
}
@@ -36,7 +33,6 @@ public abstract class Version implements Comparable<Version> {
return equals((Version) obj);
}
@StableAPI.Expose
public boolean equals(Version other) {
return compareTo(other) == 0;
}
@@ -0,0 +1,26 @@
/*
* This file is part of FalsePatternLib.
*
* Copyright (C) 2022-2025 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* FalsePatternLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, only version 3 of the License.
*
* FalsePatternLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FalsePatternLib. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @since 0.6.0
*/
package com.falsepattern.lib.dependencies;