Search code examples
javaeclipseecj

What are the reference infos when using Eclipse Batch Compiler


When reading through the Eclipse Batch Compiler Documentation for Java, I came accross the flag -referenceInfo whichs description is as follows:

Compute reference info. This is useful only if connected to the builder. The reference infos are useless otherwise.

What are does reference infos? Are those infos about object references? Is there any documentation available?


Solution

  • These reference infos are used when the Eclipse Java Compiler is used as part of the Eclipse Java IDE (as so-called project builder).

    Therefore, there will probably be no documentation for this. But in the code you can see which data is gathered with -referenceInfo during compilation (see org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope):

    if (compilerOptions.produceReferenceInfo) {
        this.qualifiedReferences = new SortedCompoundNameVector();
        this.simpleNameReferences = new SortedSimpleNameVector();
        this.rootReferences = new SortedSimpleNameVector();
        this.referencedTypes = new LinkedHashSet<>();
        this.referencedSuperTypesSet = new HashSet<>();
        this.referencedSuperTypes = new ObjectVector();
    } else {
        this.qualifiedReferences = null; // used to test if dependencies should be recorded
        this.simpleNameReferences = null;
        this.rootReferences = null;
        this.referencedTypes = null;
        this.referencedSuperTypesSet = null;
        this.referencedSuperTypes = null;
    }
    

    I guess (but I'm not sure if it's true) that for instance the referenced super types are collected e.g. to be able to quickly display a type hierarchy in the Java IDE.