Skip to content

Commit dff0b6f

Browse files
committed
Added REPORT_SCAN_WARNINGS option to enable/disable logging warnings for potential package scanning issues for classes that does not have public no-arg constructor
1 parent 75cbce6 commit dff0b6f

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/main/java/dev/despical/commandframework/options/FrameworkOption.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* @see FrameworkOption#CUSTOM_COOLDOWN_CHECKER
2929
* @see FrameworkOption#CONFIRMATIONS
3030
* @see FrameworkOption#DEBUG
31+
* @see FrameworkOption#REPORT_SCAN_WARNINGS
3132
*/
3233
public enum FrameworkOption {
3334

@@ -44,5 +45,14 @@ public enum FrameworkOption {
4445
/**
4546
* This option enables the debug mode for this framework.
4647
*/
47-
DEBUG
48+
DEBUG,
49+
50+
/**
51+
* Specifies whether the framework should log warnings for potential issues found during
52+
* automatic package scanning.
53+
* <p>
54+
* For example, if a class contains command annotations but lacks a public no-args
55+
* constructor, it cannot be instantiated and registered.
56+
*/
57+
REPORT_SCAN_WARNINGS,
4858
}

src/main/java/dev/despical/commandframework/options/OptionManager.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@
3737
*/
3838
public final class OptionManager {
3939

40-
private final Set<FrameworkOption> frameworkOptions;
41-
42-
public OptionManager() {
43-
this.frameworkOptions = EnumSet.noneOf(FrameworkOption.class);
44-
}
40+
private final Set<FrameworkOption> frameworkOptions = EnumSet.of(
41+
FrameworkOption.REPORT_SCAN_WARNINGS
42+
);
4543

4644
public void enableOption(FrameworkOption frameworkOption) {
4745
this.frameworkOptions.add(frameworkOption);

0 commit comments

Comments
 (0)