Skip to content

Commit 1ea9484

Browse files
committed
fix: Add missing @deprecated and @since to javadoc
Add some missing javadoc. Fix some method visibility issues and remove use of deprecated methods from code.
1 parent 8925c06 commit 1ea9484

File tree

5 files changed

+256
-11
lines changed

5 files changed

+256
-11
lines changed

src/main/java/com/github/packageurl/PackageURL.java

Lines changed: 194 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ public PackageURL(final String type, final @Nullable String namespace, final Str
132132

133133
/**
134134
* The PackageURL scheme constant
135+
*
136+
* @since 1.6.0
135137
*/
136138
public static final String SCHEME = "pkg";
137139

@@ -180,8 +182,10 @@ public PackageURL(final String type, final @Nullable String namespace, final Str
180182
* Converts this {@link PackageURL} to a {@link PackageURLBuilder}.
181183
*
182184
* @return the builder
183-
* @deprecated Use {@link PackageURLBuilder#aPackageURL(PackageURL)} or {@link PackageURLBuilder#aPackageURL(String)}
185+
* @since 1.5.0
186+
* @deprecated use {@link PackageURLBuilder#aPackageURL(PackageURL)} or {@link PackageURLBuilder#aPackageURL(String)}
184187
*/
188+
@Deprecated
185189
public PackageURLBuilder toBuilder() {
186190
return PackageURLBuilder.aPackageURL()
187191
.withType(getType())
@@ -592,7 +596,7 @@ private static byte percentDecode(final byte[] bytes, final int start) {
592596
return ((byte) ((c1 << 4) + c2));
593597
}
594598

595-
public static String percentDecode(final String source) {
599+
private static String percentDecode(final String source) {
596600
if (source.isEmpty()) {
597601
return source;
598602
}
@@ -634,6 +638,14 @@ public static String percentDecode(final String source) {
634638
return new String(buffer.array(), 0, buffer.position(), StandardCharsets.UTF_8);
635639
}
636640

641+
/**
642+
* URI decodes the given string.
643+
*
644+
* @param source the encoded string
645+
* @return the decoded string
646+
* @since 1.4.2
647+
* @deprecated this method was made public in error in version 1.4.2 and will be removed without a replacement
648+
*/
637649
@Deprecated
638650
public String uriDecode(final String source) {
639651
return source != null ? percentDecode(source) : null;
@@ -649,7 +661,7 @@ private static byte[] percentEncode(byte b) {
649661
return new byte[] {(byte) PERCENT_CHAR, b1, b2};
650662
}
651663

652-
public static String percentEncode(final String source) {
664+
private static String percentEncode(final String source) {
653665
if (source.isEmpty()) {
654666
return source;
655667
}
@@ -925,41 +937,220 @@ public int hashCode() {
925937
* @since 1.0.0
926938
*/
927939
public static final class StandardTypes {
940+
/**
941+
* Arch Linux and other users of the libalpm/pacman package manager.
942+
*
943+
* @since 1.6.0
944+
*/
928945
public static final String ALPM = "alpm";
946+
/**
947+
* APK-based packages.
948+
*
949+
* @since 1.6.0
950+
*/
929951
public static final String APK = "apk";
952+
/**
953+
* Bitbucket-based packages.
954+
*
955+
* @since 1.0.0
956+
*/
930957
public static final String BITBUCKET = "bitbucket";
958+
/**
959+
* Bitnami-based packages.
960+
*
961+
* @since 1.6.0
962+
*/
931963
public static final String BITNAMI = "bitnami";
964+
/**
965+
* Rust.
966+
*
967+
* @since 1.2.0
968+
*/
932969
public static final String CARGO = "cargo";
970+
/**
971+
* CocoaPods.
972+
*
973+
* @since 1.6.0
974+
*/
933975
public static final String COCOAPODS = "cocoapods";
976+
/**
977+
* Composer PHP packages.
978+
*
979+
* @since 1.0.0
980+
*/
934981
public static final String COMPOSER = "composer";
982+
/**
983+
* Conan C/C++ packages.
984+
*
985+
* @since 1.6.0
986+
*/
935987
public static final String CONAN = "conan";
988+
/**
989+
* Conda packages.
990+
*
991+
* @since 1.6.0
992+
*/
936993
public static final String CONDA = "conda";
994+
/**
995+
* CPAN Perl packages.
996+
*
997+
* @since 1.6.0
998+
*/
937999
public static final String CPAN = "cpan";
1000+
/**
1001+
* CRAN R packages.
1002+
*
1003+
* @since 1.6.0
1004+
*/
9381005
public static final String CRAN = "cran";
1006+
/**
1007+
* Debian, Debian derivatives, and Ubuntu packages.
1008+
*
1009+
* @since 1.6.0
1010+
*/
9391011
public static final String DEB = "deb";
1012+
/**
1013+
* Docker images.
1014+
*
1015+
* @since 1.0.0
1016+
*/
9401017
public static final String DOCKER = "docker";
1018+
/**
1019+
* RubyGems.
1020+
*
1021+
* @since 1.0.0
1022+
*/
9411023
public static final String GEM = "gem";
1024+
/**
1025+
* Plain, generic packages that do not fit anywhere else, such as for "upstream-from-distro" packages.
1026+
*
1027+
* @since 1.0.0
1028+
*/
9421029
public static final String GENERIC = "generic";
1030+
/**
1031+
* GitHub-based packages.
1032+
*
1033+
* @since 1.0.0
1034+
*/
9431035
public static final String GITHUB = "github";
1036+
/**
1037+
* Go packages.
1038+
*
1039+
* @since 1.0.0
1040+
*/
9441041
public static final String GOLANG = "golang";
1042+
/**
1043+
* Haskell packages.
1044+
*
1045+
* @since 1.0.0
1046+
*/
9451047
public static final String HACKAGE = "hackage";
1048+
/**
1049+
* Hex packages.
1050+
*
1051+
* @since 1.6.0
1052+
*/
9461053
public static final String HEX = "hex";
1054+
/**
1055+
* Hugging Face ML models.
1056+
*
1057+
* @since 1.6.0
1058+
*/
9471059
public static final String HUGGINGFACE = "huggingface";
1060+
/**
1061+
* Lua packages installed with LuaRocks.
1062+
*
1063+
* @since 1.6.0
1064+
*/
9481065
public static final String LUAROCKS = "luarocks";
1066+
/**
1067+
* Maven JARs and related artifacts.
1068+
*
1069+
* @since 1.0.0
1070+
*/
9491071
public static final String MAVEN = "maven";
1072+
/**
1073+
* MLflow ML models (Azure ML, Databricks, etc.).
1074+
*
1075+
* @since 1.6.0
1076+
*/
9501077
public static final String MLFLOW = "mlflow";
1078+
/**
1079+
* Nixos packages
1080+
*
1081+
* @since 1.6.0
1082+
*/
9511083
public static final String NIX = "nix";
1084+
/**
1085+
* Node NPM packages.
1086+
*
1087+
* @since 1.0.0
1088+
*/
9521089
public static final String NPM = "npm";
1090+
/**
1091+
* NuGet .NET packages.
1092+
*
1093+
* @since 1.0.0
1094+
*/
9531095
public static final String NUGET = "nuget";
1096+
/**
1097+
* All artifacts stored in registries that conform to the
1098+
* <a href="https://github.com/opencontainers/distribution-spec">OCI Distribution Specification</a>, including
1099+
* container images built by Docker and others.
1100+
*
1101+
* @since 1.6.0
1102+
*/
9541103
public static final String OCI = "oci";
1104+
/**
1105+
* Dart and Flutter packages.
1106+
*
1107+
* @since 1.6.0
1108+
*/
9551109
public static final String PUB = "pub";
1110+
/**
1111+
* Python packages.
1112+
*
1113+
* @since 1.0.0
1114+
*/
9561115
public static final String PYPI = "pypi";
1116+
/**
1117+
* QNX packages.
1118+
*
1119+
* @since 1.6.0
1120+
*/
9571121
public static final String QPKG = "qpkg";
1122+
/**
1123+
* RPMs.
1124+
*
1125+
* @since 1.0.0
1126+
*/
9581127
public static final String RPM = "rpm";
1128+
/**
1129+
* ISO-IEC 19770-2 Software Identification (SWID) tags.
1130+
*
1131+
* @since 1.6.0
1132+
*/
9591133
public static final String SWID = "swid";
1134+
/**
1135+
* Swift packages.
1136+
*
1137+
* @since 1.6.0
1138+
*/
9601139
public static final String SWIFT = "swift";
1140+
/**
1141+
* Debian, Debian derivatives, and Ubuntu packages.
1142+
*
1143+
* @since 1.0.0
1144+
* @deprecated use {@link #DEB} instead
1145+
*/
9611146
@Deprecated
9621147
public static final String DEBIAN = "deb";
1148+
/**
1149+
* Nixos packages.
1150+
*
1151+
* @since 1.1.0
1152+
* @deprecated use {@link #NIX} instead
1153+
*/
9631154
@Deprecated
9641155
public static final String NIXPKGS = "nix";
9651156

0 commit comments

Comments
 (0)