AnnotationInfo on PackageInfo/ModuleInfo missing classInfo/scanResult, causing loadClassAndInstantiate() to fail
When scanning packages or modules with ClassGraph, the PackageInfo and ModuleInfo types expose associated AnnotationInfo objects. However, these AnnotationInfo objects are missing a reference to the ScanResult.
Because of this, calling annotationInfo.loadClassAndInstantiate() on annotations attached to a PackageInfo (or ModuleInfo) fails - since neither classInfo nor scanResult are set. This leads to runtime errors when attempting to reflectively load and instantiate annotations in these contexts.
I reviewed the code and noticed that the AnnotationInfo objects associated with PackageInfo and ModuleInfo are never passed through setScanResult. For class-level annotations, this normally happens inside ScanResult::indexResourcesAndClassInfo, but the same setup step doesn’t seem to occur for package- or module-level annotations.