To avoid cyclic cross-references and allow GC after engine is not more
needed. (used by Eclipse plugin)
551004
public void dispose() {
        if (executionPlan != null) {
            executionPlan.dispose();
        }
        if (appClassList != null) {
            appClassList.clear();
        }
        if (classObserverList != null) {
            classObserverList.clear();
        }
        if (referencedClassSet != null) {
            referencedClassSet.clear();
        }
        analysisOptions.analysisFeatureSettingList = null;
        bugReporter = null;
        classFactory = null;
        IO.close(classPath);
        classPath = null;
        classScreener = null;
        detectorFactoryCollection = null;
        executionPlan = null;
        progressReporter = null;
        IO.close(project);
        project = null;
        analysisOptions.userPreferences = null;
    }
1073818
private void traverseAndRemoveUnusedReferences(Node root) {
    // Create scope from parent of root node, which also has externs as a child, so we'll
    // have extern definitions in scope.
    Scope scope = scopeCreator.createScope(root.getParent(), null);
    if (!scope.hasSlot(NodeUtil.JSC_PROPERTY_NAME_FN)) {
      // TODO(b/70730762): Passes that add references to this should ensure it is declared.
      // NOTE: null input makes this an extern var.
      scope.declare(
          NodeUtil.JSC_PROPERTY_NAME_FN, /* no declaration node */ null, /* no input */ null);
    }
    worklist.add(new Continuation(root, scope));
    while (!worklist.isEmpty()) {
      Continuation continuation = worklist.remove();
      continuation.apply();
    }

    removeUnreferencedVarsAndPolyfills();
    removeIndependentlyRemovableProperties();
    for (Scope fparamScope : allFunctionParamScopes) {
      removeUnreferencedFunctionArgs(fparamScope);
    }
  }
683295
private void encodeGeneration(CodeAssembler a, LocalVariable encodedVar,
                                  int offset, int generation)
    {
        if (offset < 0) {
            throw new IllegalArgumentException();
        }
        if (generation < 0) {
            return;
        }
        if (generation < 128) {
            a.loadLocal(encodedVar);
            a.loadConstant(offset);
            a.loadConstant((byte) generation);
            a.storeToArray(TypeDesc.BYTE);
        } else {
            generation |= 0x80000000;
            for (int i=0; i<4; i++) {
                a.loadLocal(encodedVar);
                a.loadConstant(offset + i);
                a.loadConstant((byte) (generation >> (8 * (3 - i))));
                a.storeToArray(TypeDesc.BYTE);
            }
        }
    }
1162663
private void removeDuplicateDeclarations(Node externs, Node root) {
    Callback tickler = new ScopeTicklingCallback();
    ScopeCreator scopeCreator =
        new Es6SyntacticScopeCreator(compiler, new DuplicateDeclarationHandler());
    NodeTraversal t = new NodeTraversal(compiler, tickler, scopeCreator);
    t.traverseRoots(externs, root);
  }
