Skip to content

Commit 238fbd2

Browse files
committed
Add JavaDoc to default constructors
1 parent 5e44420 commit 238fbd2

22 files changed

Lines changed: 201 additions & 21 deletions

config/pmd/pmd.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,39 @@
121121
</properties>
122122
</rule>
123123

124+
<rule ref="category/java/codestyle.xml/UnnecessaryConstructor">
125+
<properties>
126+
<property name="violationSuppressXPath">
127+
<value>
128+
<!-- false positives, work-around for https://github.com/pmd/pmd/issues/6284 -->
129+
.[
130+
ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.BotOwnerJavacord')]
131+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.slash.BotOwnerJavacordSlash')]
132+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.jda.BotOwnerJda')]
133+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.CommandHandler')]
134+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.Everyone')]
135+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.jda.GuildOwnerJda')]
136+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.prefix.javacord.MentionPrefixTransformerJavacord')]
137+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.prefix.jda.MentionPrefixTransformerJda')]
138+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.NsfwChannelJavacord')]
139+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.slash.NsfwChannelJavacordSlash')]
140+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.jda.NsfwChannelJda')]
141+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.PrivateMessageJavacord')]
142+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.slash.PrivateMessageJavacordSlash')]
143+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.jda.PrivateMessageJda')]
144+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.RegularUserJavacord')]
145+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.jda.RegularUserJda')]
146+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.ServerManagerJavacord')]
147+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.slash.ServerManagerJavacordSlash')]
148+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.jda.ServerManagerJda')]
149+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.ServerOwnerJavacord')]
150+
or ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.api.restriction.javacord.slash.ServerOwnerJavacordSlash')]
151+
]
152+
</value>
153+
</property>
154+
</properties>
155+
</rule>
156+
124157
<rule ref="category/java/design.xml">
125158
<exclude name="AvoidCatchingGenericException"/>
126159
<exclude name="ExcessiveImports"/>

