Class DependencyUtils
ComponentScan and EnableAutoRegister.
@UltiToolsModule carries both ComponentScan and EnableAutoRegister as
meta-annotations, and its scanBasePackages()/scanBasePackageClasses()
attributes declare @AliasFor onto ComponentScan's basePackages()/
basePackageClasses(). Resolution therefore goes through MergedAnnotationResolver.find(java.lang.Class<?>, java.lang.Class<A>) rather than the JDK's own direct-annotation-only reflection
(a bare Class lookup, which only sees an annotation declared directly on the class and
misses that merge entirely) -- before @since 6.3.0 a class annotated only
@UltiToolsModule(scanBasePackages = {...}) silently fell through to the plugin class's own
package, discarding its declared value (SILENT-22).
- Since:
- 6.0.0
- Author:
- wisdomme
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondedupeNestedPackages(Set<String> packages) Drops any package that is a strict, segment-wise subpackage of another package already present inpackages(#362).static String[]getPluginPackages(UltiToolsPlugin plugin) Get plugin packages.
-
Constructor Details
-
DependencyUtils
public DependencyUtils()
-
-
Method Details
-
getPluginPackages
Get plugin packages.Additive, not first-match: every declared source --
ComponentScan.value(),ComponentScan.basePackages(),ComponentScan.basePackageClasses(), andEnableAutoRegister.scanPackage()-- contributes packages, in declaration order, with duplicates collapsed to their first occurrence, mirroringPluginManager.getPluginScanPackages's shape. Falls back to the plugin class's own package only when no source contributes anything.- Parameters:
plugin- UltiTools plugin instance- Returns:
- Plugin packages
-
dedupeNestedPackages
Drops any package that is a strict, segment-wise subpackage of another package already present inpackages(#362). A scanner that recurses from the parent package already reaches every@ConfigEntityclass the nested entry would find again, so keeping both meansConfigManager.registerAllinitialises - and validates - the same class once per matching scan package instead of once overall."Strict subpackage" is tested by segment, not by string prefix:
com.example.modularis NOT a subpackage ofcom.example.mod, even though the raw string starts with it - the comparison always appends a trailing"."before testingString.startsWith(String).- Parameters:
packages- candidate packages, in declaration order; never mutated- Returns:
- a new set containing only the packages with no ancestor also present in
packages, in the same relative order. Empty in, empty out - nothing throws.
-