Skip to content

Commit

Permalink
fix: adjust checkstyle checks on KeyPattern to match annotation
Browse files Browse the repository at this point in the history
For some reason @pattern is not TYPE_USE, so we should adjust CS to match
  • Loading branch information
zml2008 committed Oct 3, 2024
1 parent 287bc90 commit e6c7612
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@

<!-- https://gitlab.com/stellardrift/stylecheck/-/blob/trunk/src/main/java/ca/stellardrift/stylecheck/AnnotationsCloseToType.java -->
<module name="AnnotationsCloseToType">
<property name="typeUseAnnotations" value="NotNull, Nullable, Pattern, RegExp, KeyPattern, KeyPattern.Namespace, KeyPattern.Value"/>
<property name="typeUseAnnotations" value="NotNull, Nullable, RegExp"/>
</module>

<!-- https://checkstyle.org/config_javadoc.html#WriteTag -->
Expand Down
6 changes: 3 additions & 3 deletions key/src/main/java/net/kyori/adventure/key/Key.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public interface Key extends Comparable<Key>, Examinable, Namespaced, Keyed {
* @throws InvalidKeyException if the namespace or value contains an invalid character
* @since 4.0.0
*/
static @NotNull Key key(final @NotNull @KeyPattern String string) {
static @NotNull Key key(@KeyPattern final @NotNull String string) {
return key(string, DEFAULT_SEPARATOR);
}

Expand Down Expand Up @@ -120,7 +120,7 @@ public interface Key extends Comparable<Key>, Examinable, Namespaced, Keyed {
* @throws InvalidKeyException if the namespace or value contains an invalid character
* @since 4.4.0
*/
static @NotNull Key key(final @NotNull Namespaced namespaced, final @NotNull @KeyPattern.Value String value) {
static @NotNull Key key(final @NotNull Namespaced namespaced, @KeyPattern.Value final @NotNull String value) {
return key(namespaced.namespace(), value);
}

Expand All @@ -133,7 +133,7 @@ public interface Key extends Comparable<Key>, Examinable, Namespaced, Keyed {
* @throws InvalidKeyException if the namespace or value contains an invalid character
* @since 4.0.0
*/
static @NotNull Key key(final @NotNull @KeyPattern.Namespace String namespace, final @NotNull @KeyPattern.Value String value) {
static @NotNull Key key(@KeyPattern.Namespace final @NotNull String namespace, @KeyPattern.Value final @NotNull String value) {
return new KeyImpl(namespace, value);
}

Expand Down
3 changes: 2 additions & 1 deletion key/src/main/java/net/kyori/adventure/key/Namespaced.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ public interface Namespaced {
* @return the namespace
* @since 4.4.0
*/
@NotNull @KeyPattern.Namespace String namespace();
@KeyPattern.Namespace
@NotNull String namespace();
}

0 comments on commit e6c7612

Please sign in to comment.