Returns a LambdaFactory instance with the given configuration.
@throws JavaCompilerNotFoundException if the library cannot find any java compiler and it's not provided
in the configuration
544671
public static LambdaFactory get(LambdaFactoryConfiguration configuration) {
        JavaCompiler compiler = Optional.ofNullable(configuration.getJavaCompiler()).orElseThrow(JavaCompilerNotFoundException::new);
        return new LambdaFactory(
                configuration.getDefaultHelperClassSourceProvider(),
                configuration.getClassFactory(),
                compiler,
                configuration.getImports(),
                configuration.getStaticImports(),
                configuration.getCompilationClassPath(),
                configuration.getParentClassLoader());
    }
239405
private static void createFactoryInstance() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createFactoryInstance");
    try {
      Class cls = Class.forName(JS_MESSAGE_HANDLE_FACTORY_CLASS);
      instance = (JsMessageHandleFactory) cls.newInstance();
    }
    catch (Exception e) {
      FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.JsMessageHandleFactory.createFactoryInstance", "133");
      SibTr.error(tc,"UNABLE_TO_CREATE_HANDLEFACTORY_CWSIF0031",e);
      NoClassDefFoundError ncdfe = new NoClassDefFoundError(e.getMessage());
      ncdfe.initCause(e);
      throw ncdfe;
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createFactoryInstance");
  }
