Search in sources :

Example 1 with HashtableOfModule

use of org.eclipse.jdt.internal.compiler.util.HashtableOfModule in project bazel-jdt-java-toolchain by salesforce.

the class ElementsImpl9 method getAllModuleElements.

@Override
public Set<? extends ModuleElement> getAllModuleElements() {
    LookupEnvironment lookup = _env.getLookupEnvironment();
    HashtableOfModule knownModules = lookup.knownModules;
    ModuleBinding[] modules = knownModules.valueTable;
    if (modules == null || modules.length == 0) {
        return Collections.emptySet();
    }
    Set<ModuleElement> mods = new HashSet<>(modules.length);
    for (ModuleBinding moduleBinding : modules) {
        if (moduleBinding == null)
            continue;
        ModuleElement element = (ModuleElement) _env.getFactory().newElement(moduleBinding);
        mods.add(element);
    }
    mods.add((ModuleElement) _env.getFactory().newElement(lookup.UnNamedModule));
    return mods;
}
Also used : LookupEnvironment(org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment) HashtableOfModule(org.eclipse.jdt.internal.compiler.util.HashtableOfModule) ModuleElement(javax.lang.model.element.ModuleElement) ModuleBinding(org.eclipse.jdt.internal.compiler.lookup.ModuleBinding) HashSet(java.util.HashSet)

Example 2 with HashtableOfModule

use of org.eclipse.jdt.internal.compiler.util.HashtableOfModule in project bazel-jdt-java-toolchain by salesforce.

the class LookupEnvironment method reset.

public void reset() {
    if (this.root != this) {
        this.root.reset();
        return;
    }
    this.stepCompleted = 0;
    this.knownModules = new HashtableOfModule();
    this.UnNamedModule = new ModuleBinding.UnNamedModule(this);
    this.module = this.UnNamedModule;
    this.JavaBaseModule = null;
    // assume the default package always exists
    this.defaultPackage = new PlainPackageBinding(this);
    this.defaultImports = null;
    this.knownPackages = new HashtableOfPackage();
    this.accessRestrictions = new HashMap(3);
    this.verifier = null;
    // NOTE: remember to fix #updateCaches(...) when adding unique binding caches
    this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3);
    this.uniquePolymorphicMethodBindings = new SimpleLookupTable(3);
    this.uniqueGetClassMethodBinding = null;
    this.missingTypes = null;
    this.typesBeingConnected = new LinkedHashSet();
    for (int i = this.units.length; --i >= 0; ) this.units[i] = null;
    this.lastUnitIndex = -1;
    this.lastCompletedUnitIndex = -1;
    // in case AbortException occurred
    this.unitBeingCompleted = null;
    this.classFilePool.reset();
    this.typeSystem.reset();
// name environment has a longer life cycle, and must be reset in
// the code which created it.
}
Also used : LinkedHashSet(java.util.LinkedHashSet) HashtableOfPackage(org.eclipse.jdt.internal.compiler.util.HashtableOfPackage) HashMap(java.util.HashMap) HashtableOfModule(org.eclipse.jdt.internal.compiler.util.HashtableOfModule) SimpleLookupTable(org.eclipse.jdt.internal.compiler.util.SimpleLookupTable)

Aggregations

HashtableOfModule (org.eclipse.jdt.internal.compiler.util.HashtableOfModule)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 ModuleElement (javax.lang.model.element.ModuleElement)1 LookupEnvironment (org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment)1 ModuleBinding (org.eclipse.jdt.internal.compiler.lookup.ModuleBinding)1 HashtableOfPackage (org.eclipse.jdt.internal.compiler.util.HashtableOfPackage)1 SimpleLookupTable (org.eclipse.jdt.internal.compiler.util.SimpleLookupTable)1