-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
Milestone
Description
Jandex includes CompositeIndex
, which combines multiple indices that don't overlap. When the indices do overlap, CompositeIndex
will return duplicates.
We could add an OverlayIndex
which would overlay one index on top of another (or perhaps a stack of indices, not just two). Some methods on IndexView
are perhaps hard to define, but the most common ones should be possible.
Something like this:
public class OverlayIndex implements IndexView {
private final List<IndexView> indices;
Collection<ClassInfo> getKnownClasses() {
// call `getKnownClasses` on each index, in order, keep track of already seen class names
// and skip a class if its name was already seen
}
ClassInfo getClassByName(DotName className) {
// iterate through `indices` and return the first found
}
Collection<ClassInfo> getKnownDirectSubclasses(DotName className) {
// don't know here? perhaps call `getKnownDirectSubclasses` on each index, in order,
// keep track of already seen class names and skip a class if its name was already seen
}
Collection<ClassInfo> getAllKnownSubclasses(DotName className) {
// don't know here? perhaps call `getAllKnownSubclasses` on each index, in order,
// keep track of already seen class names and skip a class if its name was already seen
}
Collection<ClassInfo> getKnownDirectImplementors(DotName className) {
// don't know here? perhaps call `getKnownDirectImplementors` on each index, in order,
// keep track of already seen class names and skip a class if its name was already seen
}
Collection<ClassInfo> getAllKnownImplementors(final DotName interfaceName) {
// don't know here? perhaps call `getAllKnownImplementors` on each index, in order,
// keep track of already seen class names and skip a class if its name was already seen
}
Collection<AnnotationInstance> getAnnotations(DotName annotationName) {
// call `getAnnotations` on each index, keep track of already seen `AnnotationTarget`s
// and skip an `AnnotationTarget` if it was already seen
//
// note that `AnnotationTarget` doesn't have well defined equality, so this may be harder than it seems
}
Collection<AnnotationInstance> getAnnotationsWithRepeatable(DotName annotationName, IndexView index) {
// same as getAnnotations
}
Collection<ModuleInfo> getKnownModules() {
// same as `getKnownClasses` probably?
}
ModuleInfo getModuleByName(DotName moduleName) {
// same as `getClassByName` probably?
}
Collection<ClassInfo> getKnownUsers(DotName className) {
// call `getKnownUsers` on each index, in order, keep track of already seen class names
// and skip a class if its name was already seen
}
}