1001604
@SuppressWarnings("unchecked")
  public static <T> T newInstance(Class<T> theClass, Configuration conf,
      boolean supportJobConf) {
    T result;
    try {
      Constructor<T> meth = (Constructor<T>) CONSTRUCTOR_CACHE.get(theClass);
      if (meth == null) {
        meth = theClass.getDeclaredConstructor(EMPTY_ARRAY);
        meth.setAccessible(true);
        CONSTRUCTOR_CACHE.put(theClass, meth);
      }
      result = meth.newInstance();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    setConf(result, conf, supportJobConf);
    return result;
  }
1177183
void compileClass(Source javaSource, Source javaClass,
                    String sourcePath, boolean isMake)
    throws ClassNotFoundException
  {
    try {
      JavaCompilerUtil compiler = JavaCompilerUtil.create(getClassLoader());
      compiler.setClassDir(_classDir);
      compiler.setSourceDir(_sourceDir);
      if (_encoding != null)
        compiler.setEncoding(_encoding);
      compiler.setArgs(_args);
      compiler.setCompileParent(! isMake);
      compiler.setSourceExtension(_sourceExt);
      if (_compiler != null)
        compiler.setCompiler(_compiler);

      //LineMap lineMap = new LineMap(javaFile.getNativePath());
      // The context path is obvious from the browser url
      //lineMap.add(name.replace('.', '/') + _sourceExt, 1, 1);

      // Force this into a relative path so different compilers will work
      String prefix = _sourceDir.getPath();
      String full = javaSource.getPath();

      String source;
      if (full.startsWith(prefix)) {
        source = full.substring(prefix.length());
        if (source.startsWith("/"))
          source = source.substring(1);
      }
      else
        source = javaSource.getPath();

      /*
      if (javaSource.canRead() && javaClass.exists())
        javaClass.remove();
      */
          
      compiler.compileIfModified(source, null);
    } catch (Exception e) {
      //getClassLoader().addDependency(new Depend(javaSource));

      log.log(Level.FINEST, e.toString(), e);

      // Compile errors are wrapped in a special ClassNotFound class
      // so the server can give a nice error message
      throw new CompileClassNotFound(e);
    }
  }
1175349
public int runCompiler(String... args) {
		try {
			final BQRuntime runtime = createRuntime(args);
			final CommandOutcome outcome = runtime.run();
			if (!outcome.isSuccess() && outcome.getException() != null) {
				Logger.getRootLogger().error(outcome.getMessage(), outcome.getException());
			}
			return outcome.getExitCode();
		} catch (ProvisionException exception) {
			final Throwable ex = Throwables.getRootCause(exception);
			if (ex != null) {
				Logger.getRootLogger().error(ex.getLocalizedMessage());
			} else {
				Logger.getRootLogger().error(exception.getLocalizedMessage());
			}
		} catch (Throwable exception) {
			Logger.getRootLogger().error(exception.getLocalizedMessage());
		}
		return Constants.ERROR_CODE;
	}
914787
public static <T> Configuration<T> build(Class<T> type, Set<String> excludedFields, Set<String> includedFields,
                Set<String> nonnullFields, CachedHashCodeInitializer<T> cachedHashCodeInitializer, boolean hasRedefinedSuperclass,
                Class<? extends T> redefinedSubclass, boolean usingGetClass, EnumSet<Warning> warningsToSuppress,
                FactoryCache factoryCache, Set<String> ignoredAnnotationClassNames, Set<String> actualFields,
                List<T> equalExamples, List<T> unequalExamples) {

        TypeTag typeTag = new TypeTag(type);
        FactoryCache cache = JavaApiPrefabValues.build().merge(factoryCache);
        PrefabValues prefabValues = new PrefabValues(cache);
        ClassAccessor<T> classAccessor = ClassAccessor.of(type, prefabValues);
        AnnotationCache annotationCache = buildAnnotationCache(type, ignoredAnnotationClassNames);
        Set<String> ignoredFields = determineIgnoredFields(type, annotationCache, warningsToSuppress, excludedFields, includedFields, actualFields);
        List<T> unequals = ensureUnequalExamples(typeTag, classAccessor, unequalExamples);

        return new Configuration<>(type, typeTag, classAccessor, prefabValues, ignoredFields, nonnullFields,
            annotationCache, cachedHashCodeInitializer, hasRedefinedSuperclass, redefinedSubclass, usingGetClass,
            warningsToSuppress, equalExamples, unequals);
    }
829793
private static Method lambdaMethod(SerializedLambda serializedLambda) {
        Class<?> containingClass = getClassForName(serializedLambda.getImplClass());
        String implMethodName = serializedLambda.getImplMethodName();
        return getMethod(containingClass, implMethodName);
    }
161715
private static Object invokeNullaryFactoryMethod(final String fqcn, final String methodName) {
        try {
            final Class<?> type = Class.forName(fqcn);
            final Method method = type.getMethod(methodName);

            return method.invoke(null);
            // any exception is really unexpected since the type name has
            // already been verified
        } catch (final Exception e) {
            throw new InstantiationException(
                    String.format("Could not create %s#%s(): %s", fqcn, methodName, e), e);
        }
    }
290584
public CompilerConfiguration getCompilerConfiguration() {
        CompilerConfiguration cc = new CompilerConfiguration();
        ImportCustomizer imports = new ImportCustomizer();
        for (String starImport: STAR_IMPORTS) {
            imports.addStarImports(starImport);
        }
        for (String staticStar: STATIC_IMPORTS) {
            imports.addStaticStars(staticStar);
        }
        cc.addCompilationCustomizers(imports);
        return cc;
    }
1150126
static synchronized DocFileFactory getFactory(Configuration configuration) {
        DocFileFactory f = factories.get(configuration);
        if (f == null) {
            JavaFileManager fm = configuration.getFileManager();
            if (fm instanceof StandardJavaFileManager)
                f = new StandardDocFileFactory(configuration);
            else {
                try {
                    Class<?> pathFileManagerClass =
                            Class.forName("com.sun.tools.javac.nio.PathFileManager");
                    if (pathFileManagerClass.isAssignableFrom(fm.getClass()))
                        f = new PathDocFileFactory(configuration);
                } catch (Throwable t) {
                    throw new IllegalStateException(t);
                }
            }
            factories.put(configuration, f);
        }
        return f;
    }
1260981
def get_java_container(self, package_name=None, object_name=None, java_class_instance=None):
        
        if package_name is not None:
            jcontainer = self.import_scala_package_object(package_name)
        elif object_name is not None:
            jcontainer = self.import_scala_object(object_name)
        elif java_class_instance is not None:
            jcontainer = java_class_instance
        else:
            raise RuntimeError("Expected one of package_name, object_name or java_class_instance")
        return jcontainer
1186758
public Class compile(String sCode, String sName) {
        GroovyClassLoader loader = getGroovyClassLoader();
        LOG.warn("Compiling filter: " + sName);
        Class groovyClass = loader.parseClass(sCode, sName);
        return groovyClass;
    }
295266
public Result compile(String[] args) {
        Context context = new Context();
        JavacFileManager.preRegister(context); // can't create it until Log has been set up
        Result result = compile(args, context);
        if (fileManager instanceof JavacFileManager) {
            try {
                // A fresh context was created above, so jfm must be a JavacFileManager
                ((JavacFileManager)fileManager).close();
            } catch (IOException ex) {
                bugMessage(ex);
            }
        }
        return result;
    }
708387
static ConverterFactory getConverterFactory(Configuration conf) {
    Class<? extends ConverterFactory> converterFactoryClass = conf.getClass(CONVERTER_FACTORY, null,
        ConverterFactory.class);
    if (converterFactoryClass == null) {
      throw new RuntimeException("ConverterFactory class was not set on the configuration");
    }
    LOG.debug("Got input ConverterFactory class from conf: {}", converterFactoryClass);
    return ReflectionUtils.newInstance(converterFactoryClass, conf);
  }
244305
public static CFMLEngine getInstance(final ServletConfig config, final EngineChangeListener listener) throws ServletException {
	getInstance(config);

	// add listener for update
	factory.addListener(listener);

	// read init param from config
	factory.readInitParam(config);

	factory.initEngineIfNecessary();
	singelton.addServletConfig(config);

	// make the FDController visible for the FDClient
	FDControllerFactory.makeVisible();

	return singelton;
    }
265888
public static Writable newInstance(Class<? extends Writable> c,
      Configuration conf, boolean supportJobConf) {
    WritableFactory factory = WritableFactories.getFactory(c);
    if (factory != null) {
      Writable result = factory.newInstance();
      if (result instanceof Configurable) {
        ((Configurable) result).setConf(conf);
      }
      return result;
    } else {
      return ReflectionUtils.newInstance(c, conf, supportJobConf);
    }
  }
1149441
public static Function<ResourceModelSourceFactory, ResourceModelSource> factoryConverter(
        final Properties configuration
    )
    {
        //nb: not using lambda due to inability to mock this class within grails tests, some conflict with cglib and
        // j8 lambdas
        return new Function<ResourceModelSourceFactory, ResourceModelSource>() {
            @Override
            public ResourceModelSource apply(final ResourceModelSourceFactory resourceModelSourceFactory) {
                try {
                    return resourceModelSourceFactory.createResourceModelSource(configuration);
                } catch (ConfigurationException e) {
                    throw new RuntimeException(e);
                }
            }
        };
    }