Fix Javadoc warnings due to Java 21 update (+ some other warnings)

The default implicit constructor must also have a doc comment, so I have to make it explicit and either properly restrict the visibility of the constructor, or actually document it.
This commit is contained in:
Marc Baloup 2024-06-06 23:59:32 +02:00
parent decf302851
commit d411618e63
58 changed files with 188 additions and 12 deletions

View File

@ -25,7 +25,6 @@ import java.util.function.Function;
*/
public class PandalibBungeePermissions implements Listener {
/**
* Registers event listener to redirect permission checks to {@code pandalib-permissions}.
* @param bungeePlugin a BungeeCord plugin.
@ -35,6 +34,8 @@ public class PandalibBungeePermissions implements Listener {
}
private PandalibBungeePermissions() {}
/**
* Event handler called when a plugin asks if a player has a permission.
* @param event the permission check event.

View File

@ -43,4 +43,7 @@ public class PandaLibBungee {
public static Plugin getPlugin() {
return plugin;
}
private PandaLibBungee() {}
}

View File

@ -35,4 +35,11 @@ public class BungeeBackupConfig {
* A list of ignored files or directory in the workdir to exclude from the backup.
*/
public List<String> workdirIgnoreList = new ArrayList<>();
/**
* Creates a new {@link BungeeBackupConfig}.
*/
public BungeeBackupConfig() {
}
}

View File

@ -22,6 +22,11 @@ public class ChatColorGradient {
private final List<GradientColor> colors = new ArrayList<>();
/**
* Create the custom gradient.
*/
public ChatColorGradient() {}
/**
* Put a specific color at a specific location in the gradient.
* @param gradientLocation the location in the gradient.

View File

@ -293,4 +293,7 @@ public class ChatColorUtil {
}
private ChatColorUtil() {}
}

View File

@ -157,5 +157,9 @@ public class ChatConfig {
.thenText("] ");
}
private PandaTheme() {}
}
private ChatConfig() {}
}

View File

@ -679,5 +679,10 @@ public abstract class ChatStatic {
return builder.style(c.style()).append(c.children());
}
/**
* Creates a new {@link ChatStatic} instance.
*/
protected ChatStatic() {}
}

View File

@ -657,5 +657,6 @@ public class ChatUtil {
return str;
}
private ChatUtil() {}
}

View File

