Returns a compilation unit associated with the given name, or null if
not found.

@param name the requested name
@param from optional CompilationUnit is passed because requested name
should be found relative to it.
160501
public CompilationUnit getCompilationUnit(String name,
            CompilationUnit from) {
        String fqName = determineQualifiedName(name, from);

        // Templates with source will always override compiled templates
        boolean compiled = false;
        if (fqName == null && (compiled = CompiledTemplate.exists(this, name, from))) {
            fqName = CompiledTemplate.getFullyQualifiedName(name);
        }
        if (fqName == null)
            return null;

        CompilationUnit unit = mCompilationUnitMap.get(fqName);
        if (unit == null) {
            if (!compiled) {
                unit = createCompilationUnit(fqName);
                if (unit != null)
                    mCompilationUnitMap.put(fqName, unit);
            } else {
                unit = new CompiledTemplate(name, this, from);
                // if the CompiledTemplate class was precompiled (is valid) return the unit, otherwise return null to signify 'not found'
                if( ((CompiledTemplate)unit).isValid() ) {
                    mCompilationUnitMap.put(fqName, unit);
                } else {
                    // TODO:  flag the template class for removal
                    unit = null;
                }
            }
        }

        return unit;
    }
237462
private LookupResult findDecompiled(String name, CompilationUnit compilationUnit, GroovyClassLoader loader) {
        ClassNode node = ClassHelper.make(name);
        if (node.isResolved()) {
            return new LookupResult(null, node);
        }

        DecompiledClassNode asmClass = null;
        String fileName = name.replace('.', '/') + ".class";
        URL resource = loader.getResource(fileName);
        if (resource != null) {
            try {
                asmClass = new DecompiledClassNode(AsmDecompiler.parseClass(resource), new AsmReferenceResolver(this, compilationUnit));
                if (!asmClass.getName().equals(name)) {
                    // this may happen under Windows because getResource is case insensitive under that OS!
                    asmClass = null;
                }
            } catch (IOException e) {
                // fall through and attempt other search strategies
            }
        }

        if (asmClass != null) {
            if (isFromAnotherClassLoader(loader, fileName)) {
                return tryAsScript(name, compilationUnit, asmClass);
            }

            return new LookupResult(null, asmClass);
        }
        return null;
    }
870481
public Class<?> getClassByEntityName(String name) {
        if (StringUtils.isBlank(name)) {
            throw new IllegalArgumentException("name cannot be null or empty.");
        }
        return entries.get(name);
    }
226716
public String getByName(final String name) {
		if (headerMap == null) {
			throw new IllegalStateException("No header available");
		}

		final Integer col = headerMap.get(name);
		if (col != null) {
			return get(col);
		}
		return null;
	}
1344743
public ClassDocImpl lookupClass(String name) {
        ClassSymbol c = getClassSymbol(name);
        if (c != null) {
            return getClassDoc(c);
        } else {
            return null;
        }
    }
416282
public Class loadClass(String name)
    {
        try
        {
            return classLoader.loadClass( name );
        }
        catch (ClassNotFoundException notFound)
        {
            return null;
        }
        catch (NoClassDefFoundError notFound)
        {
            return null;
        }
    }
661166
public Class<?> getClassByName(String name) throws ClassNotFoundException {
        Map<String, Class<?>> map = CACHE_CLASSES.get(classLoader);
        if (map == null) {
            Map<String, Class<?>> newMap = new ConcurrentHashMap<>();
            map = CACHE_CLASSES.putIfAbsent(classLoader, newMap);
            if (map == null) {
                map = newMap;
            }
        }

        Class clazz = map.get(name);
        if (clazz == null) {
            clazz = Class.forName(name, true, classLoader);
            if (clazz != null) {
                map.put(name, clazz);
            }
        }

        return clazz;
    }
