Class ModuleScanDiagnostics
ComponentScanner and PluginManager both catch ClassNotFoundException |
LinkageError per class during a module's scan and skip-and-continue — the module still loads,
every other command still registers, and the one stale command silently does not exist. This
class does not change that shape; it only makes it loud. Its API is deliberately small: recordSkippedClass(String, String, Throwable) accumulates one skipped class for the owner
currently being scanned, and emitSummary(String) — called once, after that owner's
scan loop finishes — turns the accumulated list into exactly ONE Level.SEVERE record
naming the owner and every skipped class, with a migration guide link for framework mismatches.
A scan that skips nothing produces no output from this class.
Never routes through the root logger. DIAGNOSTICS_LOGGER disables parent
handlers, exactly as RemoteActionLog does and for the same measured reason:
SystemLogHandler attaches only to the root (empty-name) logger and
auto-reports any Level.SEVERE record carrying a Throwable into
ErrorReportCollector — which would turn this per-module summary into an error report
and risk the circular logging both classes' javadoc already warns about. The summary emitted by
emitSummary(String) deliberately carries no Throwable for the same reason: it
names each cause's type and message as text, and the stack traces live only on the per-class
Level.FINE detail recorded by recordSkippedClass(String, String, Throwable). Disabling parent handlers also disconnects this
logger from the console/logs/latest.log sink the server installs on the root logger, so a
PluginLoggerBridge forwards the records to the plugin's own logger (#557) -- the summary
then reaches the console at its real level and in the server's normal log format. (A private
console handler used here before wrote to the standard error stream, which Paper prints as two
WARN lines per record.)
- Since:
- 6.3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe pointer to the compatibility record that followsOLDER_API_CAUSEin both places.private static final Loggerstatic final StringThe cause phrase shared by this class's scan summary andPluginManager's refusal of a module whose declared main class fails to link against this framework, so an operator reads one wording for one cause.One accumulator entry per scan; cleared as each is emitted. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringdescribeFailure(String className, Throwable cause) static voidemitSummary(String scanKey) Emits ONELevel.SEVEREsummary for the scan only if at least one class was recorded since the last call, then resets the accumulator so a subsequent clean scan never repeats it.private static StringinlineCause(Throwable cause) The per-class detail is logged atLevel.FINE, which a default console hides, so the summary names the caught failure itself rather than pointing at a line the operator cannot see.private static booleanprivate static booleanisServerClass(String name) static voidrecordSkippedClass(String scanKey, String className, Throwable cause) Records one class that failed to load or initialize during the owner's scan, and immediately logs the per-class detail atLevel.FINEwithcauseattached — matching the shape the GEN-07 audit evaluator (D-14) also uses, so the two diagnostics read as one pattern.private static StringscanOwnerLabel(String scanKey)
-
Field Details
-
DIAGNOSTICS_LOGGER
-
OLDER_API_CAUSE
The cause phrase shared by this class's scan summary andPluginManager's refusal of a module whose declared main class fails to link against this framework, so an operator reads one wording for one cause.- See Also:
-
COMPATIBILITY_POINTER
The pointer to the compatibility record that followsOLDER_API_CAUSEin both places.- See Also:
-
SKIPPED_CLASSES_BY_SCAN
-
-
Constructor Details
-
ModuleScanDiagnostics
private ModuleScanDiagnostics()
-
-
Method Details
-
recordSkippedClass
Records one class that failed to load or initialize during the owner's scan, and immediately logs the per-class detail atLevel.FINEwithcauseattached — matching the shape the GEN-07 audit evaluator (D-14) also uses, so the two diagnostics read as one pattern.A
nullor blankscanKeyorclassNameis ignored entirely — neither the accumulator nor the FINE detail record it — rather than producing a summary entry reading the literal text"null".- Parameters:
scanKey- the module name or base package; external entity scans prefix the plugin name or JAR basename with NUL to keep a separate accumulator without altering the log labelclassName- the class that failed to load or initializecause- the exception the scan caught; may benull
-
emitSummary
Emits ONELevel.SEVEREsummary for the scan only if at least one class was recorded since the last call, then resets the accumulator so a subsequent clean scan never repeats it.- Parameters:
scanKey- the key passed torecordSkippedClass(String, String, Throwable)
-
scanOwnerLabel
-
describeFailure
-
inlineCause
The per-class detail is logged atLevel.FINE, which a default console hides, so the summary names the caught failure itself rather than pointing at a line the operator cannot see. -
isServerClass
-
isBlank
-