@ -25,6 +25,9 @@ public class CLIBrigadierDispatcher extends BrigadierDispatcher<CLICommandSender
public static final CLICommandSender CLI_CONSOLE_COMMAND_SENDER = new CLIConsoleCommandSender();
private CLIBrigadierDispatcher() {}
/**
* Executes the provided command as the console.
* @param commandWithoutSlash the command, without the eventual slash at the beginning.

View File

@ -11,6 +11,12 @@ import org.jetbrains.annotations.NotNull;
* The console command sender.
*/
public class CLIConsoleCommandSender implements CLICommandSender {
/**
* Creates a new console command sender.
*/
protected CLIConsoleCommandSender() {}
public String getName() {
return "Console";
}

View File

@ -36,6 +36,11 @@ import static fr.pandacube.lib.chat.ChatStatic.text;
*/
public class CommandAdmin extends CLIBrigadierCommand {
/**
* Initializes the admin command.
*/
public CommandAdmin() {}
@Override
protected LiteralArgumentBuilder<CLICommandSender> buildCommand() {
return literal("admin")

View File

@ -9,6 +9,11 @@ import fr.pandacube.lib.cli.CLIApplication;
*/
public class CommandStop extends CLIBrigadierCommand {
/**
* Initializes the admin command.
*/
public CommandStop() {}
@Override
protected LiteralArgumentBuilder<CLICommandSender> buildCommand() {
return literal("stop")

View File

@ -97,5 +97,7 @@ public class CLILogger {
t.start();
return ps;
}
private CLILogger() {}
}

View File

@ -25,6 +25,11 @@ import java.util.function.Predicate;
*/
public abstract class BrigadierCommand<S> {
/**
* Creates a Brigadier command.
*/
public BrigadierCommand() {}
/**
* Returns a builder for this command.

View File

@ -21,6 +21,11 @@ public abstract class BrigadierDispatcher<S> {
private final CommandDispatcher<S> dispatcher = new CommandDispatcher<>();
/**
* Creates a new Dispatcher instance.
*/
public BrigadierDispatcher() {}
/**
* Registers the provided command node into this dispatcher.

View File

@ -140,4 +140,8 @@ public class BrigadierSuggestionsUtil {
}
private BrigadierSuggestionsUtil() {}
}

View File

@ -70,6 +70,11 @@ public abstract class BackupCleaner implements UnaryOperator<TreeSet<LocalDateTi
};
}
/**
* Create a backup cleaner.
*/
public BackupCleaner() {}
/**
* Creates a new {@link BackupCleaner} that keeps the archives kept by this {@link BackupCleaner} or by the provided

View File

@ -54,7 +54,7 @@ public class CronScheduler {
long now = System.currentTimeMillis();
if (!tasks.isEmpty()) {
CronTask next = tasks.get(0);
CronTask next = tasks.getFirst();
if (next.nextRun <= now) {
next.runAsync();
setLastRun(next.taskId, now);
@ -224,5 +224,6 @@ public class CronScheduler {
.toEpochMilli();
}
private CronScheduler() {}
}

View File

@ -163,4 +163,6 @@ public class Json {
}
}*/
private Json() {}
}

View File

@ -30,6 +30,8 @@ public class ThrowableAdapter implements JsonSerializer<Throwable>, JsonDeserial
/* package */ static final TypeAdapterFactory FACTORY = TreeTypeAdapter.newTypeHierarchyFactory(Throwable.class, new ThrowableAdapter());
private ThrowableAdapter() {}
@Override
public Throwable deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {

View File

@ -237,5 +237,8 @@ public class TypeConverter {
}
}
private TypeConverter() {}
}

View File

@ -58,6 +58,9 @@ public record MinecraftVersionList(
private static final TypeToken<Map<String, Integer>> MAP_STR_INT_TYPE = new TypeToken<>() { };
private static final TypeToken<Map<Integer, List<String>>> MAP_INT_LIST_STRING_TYPE = new TypeToken<>() { };
private MinecraftVersionListAdapter() {}
@Override
public MinecraftVersionList deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
if (!(json instanceof JsonObject jsonObj))

View File

@ -135,4 +135,7 @@ public class MinecraftVersionUtil {
return set;
}
private MinecraftVersionUtil() {}
}

View File

@ -56,18 +56,21 @@
<artifact>org.apache.commons:commons-dbcp2</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/versions/9/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.apache.commons:commons-pool2</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/versions/9/**</exclude>
</excludes>
</filter>
<filter>
<artifact>commons-logging:commons-logging</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/versions/9/**</exclude>
</excludes>
</filter>
</filters>

View File

@ -16,6 +16,11 @@ import java.util.stream.Collectors;
*/
public class SQLElementList<E extends SQLElement<E>> extends ArrayList<E> {
/**
* Creates an empty list of sql elements.
*/
public SQLElementList() {}
/**
* Stores all the values modified by {@link #setCommon(SQLField, Object)}.
*/

View File

@ -232,12 +232,8 @@ public class SQLField<E extends SQLElement<E>, T> {
}
@SuppressWarnings({"rawtypes", "unchecked"})
public Object fromJavaTypeToJDBCType(Object value) throws DBException {
/* package */ Object fromJavaTypeToJDBCType(Object value) throws DBException {
Object ret = value;
if (value != null && type instanceof SQLCustomType customType) {
try {
@ -250,7 +246,7 @@ public class SQLField<E extends SQLElement<E>, T> {
return ret;
}
public Collection<Object> fromListJavaTypeToJDBCType(Collection<?> values) throws DBException {
/* package */ Collection<Object> fromListJavaTypeToJDBCType(Collection<?> values) throws DBException {
if (values == null)
return null;
List<Object> ret = new ArrayList<>(values.size());

View File

@ -13,6 +13,11 @@ import fr.pandacube.lib.util.log.Log;
*/
public abstract class SQLWhere<E extends SQLElement<E>> {
/**
* Creates a SQL WHERE expression.
*/
protected SQLWhere() {}
/* package */ abstract ParameterizedSQLString toSQL() throws DBException;
@Override
@ -69,6 +74,7 @@ public abstract class SQLWhere<E extends SQLElement<E>> {
* Create a custom SQL {@code WHERE} expression.
* @param whereExpr the raw SQL {@code WHERE} expression.
* @return a new SQL {@code WHERE} expression.
* @param <E> the table type.
*/
public static <E extends SQLElement<E>> SQLWhere<E> expression(String whereExpr) {
return expression(whereExpr, List.of());
@ -79,6 +85,7 @@ public abstract class SQLWhere<E extends SQLElement<E>> {
* @param whereExpr the raw SQL {@code WHERE} expression.
* @param params the parameters of the provided expression.
* @return a new SQL {@code WHERE} expression.
* @param <E> the table type.
*/
public static <E extends SQLElement<E>> SQLWhere<E> expression(String whereExpr, List<Object> params) {
return new SQLWhereCustomExpression<>(whereExpr, params);
@ -89,6 +96,7 @@ public abstract class SQLWhere<E extends SQLElement<E>> {
* @param leftExpr the raw SQL left operand.
* @param valuesIn the values on the right of the {@code IN} operator.
* @return a new SQL {@code WHERE} expression.
* @param <E> the table type.
*/
public static <E extends SQLElement<E>> SQLWhere<E> expressionIn(String leftExpr, Collection<?> valuesIn) {
return expressionIn(leftExpr, List.of(), valuesIn);
@ -100,6 +108,7 @@ public abstract class SQLWhere<E extends SQLElement<E>> {
* @param leftParams the parameters of the left operand.
* @param valuesIn the values on the right of the {@code IN} operator.
* @return a new SQL {@code WHERE} expression.
* @param <E> the table type.
*/
public static <E extends SQLElement<E>> SQLWhere<E> expressionIn(String leftExpr, List<Object> leftParams, Collection<?> valuesIn) {
return new SQLWhereInCustom<>(leftExpr, leftParams, valuesIn);

View File

@ -21,4 +21,8 @@
</dependency>
</dependencies>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
</project>

View File

@ -82,6 +82,12 @@ public class PandalibPaperPermissions implements Listener {
}
}
/**
* Creates a {@link PandalibPaperPermissions} instance.
*/
private PandalibPaperPermissions() {}
/**
* Player login event handler.
* @param event the event.

View File

@ -119,5 +119,7 @@ public class PermissionExpressionParser {
return super.evaluate(constant, evaluationContext);
}
}
private PermissionExpressionParser() {}
}

View File

@ -199,5 +199,7 @@ public class Permissions {
checkInitialized();
return backendReader.getFullPermissionsList();
}
private Permissions() {}
}

View File

@ -48,4 +48,5 @@ public class Reflect {
}
private Reflect() {}
}

View File

@ -78,4 +78,7 @@ public class WrapperRegistry {
ReflectConstructor<? extends ReflectWrapperI> objectWrapperConstructor) {
}
private WrapperRegistry() {}
}

View File

@ -104,4 +104,7 @@ public class DistanceUtil {
}
}
private DistanceUtil() {}
}

View File

@ -84,4 +84,6 @@ public class EnumUtil {
return RandomUtil.arrayElement(enumType.getEnumConstants());
}
private EnumUtil() {}
}

View File

@ -52,4 +52,7 @@ public class FileUtils {
Files.copy(source.toPath(), target.toPath());
}
}
private FileUtils() {}
}

View File

@ -21,4 +21,8 @@ public class ListUtil {
list.add(i);
}
}
private ListUtil() {}
}

View File

@ -158,5 +158,7 @@ public class MemoryUtil {
unitMultiplier = uMultiplier;
}
}
private MemoryUtil() {}
}

View File

@ -97,6 +97,8 @@ public class MinecraftWebUtil {
return builder.toString();
}
private MinecraftWebUtil() {}

View File

@ -10,7 +10,7 @@ import java.util.UUID;
* <p>
* You can generate the UUID programmatically using {@link #getFromNickName(String)} and
* {@link #getFromNickNames(String[])}.
*
* <p>
* To use this class as a program, type
* <pre>
* java -cp&lt;anyClassPathContainingThisClass&gt; fr.pandacube.lib.util.OfflineUUID [playernames...]
@ -67,4 +67,6 @@ public class OfflineUUID {
System.out.println(arg + "\t" + getFromNickName(arg));
}
}
private OfflineUUID() {}
}

View File

@ -172,7 +172,7 @@ public class RandomUtil {
return String.valueOf(pw);
}
private RandomUtil() {}
}

View File

@ -146,6 +146,6 @@ public class StringUtil {
private StringUtil() {}
}

View File

@ -147,5 +147,6 @@ public class ThrowableUtil {
return new RuntimeException(t);
}
private ThrowableUtil() {}
}

View File

@ -56,4 +56,6 @@ public class Tick {
return Duration.ofMillis(toMs(tick));
}
private Tick() {}
}

View File

@ -481,4 +481,7 @@ public class TimeUtil {
}
private TimeUtil() {}
}

View File

@ -2,6 +2,9 @@ package fr.pandacube.lib.util.function;
/**
* A consumer that can possibly throw a checked exception.
* @param <T> the first parameter for this bi-consumer.
* @param <U> the second parameter for this bi-consumer.
* @param <E> the exception type that this interface method can throw.
*/
@FunctionalInterface
public interface BiConsumerException<T, U, E extends Exception> {

View File

@ -2,6 +2,8 @@ package fr.pandacube.lib.util.function;
/**
* A predicate that can possibly throw a checked exception.
* @param <T> the parameter for this predicate.
* @param <E> the exception type that this predicate can throw.
*/
@FunctionalInterface
public interface PredicateException<T, E extends Exception> {

View File

@ -2,6 +2,7 @@ package fr.pandacube.lib.util.function;
/**
* A runnable that can possibly throw a checked exception.
* @param <E> the exception type that this interface method can throw.
*/
@FunctionalInterface
public interface RunnableException<E extends Exception> {

View File

@ -2,6 +2,8 @@ package fr.pandacube.lib.util.function;
/**
* A supplier that can possibly throw a checked exception.
* @param <T> the return type of this supplier.
* @param <E> the exception type that this interface method can throw.
*/
@FunctionalInterface
public interface SupplierException<T, E extends Exception> {

View File

@ -2,6 +2,9 @@ package fr.pandacube.lib.util.function;
/**
* A function that can possibly throw a checked exception.
* @param <T> the first parameter for this bi-function.
* @param <U> the second parameter for this bi-function.
* @param <E> the exception type that this interface method can throw.
*/
@FunctionalInterface
public interface ToIntBiFunctionException<T, U, E extends Exception> {

View File

@ -2,6 +2,10 @@ package fr.pandacube.lib.util.function;
/**
* A consumer that can possibly throw a checked exception.
* @param <T> the first parameter for this tri-consumer.
* @param <U> the second parameter for this tri-consumer.
* @param <V> the third parameter for this tri-consumer.
* @param <E> the exception type that this interface method can throw.
*/
@FunctionalInterface
public interface TriConsumerException<T, U, V, E extends Exception> {

View File

@ -30,6 +30,11 @@ public class DailyLogRotateFileHandler extends Handler {
private String currentFileDate = getCurrentDay();
private boolean closed = false;
/**
* Creates a new {@link DailyLogRotateFileHandler}.
*/
public DailyLogRotateFileHandler() {}
@Override
public synchronized void close() throws SecurityException {

View File

@ -159,4 +159,6 @@ public final class Log {
logger.info(message);
}
private Log() {}
}

View File

@ -14,6 +14,11 @@ import java.time.Duration;
public abstract class AbstractServerWS extends WebSocketAdapter implements AbstractWS {
private boolean isClosed = false;
/**
* Creates a Websocket server endpoint.
*/
public AbstractServerWS() {}
@Override
public final void onWebSocketConnect(Session session)

View File

@ -100,4 +100,6 @@ public class PayloadRegistry {
registerPayloadType("login-succeed", LoginSucceedPayload.class);
}
private PayloadRegistry() {}
}

View File

@ -4,4 +4,9 @@ package fr.pandacube.lib.ws.payloads;
* Payload used by the server in inform the client the login was successful.
*/
public class LoginSucceedPayload extends Payload {
/**
* Creates a new {@link LoginSucceedPayload}.
*/
public LoginSucceedPayload() {}
}

View File

@ -5,4 +5,8 @@ package fr.pandacube.lib.ws.payloads;
*/
public abstract class Payload {
/**
* Creates a new {@link Payload}.
*/
public Payload() {}
}

View File

@ -25,7 +25,7 @@
</developer>
</developers>
<inceptionYear>2015</inceptionYear>
<inceptionYear>2011</inceptionYear>
<ciManagement>
<system>jenkins</system>