Compiles the {@code source} java code into the class {@code name}.
@param sources the java source code
@param options the compiler options
@return true if the source code compiled, false otherwise
428145
public boolean compile(final Map<String, String> sources, final String... options) {
		final Set<StringSourceFileObject> compUnit = sources.entrySet().stream().map(entry -> new StringSourceFileObject(entry.getKey(), entry.getValue())).collect(Collectors.toSet());
		return compile(compUnit, options);
	}
681247
function compileJSSource(ComponentClass) {
    var sourceBuffer = new CompileSourceBuffer();
    var contextId = genSSRId();

    sourceBuffer.addRendererStart();
    var renderId = compileComponentSource(sourceBuffer, ComponentClass, contextId);
    sourceBuffer.addRaw('return componentRenderers.' + renderId + '(data, noDataOutput)');
    sourceBuffer.addRendererEnd();

    return sourceBuffer.toCode();
}
1291394
public void addSource(ISource source) {
		if (sourceList == null) {
			sourceList = new ArrayList<ISource>();
		}
		sourceList.add(source);
	}
100978
@Override
    public synchronized Class<?> doCompile(String name, String sourceCode, OutputStream os) throws Throwable {

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Begin to compile source code: class is '{}'", name);
        }

        int i = name.lastIndexOf('.');
        String packageName = i < 0 ? "" : name.substring(0, i);
        String className = i < 0 ? name : name.substring(i + 1);
        JavaFileObjectImpl javaFileObject = new JavaFileObjectImpl(className, sourceCode);
        javaFileManager.putFileForInput(StandardLocation.SOURCE_PATH, packageName,
                className + ClassUtils.JAVA_EXTENSION, javaFileObject);

        DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<JavaFileObject>();
        Boolean result = compiler.getTask(null, javaFileManager, diagnosticCollector, options, null,
                Arrays.asList(new JavaFileObject[] { javaFileObject })).call();
        if (result == null || !result.booleanValue()) {
            throw new IllegalStateException(
                    "Compilation failed. class: " + name + ", diagnostics: " + diagnosticCollector.getDiagnostics());
        }

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("compile source code done: class is '{}'", name);
            LOGGER.debug("loading class '{}'", name);
        }

        Class<?> retClass = classLoader.loadClass(name);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("loading class done  '{}'", name);
        }

        if (os != null) {
            byte[] bytes = classLoader.loadClassBytes(name);
            if (bytes != null) {
                os.write(bytes);
                os.flush();
            }
        }
        return retClass;
    }
365651
function(options) {
    if (config.sourcemaps) {
        options = _.defaults(
            options,
            { devtool: '#source-map' }
        );
    }

    if (config.production) {
        var currPlugins = _.isArray(options.plugins) ? options.plugins : [];
        options.plugins = currPlugins.concat([new UglifyJsPlugin({ sourceMap: false })]);
    }

    return options;
}
1217418
@GwtIncompatible("Unnecessary")
  private void outputSourceMap(B options, String associatedName) throws IOException {
    if (Strings.isNullOrEmpty(options.sourceMapOutputPath)
        || options.sourceMapOutputPath.equals("/dev/null")) {
      return;
    }

    String outName = expandSourceMapPath(options, null);
    maybeCreateDirsForPath(outName);
    try (Writer out = fileNameToOutputWriter2(outName)) {
      compiler.getSourceMap().appendTo(out, associatedName);
    }
  }
976641
boolean checkSource(PathImpl sourceDir, String javaName)
  {
    try {
      while (javaName != null && ! javaName.equals("")) {
        int p = javaName.indexOf('/');
        String head;
      
        if (p >= 0) {
          head = javaName.substring(0, p);
          javaName = javaName.substring(p + 1);
        }
        else {
          head = javaName;
          javaName = null;
        }

        String []names = sourceDir.list();
        int i;
        for (i = 0; i < names.length; i++) {
          if (names[i].equals(head))
            break;
        }

        if (i == names.length)
          return false;

        sourceDir = sourceDir.lookup(head);
      }
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
      
      return false;
    }

    return true;
  }
658491
public static <T> Source<T> join(Source<T>... sources) {
        return join(Arrays.asList(sources));
    }
980447
public static Optional<Class<?>> getClassWithAnnotation(final Class<?> source,
        final Class<? extends Annotation> annotationClass) {

        Class<?> nextSource = source;
        while (nextSource != Object.class) {
            if (nextSource.isAnnotationPresent(annotationClass)) {
                return Optional.of(nextSource);
            } else {
                nextSource = nextSource.getSuperclass();
            }
        }

        return Optional.empty();
    }
178728
public void compile(String[] files) throws CompilationFailedException {
        CompilationUnit unit = new CompilationUnit(configuration);
        unit.addSources(files);
        unit.compile();
    }
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);
    }
  }
