Package org.eclipse.jdt.internal.compiler.impl

Examples of org.eclipse.jdt.internal.compiler.impl.CompilerOptions


     *         of Java used in the file
     * @return the compilation of the file
     * @throws InvalidSyntaxException if the file has syntax errors.
     */
    public static JavaCompilation compile(File file, long version) {
        CompilerOptions options = getDefaultCompilerOptions(version);
        Parser parser = createCommentRecorderParser(options);
        ICompilationUnit cu = createCompilationUnit(FileUtils.getContent(file), file.getName());
        CompilationResult compilationResult = createDefaultCompilationResult(cu, options);
        return new JavaCompilation(parser.parse(cu, compilationResult), parser.scanner);
    }
View Full Code Here


    private static ICompilationUnit createCompilationUnit(String source, String filename) {
        return new CompilationUnit(source.toCharArray(), filename, null);
    }

    private static CompilerOptions getDefaultCompilerOptions(long version) {
        CompilerOptions options = new CompilerOptions();
        options.docCommentSupport = true;
        options.complianceLevel = version;
        options.sourceLevel = version;
        options.targetJDK = version;
        return options;
View Full Code Here

        options.targetJDK = version;
        return options;
    }

    private static CompilerOptions getDefaultCompilerOptions() {
        CompilerOptions options = new CompilerOptions();
        options.docCommentSupport = true;
        options.complianceLevel = ClassFileConstants.JDK1_6;
        options.sourceLevel = ClassFileConstants.JDK1_6;
        options.targetJDK = ClassFileConstants.JDK1_6;
        return options;
View Full Code Here

            new ICompilationUnit[classNames.length];
        for (int i = 0; i < compilationUnits.length; i++) {
            String className = classNames[i];
            compilationUnits[i] = new CompilationUnit(fileNames[i], className);
        }
        CompilerOptions cOptions = new CompilerOptions(settings);
        cOptions.parseLiteralExpressionsAsConstants = true;
        Compiler compiler = new Compiler(env,
                                         policy,
                                         cOptions,
                                         requestor,
View Full Code Here

    singleTypeReference.resolvedType = binaryTypeBinding;
    return singleTypeReference;
  }

  private static LookupEnvironment createMockLookupEnvironment() {
    LookupEnvironment lookupEnvironment = new LookupEnvironment(null, new CompilerOptions(),
        null, null);
    return lookupEnvironment;
  }
View Full Code Here

    // This is needed by TypeOracleBuilder to parse metadata.
    if (enableDocCommentSupport) {
      settings.put(CompilerOptions.OPTION_DocCommentSupport,
          CompilerOptions.ENABLED);
    }
    return new CompilerOptions(settings);
  }
View Full Code Here

    INameEnvironment env = new INameEnvironmentImpl();
    IErrorHandlingPolicy pol = DefaultErrorHandlingPolicies.proceedWithAllProblems();
    IProblemFactory probFact = new DefaultProblemFactory(Locale.getDefault());
    ICompilerRequestor req = new ICompilerRequestorImpl();
    CompilerOptions options = JdtCompiler.getCompilerOptions(true);

    // This is only needed by TypeOracleBuilder to parse metadata.
    options.docCommentSupport = false;

    compiler = new CompilerImpl(env, pol, options, req, probFact);
View Full Code Here

   * @param javaSource String containing Java source to parse
   * @return a CompilationUnitDeclaration or null if parsing failed
   */
  private static CompilationUnitDeclaration parseJava(String javaSource) {
    CodeSnippetParsingUtil parsingUtil = new CodeSnippetParsingUtil(true);
    CompilerOptions options = new CompilerOptions();
    options.complianceLevel = ClassFileConstants.JDK1_6;
    options.originalSourceLevel = ClassFileConstants.JDK1_6;
    options.sourceLevel = ClassFileConstants.JDK1_6;
    CompilationUnitDeclaration unit = parsingUtil.parseCompilationUnit(
        javaSource.toString().toCharArray(), options.getMap(), true);
    if (unit.compilationResult().hasProblems()) {
      return null;
    }
    return unit;
  }
View Full Code Here

      jdtCompilerEvent.end();
    }
  }

  public static CompilerOptions getStandardCompilerOptions() {
    CompilerOptions options = new CompilerOptions() {
      {
        warningThreshold.clearAll();
      }
    };
View Full Code Here

    options.inlineJsrBytecode = true;
    return options;
  }

  public CompilerOptions getCompilerOptions() {
    CompilerOptions options = getStandardCompilerOptions();
    long jdtSourceLevel = jdtLevelByGwtLevel.get(sourceLevel);

    options.originalSourceLevel = jdtSourceLevel;
    options.complianceLevel = jdtSourceLevel;
    options.sourceLevel = jdtSourceLevel;
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.impl.CompilerOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.