當前位置: 首頁>>代碼示例>>Java>>正文


Java ModuleChunk.getLanguageLevel方法代碼示例

本文整理匯總了Java中com.intellij.compiler.impl.javaCompiler.ModuleChunk.getLanguageLevel方法的典型用法代碼示例。如果您正苦於以下問題:Java ModuleChunk.getLanguageLevel方法的具體用法?Java ModuleChunk.getLanguageLevel怎麽用?Java ModuleChunk.getLanguageLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.compiler.impl.javaCompiler.ModuleChunk的用法示例。


在下文中一共展示了ModuleChunk.getLanguageLevel方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addCommandLineOptions

import com.intellij.compiler.impl.javaCompiler.ModuleChunk; //導入方法依賴的package包/類
public static void addCommandLineOptions(@NotNull ModuleChunk chunk,
                                         @NonNls List<String> commandLine,
                                         @NotNull String outputPath,
                                         @NotNull Sdk jdk,
                                         boolean isAnnotationProcessingMode) throws IOException {

  LanguageLevel languageLevel = chunk.getLanguageLevel();
  CompilerUtil.addSourceCommandLineSwitch(jdk, languageLevel, commandLine);

  commandLine.add("-verbose");

  final String bootCp = chunk.getCompilationBootClasspath();

  final String classPath = chunk.getCompilationClasspath();
  commandLine.add("-bootclasspath");
  addClassPathValue(commandLine, bootCp);

  commandLine.add("-classpath");
  addClassPathValue(commandLine, classPath);

  if (isAnnotationProcessingMode) {
    commandLine.add("-s");
    commandLine.add(outputPath.replace('/', File.separatorChar));
    final String moduleOutputPath = CompilerPaths.getModuleOutputPath(chunk.getModules()[0], false);
    if (moduleOutputPath != null) {
      commandLine.add("-d");
      commandLine.add(moduleOutputPath.replace('/', File.separatorChar));
    }
  }
  else {
    commandLine.add("-d");
    commandLine.add(outputPath.replace('/', File.separatorChar));
  }
}
 
開發者ID:diy1,項目名稱:error-prone-aspirator,代碼行數:35,代碼來源:ErrorProneIdeaCompiler.java

示例2: addCommandLineOptions

import com.intellij.compiler.impl.javaCompiler.ModuleChunk; //導入方法依賴的package包/類
public static void addCommandLineOptions(ModuleChunk chunk, @NonNls List<String> commandLine, String outputPath, Sdk jdk,
                                         boolean version1_0,
                                         boolean version1_1,
                                         List<File> tempFiles, boolean addSourcePath, boolean useTempFile,
                                         boolean isAnnotationProcessingMode) throws IOException {

  LanguageLevel languageLevel = chunk.getLanguageLevel();
  CompilerUtil.addSourceCommandLineSwitch(jdk, languageLevel, commandLine);
  CompilerUtil.addTargetCommandLineSwitch(chunk, commandLine);

  commandLine.add("-verbose");

  final String cp = chunk.getCompilationClasspath();
  final String bootCp = chunk.getCompilationBootClasspath();

  final String classPath;
  if (version1_0 || version1_1) {
    classPath = bootCp + File.pathSeparator + cp;
  }
  else {
    classPath = cp;
    commandLine.add("-bootclasspath");
    addClassPathValue(jdk, false, commandLine, bootCp, "javac_bootcp", tempFiles, useTempFile);
  }

  commandLine.add("-classpath");
  addClassPathValue(jdk, version1_0, commandLine, classPath, "javac_cp", tempFiles, useTempFile);

  if (!version1_1 && !version1_0 && addSourcePath) {
    commandLine.add("-sourcepath");
    // this way we tell the compiler that the sourcepath is "empty". However, javac thinks that sourcepath is 'new File("")'
    // this may cause problems if we have java code in IDEA working directory
    if (isAnnotationProcessingMode) {
      final int currentSourcesMode = chunk.getSourcesFilter();
      commandLine.add(chunk.getSourcePath(currentSourcesMode == ModuleChunk.TEST_SOURCES? ModuleChunk.ALL_SOURCES : currentSourcesMode));
    }
    else {
      commandLine.add("\"\"");
    }
  }

  if (isAnnotationProcessingMode) {
    commandLine.add("-s");
    commandLine.add(outputPath.replace('/', File.separatorChar));
    final String moduleOutputPath = CompilerPaths.getModuleOutputPath(chunk.getModules()[0], false);
    if (moduleOutputPath != null) {
      commandLine.add("-d");
      commandLine.add(moduleOutputPath.replace('/', File.separatorChar));
    }
  }
  else {
    commandLine.add("-d");
    commandLine.add(outputPath.replace('/', File.separatorChar));
  }
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:56,代碼來源:JavacCompiler.java


注:本文中的com.intellij.compiler.impl.javaCompiler.ModuleChunk.getLanguageLevel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。