794193
protected List<String> resolveJavacOptions( CompilerConfiguration configuration )
    {
        String javacOptions = configuration.getJavacOptions();
        String sourceEncoding = configuration.getSourceEncoding();
        List<String> result = new ArrayList<String>( Arrays.asList( parseArgLine( javacOptions ) ) );
        if ( !result.contains( "-encoding" ) && sourceEncoding != null && sourceEncoding.length() > 0 )
        {
            result.add( "-encoding" );
            result.add( sourceEncoding );
        }
        return result;
    }
399452
private void writeCompileOptions(final Writer writer, final boolean isDebug, final String baseDir,
      final CommandLineCompilerConfiguration compilerConfig) throws IOException {
    final StringBuffer baseOptions = new StringBuffer(50);
    baseOptions.append("# ADD BASE CPP");
    final StringBuffer options = new StringBuffer(50);
    options.append("# ADD CPP");
    final File[] includePath = compilerConfig.getIncludePath();
    for (final File element : includePath) {
      options.append(" /I \"");
      final String relPath = CUtil.getRelativePath(baseDir, element);
      options.append(CUtil.toWindowsPath(relPath));
      options.append('"');
    }
    final Hashtable<String, String> optionMap = new Hashtable<>();

    if (isDebug) {
      //
      // release options that should be mapped to debug counterparts
      //
      optionMap.put("/MT", "/MTd");
      optionMap.put("/ML", "/MLd");
      optionMap.put("/MD", "/MDd");
      optionMap.put("/O2", "/Od");
      optionMap.put("/O3", "/Od");
    } else {
      //
      // debug options that should be mapped to release counterparts
      //
      optionMap.put("/MTD", "/MT");
      optionMap.put("/MLD", "/ML");
      optionMap.put("/MDD", "/MD");
      optionMap.put("/GM", "");
      optionMap.put("/ZI", "");
      optionMap.put("/OD", "/O2");
      optionMap.put("/GZ", "");
    }

    final String[] preArgs = compilerConfig.getPreArguments();
    for (final String preArg : preArgs) {
      if (preArg.startsWith("/D")) {
        options.append(" /D ");
        baseOptions.append(" /D ");
        final String body = preArg.substring(2);
        if (preArg.indexOf('=') >= 0) {
          options.append(body);
          baseOptions.append(body);
        } else {
          final StringBuffer buf = new StringBuffer("\"");
          if ("NDEBUG".equals(body) || "_DEBUG".equals(body)) {
            if (isDebug) {
              buf.append("_DEBUG");
            } else {
              buf.append("NDEBUG");
            }
          } else {
            buf.append(body);
          }
          buf.append("\"");
          options.append(buf);
          baseOptions.append(buf);
        }
      } else if (!preArg.startsWith("/I")) {
        String option = preArg;
        final String key = option.toUpperCase(Locale.US);
        if (optionMap.containsKey(key)) {
          option = optionMap.get(key);
        }
        options.append(" ");
        options.append(option);
        baseOptions.append(" ");
        baseOptions.append(option);
      }
    }
    baseOptions.append("\r\n");
    options.append("\r\n");
    writer.write(baseOptions.toString());
    writer.write(options.toString());

  }
1176032
private static String getSource(final String className) {
		String sourceName = '/' + className.replace('.', '/') + ".java";

		InputStream stream = null;

		try {
			stream = ExampleSection.class.getResourceAsStream(sourceName);

			if (stream != null) {
				byte[] sourceBytes = StreamUtil.getBytes(stream);

				// we need to do some basic formatting of the source now.
				return new String(sourceBytes, "UTF-8");
			}
		} catch (IOException e) {
			LOG.warn("Unable to read source code for class " + className, e);
		} finally {
			if (stream != null) {
				try {
					stream.close();
				} catch (IOException e) {
					LOG.error("Error closing stream", e);
				}
			}
		}

		return null;
	}
965517
public static void copyProperties(Object source, Object target, CopyOptions copyOptions) {
		if (null == copyOptions) {
			copyOptions = new CopyOptions();
		}
		BeanCopier.create(source, target, copyOptions).copy();
	}
1075838
public void setSources(java.util.Collection<Source> sources) {
        if (sources == null) {
            this.sources = null;
            return;
        }

        this.sources = new java.util.ArrayList<Source>(sources);
    }
701622
public GroovyCodeSource createGroovyCodeSource(final ClassSource source) throws IOException {
    checkNotNull(source);

    if (source.getUrl() != null) {
      return new GroovyCodeSource(source.getUrl());
    }
    if (source.getFile() != null) {
      return new GroovyCodeSource(source.getFile());
    }
    if (source.getInline() != null) {
      Inline inline = source.getInline();
      return new GroovyCodeSource(inline.getInput(), inline.getName(), inline.getCodeBase());
    }

    throw new Error("Unable to create GroovyCodeSource from: " + source);
  }