1118688
private <S extends Symbol> S nameToSymbol(String nameStr, Class<S> clazz) {
        Name name = names.fromString(nameStr);
        // First check cache.
        Symbol sym = (clazz == ClassSymbol.class)
                    ? syms.classes.get(name)
                    : syms.packages.get(name);

        try {
            if (sym == null)
                sym = javaCompiler.resolveIdent(nameStr);

            sym.complete();

            return (sym.kind != Kinds.ERR &&
                    sym.exists() &&
                    clazz.isInstance(sym) &&
                    name.equals(sym.getQualifiedName()))
                ? clazz.cast(sym)
                : null;
        } catch (CompletionFailure e) {
            return null;
        }
    }
1233009
public static AddonId from(String name, String version)
   {
      return from(name, version, null);
   }
1074699
@Override
    public Object getMember(String name) {
        switch (name) {
            case "wrapRDD": return F_wrapRDD;
            case "cache": return F_cache;
            case "persist": return F_persist;
            case "unpersist": return F_unpersist;
            case "distinct": return F_distinct;
            case "filter": return F_filter;
            case "coalesce": return F_coalesce;
            case "repartition": return F_repartition;
            case "subtract": return F_subtract;
            case "sample": return F_sample;
            case "union": return F_union;
            case "intersection": return F_intersection;
            case "sum": return F_sum;
            case "min": return F_min;
            case "max": return F_max;
            case "stats": return F_stats;
            case "mean": return F_mean;
            case "variance": return F_variance;
            case "stdev": return F_stdev;
            case "sampleStdev": return F_sampleStdev;
            case "sampleVariance": return F_sampleVariance;
            case "meanApprox": return F_meanApprox;
            case "sumApprox": return F_sumApprox;
            case "histogram": return F_histogram;
            case "setName": return F_setName;


        }
        return super.getMember(name);
    }
1165780
@SuppressWarnings("unchecked")
    public <U extends Uniform> U get(String name) {
        final Uniform uniform = uniforms.get(name);
        if (uniform == null) {
            return null;
        }
        return (U) uniform;
    }
889441
@Override
    public Object getMember(String name) {
        switch (name) {
            case "dense":
                return F_dense;
            case "sparse":
                return F_sparse;
            case "zeros":
                return F_zeros;
            case "parse":
                return F_parse;
            case "fromJson":
                return F_fromJson;
            case "norm":
                return F_norm;
            case "sqdist":
                return F_sqdist;
        }
        return super.getMember(name);
    }
1322285
public void compile(String name, String code) throws CompilationFailedException {
        CompilationUnit unit = new CompilationUnit(configuration);
        unit.addSource(new SourceUnit(name, code, configuration, unit.getClassLoader(), unit.getErrorCollector()));
        unit.compile();
    }
483961
public EnumConstant getConstant(String name) {
        for (EnumConstant enumConstant : getConstants()) {
            if (enumConstant.getName().equals(name)) {
                return enumConstant;
            }
        }
        return null;
    }
938226
public Clazz<?> FindClazz( String name )
	{
		if( clazzz == null )
			return null;

		for( Clazz<?> c : clazzz.values() )
			if( c.getClassName().equals( name ) )
				return c;

		return null;
	}
449695
private static LookupResult tryAsScript(String name, CompilationUnit compilationUnit, ClassNode oldClass) {
        LookupResult lr = null;
        if (oldClass!=null) {
            lr = new LookupResult(null, oldClass);
        }
        
        if (name.startsWith("java.")) return lr;
        //TODO: don't ignore inner static classes completely
        if (name.indexOf('$') != -1) return lr;
        
        // try to find a script from classpath*/
        GroovyClassLoader gcl = compilationUnit.getClassLoader();
        URL url = null;
        try {
            url = gcl.getResourceLoader().loadGroovySource(name);
        } catch (MalformedURLException e) {
            // fall through and let the URL be null
        }
        if (url != null && ( oldClass==null || isSourceNewer(url, oldClass))) {
            SourceUnit su = compilationUnit.addSource(url);
            return new LookupResult(su,null);
        }
        return lr;
    }
1013973
private Object find(String name) {
		if (name == null)
			throw new NullPointerException("Dependency name cannot be null");
		if (_references == null)
			throw new NullPointerException("References shall be set");

		return _dependencies.get(name);
	}