Skip to content

Commit

Permalink
Merge pull request BetonQuest#2574 from Wolf2323/checkstyle
Browse files Browse the repository at this point in the history
added checkstyle rule for NotNull annotation order to be before final…
  • Loading branch information
seyfahni authored Nov 2, 2023
2 parents f328d48 + 9352199 commit 263cb42
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions config/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
<property name="format" value="\t"/>
<property name="message" value="Indent must use space characters"/>
</module>
<module name="RegexpSinglelineJava">
<property name="id" value="NullabilityFinal"/>
<property name="format" value="\bfinal\s+@(NotNull|Nullable)\b"/>
<property name="message" value="Nullability annotations must be placed before the final modifier"/>
</module>
</module>

<!-- Whitespace -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void sendMessage(@NotNull final String message) {
}

@Override
public void sendMessage(final @NotNull String... messages) {
public void sendMessage(@NotNull final String... messages) {
log.debug("Silently sending messages to console: " + String.join(", ", messages));
}

Expand All @@ -56,7 +56,7 @@ public void sendMessage(@Nullable final UUID sender, @NotNull final String messa
}

@Override
public void sendMessage(@Nullable final UUID sender, final @NotNull String... messages) {
public void sendMessage(@Nullable final UUID sender, @NotNull final String... messages) {
log.debug("Silently sending messages to console: " + String.join(", ", messages));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ public ConfigManager(@Nullable final String sectionName, @Nullable final Configu
}

@SuppressWarnings("PMD.AvoidUncheckedExceptionsInSignatures")
private void checkValidState(final @Nullable ConfigurationSection original, final @Nullable ConfigurationSection fallback) throws IllegalStateException {
private void checkValidState(@Nullable final ConfigurationSection original, @Nullable final ConfigurationSection fallback) throws IllegalStateException {
if (original == null && fallback == null) {
throw new IllegalStateException("Cannot construct a FallbackConfigurationSection when original and fallback are null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public void associateWith(final String path, final ConfigurationSection targetCo
unsavedConfigs.add(targetConfig);
}

private void checkConflictAndSet(final @NotNull String path, final @Nullable Object value) {
private void checkConflictAndSet(@NotNull final String path, @Nullable final Object value) {
if (value == null || value instanceof ConfigurationSection) {
deletePath(path);
if (value == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public String getVersion() {
* @return possibly-null String of the requested identifier.
*/
@Override
public @NotNull String onPlaceholderRequest(final @Nullable Player player, final @NotNull String identifier) {
public @NotNull String onPlaceholderRequest(@Nullable final Player player, @NotNull final String identifier) {
final String pack;
final String placeholderIdentifier;
final int index = identifier.indexOf(':');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ private TaskList() {
*
* @param task the task to remove.
*/
private void addTask(final @NotNull ScheduledTask task) {
private void addTask(@NotNull final ScheduledTask task) {
tasks.put(task.getTaskId(), task);
}

Expand Down

0 comments on commit 263cb42

Please sign in to comment.