609509
public void traverse(EclipseASTVisitor visitor) {
		if (visitor.isDeferUntilPostDiet() && !isCompleteParse()) return;
		
		switch (getKind()) {
		case COMPILATION_UNIT:
			visitor.visitCompilationUnit(this, (CompilationUnitDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitCompilationUnit(this, (CompilationUnitDeclaration) get());
			break;
		case TYPE:
			visitor.visitType(this, (TypeDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitType(this, (TypeDeclaration) get());
			break;
		case FIELD:
			visitor.visitField(this, (FieldDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitField(this, (FieldDeclaration) get());
			break;
		case INITIALIZER:
			visitor.visitInitializer(this, (Initializer) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitInitializer(this, (Initializer) get());
			break;
		case METHOD:
			if (get() instanceof Clinit) return;
			visitor.visitMethod(this, (AbstractMethodDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitMethod(this, (AbstractMethodDeclaration) get());
			break;
		case ARGUMENT:
			AbstractMethodDeclaration method = (AbstractMethodDeclaration) up().get();
			visitor.visitMethodArgument(this, (Argument) get(), method);
			ast.traverseChildren(visitor, this);
			visitor.endVisitMethodArgument(this, (Argument) get(), method);
			break;
		case LOCAL:
			visitor.visitLocal(this, (LocalDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitLocal(this, (LocalDeclaration) get());
			break;
		case ANNOTATION:
			switch (up().getKind()) {
			case TYPE:
				visitor.visitAnnotationOnType((TypeDeclaration) up().get(), this, (Annotation) get());
				break;
			case FIELD:
				visitor.visitAnnotationOnField((FieldDeclaration) up().get(), this, (Annotation) get());
				break;
			case METHOD:
				visitor.visitAnnotationOnMethod((AbstractMethodDeclaration) up().get(), this, (Annotation) get());
				break;
			case ARGUMENT:
				visitor.visitAnnotationOnMethodArgument(
						(Argument) parent.get(),
						(AbstractMethodDeclaration) parent.directUp().get(),
						this, (Annotation) get());
				break;
			case LOCAL:
				visitor.visitAnnotationOnLocal((LocalDeclaration) parent.get(), this, (Annotation) get());
				break;
			case TYPE_USE:
				visitor.visitAnnotationOnTypeUse((TypeReference) parent.get(), this, (Annotation) get());
				break;
			default:
				throw new AssertionError("Annotation not expected as child of a " + up().getKind());
			}
			break;
		case TYPE_USE:
			visitor.visitTypeUse(this, (TypeReference) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitTypeUse(this, (TypeReference) get());
			break;
		case STATEMENT:
			visitor.visitStatement(this, (Statement) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitStatement(this, (Statement) get());
			break;
		default:
			throw new AssertionError("Unexpected kind during node traversal: " + getKind());
		}
	}
281152
function defaultEngine (engine) {
    // set engine
    if (defined(engine)) {
        getGlobal().defaultEngine = engine
        // return class when setting
        return ImmutableCoreModel
    }
    // return engine
    return getGlobal().defaultEngine
}
832879
protected void removeReferencingFromCache(Set<String> references) {

        if (m_jspLoader != null) {
            m_jspLoader.removeFromCache(references, false);
        }
    }
778212
@Override
    protected void configureFindbugsEngine() {
        if (not != null) {
            addArg("-not");
        }
        addBoolOption("-notAProblem", notAProblem);
        addBoolOption("-withSource", withSource);
        addOption("-exclude", exclude);
        addOption("-include", include);
        addOption("-annotation", annotation);
        addOption("-after", after);
        addOption("-before", before);
        addOption("-first", first);
        addOption("-last", last);
        addOption("-fixed", fixed);
        addOption("-present", present);
        addOption("-absent", absent);
        addBoolOption("-active", active);
        addBoolOption("-introducedByChange", introducedByChange);
        addBoolOption("-removedByChange", removedByChange);
        addBoolOption("-newCode", newCode);
        addBoolOption("-removedCode", removedCode);
        addOption("-priority", priority);
        addOption("-maxRank", maxRank);
        addOption("-class", clazz);
        addOption("-bugPattern", bugPattern);
        addOption("-category", category);
        addOption("-designation", designation);
        addBoolOption("-withMessages", withMessages);
        addBoolOption("-applySuppression", applySuppression);
        if (excludeBugs != null) {
            addArg("-excludeBugs");
            addArg(excludeBugs);
        }

        addArg(inputFile.getName());

        addArg(outputFile.getPath());
    }
501051
public static Engine getEngine(String configPath, Properties configProperties) {
        if (StringUtils.isEmpty(configPath)) {
            configPath = HTTL_PROPERTIES;
        }
        VolatileReference<Engine> reference = ENGINES.get(configPath);
        if (reference == null) {
            reference = new VolatileReference<Engine>(); // quickly
            VolatileReference<Engine> old = ENGINES.putIfAbsent(configPath, reference);
            if (old != null) { // duplicate
                reference = old;
            }
        }
        assert (reference != null);
        Engine engine = reference.get();
        if (engine == null) {
            synchronized (reference) { // reference lock
                engine = reference.get();
                if (engine == null) { // double check
                    engine = BeanFactory.createBean(Engine.class, initProperties(configPath, configProperties)); // slowly
                    reference.set(engine);
                }
            }
        }
        assert (engine != null);
        return engine;
    }
888771
static void createSynthesizedExternVar(AbstractCompiler compiler, String varName) {
    Node nameNode = IR.name(varName);

    // Mark the variable as constant if it matches the coding convention
    // for constant vars.
    // NOTE(nicksantos): honestly, I'm not sure how much this matters.
    // AFAIK, all people who use the CONST coding convention also
    // compile with undeclaredVars as errors. We have some test
    // cases for this configuration though, and it makes them happier.
    if (compiler.getCodingConvention().isConstant(varName)) {
      nameNode.putBooleanProp(Node.IS_CONSTANT_NAME, true);
    }

    Node syntheticExternVar = IR.var(nameNode);
    getSynthesizedExternsRoot(compiler).addChildToBack(syntheticExternVar);
    compiler.reportChangeToEnclosingScope(syntheticExternVar);
  }
1174256
public <T> void dereference(T instance, Class<T> type, Annotation qualifier)
            throws ProviderMissingException {
        if (uiThreadRunner.isOnUiThread()) {

        } else {
            uiThreadRunner.post(new Runnable() {
                @Override
                public void run() {

                }
            });
        }

        graph.dereference(instance, type, qualifier, Inject.class);
    }
516380
private void onSetGcGrace(CfDef cfDef, Properties cfProperties, StringBuilder builder)
    {
        String gcGraceSeconds = cfProperties.getProperty(CassandraConstants.GC_GRACE_SECONDS);
        if (gcGraceSeconds != null)
        {
            try
            {
                if (builder != null)
                {
                    appendPropertyToBuilder(builder, gcGraceSeconds, CassandraConstants.GC_GRACE_SECONDS);
                }
                else
                {
                    cfDef.setGc_grace_seconds(Integer.parseInt(gcGraceSeconds));
                }
            }
            catch (NumberFormatException nfe)
            {
                log.error("GC_GRACE_SECONDS should be numeric type, Caused by: .", nfe);
                throw new SchemaGenerationException(nfe);
            }
        }
    }
941985
public static void safeRelease(Object msg) {
		if (msg instanceof ReferenceCounted) {
			ReferenceCounted referenceCounted = (ReferenceCounted) msg;
			if (referenceCounted.refCnt() > 0) {
				referenceCounted.release();
			}
		}
	}
626298
@Override
	public void setReferences(IReferences references) {

		List<Object> loggers = references.getOptional(new Descriptor(null, "logger", null, null, null));
		for (Object logger : loggers) {
			if (logger instanceof ILogger && logger != this)
				_loggers.add((ILogger) logger);
		}
	}
782314
private void initialize() {
		// TODO: Add preferences for a+g+v + parent-a+g+v!
		IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
		artifactIdText.setText("sample1");
		groupIdText.setText("org.sample");
		versionText.setText("1.0.0-SNAPSHOT");
		rootFolderText.setText(prefs.getString(P_DEFAULT_ROOT_FOLDER));
		mavenHomeText.setText(prefs.getString(P_MAVEN_HOME));
		customGroovyModelImplText.setText(prefs.getString(P_GROOVY_MODEL));

		// Moving away from eclipse:m2eclipse
//		String eclipseGoal = prefs.getString(P_ECLIPSE_GOAL);
//		mavenEclipseGoalText.setText(eclipseGoal);
//		if (eclipseGoal.equals("eclipse:m2eclipse")) {
//			mavenEclipseGoalType.value = MavenEclipseGoalEnum.ECLIPSE_M2ECLIPSE.ordinal();
//		} else {
//			mavenEclipseGoalType.value = MavenEclipseGoalEnum.ECLIPSE_ECLIPSE.ordinal();
//		}
		mavenEclipseGoalType.value = MavenEclipseGoalEnum.ECLIPSE_ECLIPSE.ordinal();
	}
1080187
public JvmTypeReference typeRef(Class<?> clazz, JvmTypeReference... typeArgs) {
		JvmType type = references.findDeclaredType(clazz, context);
		if (type == null) {
			return createUnknownTypeReference(clazz.getName());
		}
		return typeRef(type, typeArgs);
	}
993219
private void checkReferenceForeignkeys(ModelDef modelDef, String checkLevel) throws ConstraintException
    {
        if (CHECKLEVEL_NONE.equals(checkLevel))
        {
            return;
        }

        ClassDescriptorDef     classDef;
        ReferenceDescriptorDef refDef;

        for (Iterator it = modelDef.getClasses(); it.hasNext();)
        {
            classDef = (ClassDescriptorDef)it.next();
            for (Iterator refIt = classDef.getReferences(); refIt.hasNext();)
            {
                refDef = (ReferenceDescriptorDef)refIt.next();
                if (!refDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false))
                {
                    checkReferenceForeignkeys(modelDef, refDef);
                }
            }
        }
    }