src/main/java/net/kautler/command/api/CommandHandler.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Björn Kautler
2+
* Copyright 2019-2025 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -120,6 +120,13 @@ public abstract class CommandHandler<M> {
120120
private final LazyReferenceBySupplier<ExecutorService> executorService =
121121
new LazyReferenceBySupplier<>(Executors::newCachedThreadPool);
122122

123+
/**
124+
* Constructs a new command handler.
125+
*/
126+
public CommandHandler() {
127+
// just exists to carry JavaDoc
128+
}
129+
123130
/**
124131
* Ensures the implementing command handlers are initialized on startup.
125132
*

src/main/java/net/kautler/command/api/prefix/javacord/MentionPrefixTransformerJavacord.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 Björn Kautler
2+
* Copyright 2022-2025 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,6 +50,13 @@ public abstract class MentionPrefixTransformerJavacord implements CommandContext
5050
"%s ",
5151
message.getApi().getYourself().getNicknameMentionTag()));
5252

53+
/**
54+
* Constructs a new mention prefix command context transformer for Javacord.
55+
*/
56+
public MentionPrefixTransformerJavacord() {
57+
// just exists to carry JavaDoc
58+
}
59+
5360
@Override
5461
public <T extends Message> CommandContext<T> transform(CommandContext<T> commandContext, Phase phase) {
5562
validatePhase(phase);

src/main/java/net/kautler/command/api/prefix/jda/MentionPrefixTransformerJda.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Björn Kautler
2+
* Copyright 2019-2025 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -47,6 +47,13 @@ public abstract class MentionPrefixTransformerJda implements CommandContextTrans
4747
private final LazyReferenceByFunction<Message, String> nicknamePrefix =
4848
new LazyReferenceByFunction<>(message -> prefix.get(message).replaceFirst("^<@", "<@!"));
4949

50+
/**
51+
* Constructs a new mention prefix command context transformer for JDA.
52+
*/
53+
public MentionPrefixTransformerJda() {
54+
// just exists to carry JavaDoc
55+
}
56+
5057
@Override
5158
public <T extends Message> CommandContext<T> transform(CommandContext<T> commandContext, Phase phase) {
5259
validatePhase(phase);

src/main/java/net/kautler/command/api/restriction/Everyone.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Björn Kautler
2+
* Copyright 2019-2025 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,6 +26,13 @@
2626
*/
2727
@ApplicationScoped
2828
public class Everyone implements Restriction<Object> {
29+
/**
30+
* Constructs a new everyone restriction.
31+
*/
32+
public Everyone() {
33+
// just exists to carry JavaDoc
34+
}
35+
2936
@Override
3037
public boolean allowCommand(CommandContext<?> commandContext) {
3138
return true;

src/main/java/net/kautler/command/api/restriction/javacord/BotOwnerJavacord.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Björn Kautler
2+
* Copyright 2019-2025 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,6 +26,13 @@
2626
*/
2727
@ApplicationScoped
2828
public class BotOwnerJavacord implements Restriction<Message> {
29+
/**
30+
* Constructs a new bot owner restriction for Javacord.
31+
*/
32+
public BotOwnerJavacord() {
33+
// just exists to carry JavaDoc
34+
}
35+
2936
@Override
3037
public boolean allowCommand(CommandContext<? extends Message> commandContext) {
3138
return commandContext.getMessage().getAuthor().isBotOwner();

src/main/java/net/kautler/command/api/restriction/javacord/NsfwChannelJavacord.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Björn Kautler
2+
* Copyright 2019-2025 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,6 +30,13 @@
3030
*/
3131
@ApplicationScoped
3232
public class NsfwChannelJavacord implements Restriction<Message> {
33+
/**
34+
* Constructs a new NSFW channel restriction for Javacord.
35+
*/
36+
public NsfwChannelJavacord() {
37+
// just exists to carry JavaDoc
38+
}
39+
3340
@Override
3441
public boolean allowCommand(CommandContext<? extends Message> commandContext) {
3542
return commandContext

src/main/java/net/kautler/command/api/restriction/javacord/PrivateMessageJavacord.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Björn Kautler
2+
* Copyright 2019-2025 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,6 +26,13 @@
2626
*/
2727
@ApplicationScoped
2828
public class PrivateMessageJavacord implements Restriction<Message> {
29+
/**
30+
* Constructs a new private message restriction for Javacord.
31+
*/
32+
public PrivateMessageJavacord() {
33+
// just exists to carry JavaDoc
34+
}
35+
2936
@Override
3037
public boolean allowCommand(CommandContext<? extends Message> commandContext) {
3138
return commandContext.getMessage().isPrivateMessage();

src/main/java/net/kautler/command/api/restriction/javacord/RegularUserJavacord.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Björn Kautler
2+
* Copyright 2019-2025 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,13 @@
2929
*/
3030
@ApplicationScoped
3131
public class RegularUserJavacord implements Restriction<Message> {
32+
/**
33+
* Constructs a new regular user restriction for Javacord.
34+
*/
35+
public RegularUserJavacord() {
36+
// just exists to carry JavaDoc
37+
}
38+
3239
@Override
3340
public boolean allowCommand(CommandContext<? extends Message> commandContext) {
3441
return commandContext

src/main/java/net/kautler/command/api/restriction/javacord/ServerManagerJavacord.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Björn Kautler
2+
* Copyright 2019-2025 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,13 @@
2727
*/
2828
@ApplicationScoped
2929
public class ServerManagerJavacord implements Restriction<Message> {
30+
/**
31+
* Constructs a new server manager restriction for Javacord.
32+
*/
33+
public ServerManagerJavacord() {
34+
// just exists to carry JavaDoc
35+
}
36+
3037
@Override
3138
public boolean allowCommand(CommandContext<? extends Message> commandContext) {
3239
return commandContext.getMessage().getAuthor().canManageServer();

0 commit comments

Comments
 (0)