As explained earlier in this chapter, everything that can be given a name will have a corresponding entry in the index; moreover, by default, each element of the index can be referred through its fully qualified name. However, only the references that use the qualified name syntax can refer to these elements using the index. In SmallJava, only classes can be referred with qualified names.
Therefore, it makes no sense to index those elements that cannot be directly accessed through a qualified name. In our DSL, this means that only classes should be indexed. Although the presence of entries in the index for SmallJava methods, fields, and local variables does not harm, still it occupies some memory space uselessly. Moreover, the indexing procedure could be optimized by removing the overhead of indexing useless elements.
We then tweak the strategy for building the index for SmallJava programs; we need to provide a custom implementation of DefaultResourceDescriptionsStrategy...