Class DiscoveryIndexProcessor
java.lang.Object
javax.annotation.processing.AbstractProcessor
tech.guilhermekaua.spigotboot.spigot.annotationprocessor.discovery.DiscoveryIndexProcessor
- All Implemented Interfaces:
Processor
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(RELEASE_8)
public class DiscoveryIndexProcessor
extends AbstractProcessor
Generates a compile-time discovery index covering every class the spigot-boot runtime would
otherwise discover by classpath scanning. For each compilation unit that contains at least one
indexable class, the processor emits:
- A source file
tech.guilhermekaua.spigotboot.generated.DiscoveryIndex_<hash>implementingDiscoveryIndex. The category map is built by resolving each discovered class by name throughDiscoveryIndexSupport, so a class whose supertype comes from an absent optional dependency is skipped instead of crashing the whole index. The.classliterals the Maven Shade Plugin's reachability analyzer needs (to keep discovered classes whenminimizeJaris enabled) are emitted in a never-invokedkeepReachable()method, so they live in the bytecode without being linked at runtime. - An empty marker resource at
META-INF/spigot-boot/discovery/<GeneratedClassFQCN>soDiscoveryIndexReadercan locate the generated class at runtime.
Categories are not hardcoded. The processor discovers them dynamically by reading
@SpigotBootDiscoveryCategory meta-annotations on annotations and supertypes reachable
from the compile classpath, so any third-party module can ship its own discovery rules
without modifying this processor.
-
Field Summary
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinit(ProcessingEnvironment processingEnv) booleanprocess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, isInitialized
-
Constructor Details
-
DiscoveryIndexProcessor
public DiscoveryIndexProcessor()
-
-
Method Details
-
init
- Specified by:
initin interfaceProcessor- Overrides:
initin classAbstractProcessor
-
process
- Specified by:
processin interfaceProcessor- Specified by:
processin classAbstractProcessor
-